help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ANOVA with empty cells


From: Mike Miller
Subject: Re: ANOVA with empty cells
Date: Mon, 11 Apr 2005 17:12:13 -0500 (CDT)

On Mon, 11 Apr 2005, Isaac Neuhaus wrote:

Here are the basic data:


   f1   f2   response
S1    1    1    7
S6    1    2    9
S8    1    2    10
S2    2    1    1
S3    3    1    4
S5    3    2    5
S7    3    2    5
S4    4    2    5

X =  [ 1,  1,  0,  0,  1,  0;
       1,  1,  0,  0, -1,  0;
       1,  1,  0,  0, -1,  0;
       1,  0,  1,  0,  1,  0;
       1,  0,  0,  1,  1,  1;
       1,  0,  0,  1, -1, -1;
       1,  0,  0,  1, -1, -1;
       1, -1, -1, -1, -1,  1];

Y = [7;9;10;1;4;5;5;5]


I was looking at residual sums of squares (RSS) like this:

b=X\Y; e=Y-X*b; e'*e

octave:48> b=X\Y; e=Y-X*b; e'*e
ans = 0.500000000000000

That is the correct error SS and it is equal to the answer given by SAS (it is on 2 df, so MSE = 0.50/2 = 0.25). See below.


octave:49> b=X(:,1:5)\Y; e=Y-X(:,1:5)*b; e'*e
ans = 1.25000000000000

That is the RSS for the interaction term. Subtract the error SS and you'll have 0.75, which is again the SAS answer.


But then I run into a problem computing Type III SS for the other effects, probably because I'm doing it the wrong way. I've really got to return to some other work now. Maybe someone else on the list can figure this out. We're trying to get this:


Source   DF     Type III SS     Mean Square    F Value    Pr > F
R         3     36.30000000     12.10000000      48.40    0.0203
T         1      4.08333333      4.08333333      16.33    0.0561
R*T       1      0.75000000      0.75000000       3.00    0.2254


From these data:

Y = [7;9;10;1;4;5;5;5]

X = [ 1, 1, 0, 0, 1, 0;
     1, 1, 0, 0,-1, 0;
     1, 1, 0, 0,-1, 0;
     1, 0, 1, 0, 1, 0;
     1, 0, 0, 1, 1, 1;
     1, 0, 0, 1,-1,-1;
     1, 0, 0, 1,-1,-1;
     1,-1,-1,-1,-1, 1]

Where the first column of X is for the intercept, the next three columns are for R, the 5th column is for T and the last column is for R*T.

Mike

--
Michael B. Miller, Ph.D.
Assistant Professor
Division of Epidemiology and Community Health
and Institute of Human Genetics
University of Minnesota
http://taxa.epi.umn.edu/~mbmiller/



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]