pspp-dev
[Top][All Lists]
Advanced

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

Re: GLM, encodings and SSQs


From: John Darrington
Subject: Re: GLM, encodings and SSQs
Date: Wed, 23 Nov 2011 10:05:35 +0000
User-agent: Mutt/1.5.18 (2008-05-17)

On Tue, Nov 22, 2011 at 05:11:32PM -0500, Jason Stover wrote:
     
     This is what I coded in glm.c to begin with, but it wasn't giving the
     same result as SPSS. I found that SPSS drops an interaction term if it
     first drops a main effect contained in it. So I went back to mimic
     that behavior, and now it doesn't seem to match SAS.
     
     Now I wonder if SAS and SPSS agree on the meaning of type 3 sums of
     squares.  It would be nice to have some tests using both programs.
     
I did some more experimentation, and a bit more research.  What seems clear is:

1.  What we currently implement is what most people call "Type 2" ssq.  Our
  results agree with all the SAS Type II examples - SPSS examples showing 
  Type 2 results are few and far between (because the default output is Type 3)
  but the few which I found agree with our results.

2.  This is consistent with http://goanna.cs.rmit.edu.au/~fscholer/anova.php
  which explains type 1, 2 and 3 in mathematical terms.  I had a look at our
  get_ssq function in glm.c and am satisfied that we are doing what this
  web page calls Type 2.

     
     I agree, and in the mean time, if anybody out there has access to both
     SAS and SPSS, please send us a few test results showing the type 1,
     type 2 and type 3 sums of squares from both programs. And the data.
     

3. One such example I found at 
   http://www.uvm.edu/~dhowell/StatPages/More_Stuff/Type1-3.pdf

   which is rather nice, because the author shows how to manually calculate
    the ssqs for Types 1, 2 and 3 and apparently got the same answer as spss


To summarize what I found:
For a design with two IVs A and B and in interaction between them A*B,
the calculation for the ssqs are as follows:

Type 2: SSQ_2 (A) = SS(A, B) - SS(B)
Type 3: SSQ_3 (A) = SS(A, B, A*B) - SS(B, A*B)


Given that we currently implement SSQ_2 I thought it would be straightforward
to implement SSQ_3 with the help of D.Howell's worked example. So I tried 
modifying get_ssq accordingly. Unfortunately, what I found is that whilst
our reg_sweep function gives correct results for

 SS(A, B, A*B),
 SS(A, B),
 SS(A),
 SS(B)

it gives quite wrong (at least different from Howell's) results for

 SS(A, A*B) and
 SS(B, A*B)


In other words, reg_sweep is not giving what we want when presented with a
covariance matrix containing entries for an interaction BUT WITHOUT 
corresponding entries for the independent variables which comprise that 
interaction.

Quite why it isn't giving what we want, I don't know.

J'

-- 
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://pgp.mit.edu or any PGP keyserver for public key.

Attachment: signature.asc
Description: Digital signature


reply via email to

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