[R] Type III Sums of Squares
Thomas Lumley
tlumley at u.washington.edu
Mon Jan 28 17:35:19 CET 2002
On Mon, 28 Jan 2002, Moffet, Corey wrote:
> I am trying to reproduce an analysis done in SAS from which Type III Sums of
> squares are used. How can you get Type III sums of squares in an aov similar
> to what SAS provides?
>
You can get any set of sums of squares by fitting two aov models and
comparing them (it's a FAQ). While I don't speak SAS fluently I believe
that the Type III sums of squares for a term A compare a full model to a
model without A but with everything else
eg
full.model<-aov(Y~A+B+C,data=df)
anova(full.model, update(full.model,.~.-A))
You can use
drop1(full.model)
to get all of these at once. By default this will not give Type III SS
for main effects in the presence of interactions but as these are usually
silly that's not a big problem.
If you really do want to test for a main effect in the presence of
interactions (which occasionally makes sense) you can specify a list of
specific terms to consider, eg:
full.model2<-aov(Y~A+B*C,data=df)
drop1(full.model2, scope=c("A","B"))
-thomas
Thomas Lumley Asst. Professor, Biostatistics
tlumley at u.washington.edu University of Washington, Seattle
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list