help-octave
[Top][All Lists]
Advanced

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

Re: ANOVA with empty cells


From: Isaac Neuhaus
Subject: Re: ANOVA with empty cells
Date: Mon, 11 Apr 2005 21:11:33 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030922

Thanks Mike. That is the same answer that I get. I can get the correct answer for the interaction but I cannot figure how to get the same SAS answer for the fixed effects. Thanks for your help . I hope somebody can take a look at this in more detail.

Isaac

C1 = [0,1,0,0,0,0;
    0,0,1,0,0,0;
    0,0,0,1,0,0]    pval = 0.0178    (in SAS 0.0203)

C2 = [0,0,0,0,1,0]    pval = 0.0550    (in SAS 0.0561)

C3 = [0,0,0,0,0,1]    pval = 0.2254    (the same in SAS)



Mike Miller wrote:

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





-------------------------------------------------------------
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]