[R] two way ANOVA with unequal sample sizes

Thomas Lumley tlumley at u.washington.edu
Tue Oct 16 22:19:58 CEST 2001


On Tue, 16 Oct 2001, julien claude wrote:

> Hi,
>
> I am trying a two way anova with unequal sample sizes but results are not
> as expected:
>
> I take the example from Applied Linear Statistical Models (Neter et al.
> pp889-897, 1996)
>
> growth rate		gender	bone development
> 1.4			1		1
> 2.4			1		1
> 2.2			1		1
> 2.4			1		2
> 2.1			2		1
> 1.7			2		1
> 2.5			2		2
> 1.8			2		2
> 2			2		2
> 0.7			3		1
> 1.1			3		1
> 0.5			3		2
> 0.9			3		2
> 1.3			3		2
>
> expected results are
>
> source of variation	SS	df	MS	F
> gender			0.12	1	0.12	0.74
> bone development	4.1897	2	2.0949	12.89**
> interaction		0.0754	2	0.377	0.23
> Error			1.3	8	0.1625

There's something fairly fundamental wrong here. Gender in your data has
three levels, but your expected results give only 1 df. If you check the
book again you  will find you have the column labels wrong. This isn't
main problem, though.

> #In the both cases, results for main effects differ from those expected in
> Neter et al.

Yes, but the book clearly warns you that many software packages don't
have the same choices for sums of squares in unbalanced designs that they
have.  R is one of those many packages.

Neter et al, as they carefull explain, present ANOVA tables that summarise
comparisons from a bunch of different models and on page 895 they show all
the sets of models they use to construct their ANOVA table.

	-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