[Rd] Type III Sums of Squares?
Tue, 09 May 2000 11:44:07 +0100
I'd like to propose an extension to the function summary.aov.
In Splus (2000, I don't know about other versions), summary.aov allows a
parameter ssType to be set to 1 or 3 (defaults to 1) to choose the type of
Sums of Squares.
I know I can get Type III SS in R with drop1(model), but including the
functionality into summary.aov would, in my opinion,
- yield a more usable table (for example, the residual Df are missing in the
- put it into the obvious place to look for it
- increase S-Plus compatibility (by a minor degree, I'll admit)
- not break anything else (I might be wrong here)
Not knowing how to add it to the summary.aov function, I wrote a function to
extract the SS from drop1 output and paste them into a summary.aov table
(see below), but that's of course an ugly solution. I feel that there has to
be a simpler and more efficient way, such as reusing just the required parts
of drop1 inside summary.aov. But since I cannot give the matter enough time
to do it correctly, someone with more insight into the source code would
have to do it.
If including the functionality via an additional parameter doesn't require a
whole rebuild of summary.aov, I'd like to put it as a minor item on the
wish-list for some next version of R.
Cheers (and thanks for a great piece of software)
# ugly hack, relies on names in output
# tables of drop1 and summary.aov
s <- summary(aov.obj)
d <- drop1(aov.obj, test = "F")
n <- nrow(d)
s[]$"Sum Sq"[1:(n - 1)] <- d$Sum[2:n]
s[]$"Mean Sq" <- s[]$"Sum Sq"/s[]$Df
s[]$"F value"[1:(n - 1)] <- d$F[2:n]
s[]$"Pr(>F)"[1:(n - 1)] <- d$Pr[2:n]
names(s[])[names(s[]) == "Sum Sq"] <- "Sum Sq (Type III)"
Tel. ++41 1 632 43 19
Fax ++41 1 632 12 15
r-devel 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: firstname.lastname@example.org