Dear all, I am trying to repeat an example from Sokal and Rohlfs "Biometry" -- Box 11.4, example of a randomized-complete-blocks experiment. The data is fairly simple: series genotype weight 1 pp 0.958 1 pb 0.985 1 bb 0.925 2 pp 0.971 2 pb 1.051 2 bb 0.952 3 pp 0.927 3 pb 0.891 3 bb 0.892 4 pp 0.971 4 pb 1.010 4 bb 0.955 The model used for ANOVA in the book is Y_{ij} = \mu + \alpha_i + B_i + [(\alpha B)_{ij}] + \epsilon_{ij} (I am not quite confident how to represent this model in R, see below) The ANOVA table from S&R looks like this: MSB series 3 0.021 0.007 10.23 ** MSA genotypes 2 0.010 0.005 6.97 * MSE error 6 0.004 0.001 In R, I am using the following model (is this correct?) aov.ob = aov( genotype ~ genotype + series ) However, my results are Df Sum Sq Mean Sq F value Pr(>F) series 3 0.0135867 0.0045289 6.6360 0.02469 * genotype 2 0.0056732 0.0028366 4.1563 0.07367 . Residuals 6 0.0040948 0.0006825 What am I doing wrong? Regards, January --
You have mis-transcribed the data: Series Genotype Weight 1 pb 0.986 3 bb 0.829 anova(aov(weight ~ series + genotype, data=dat)) gives the correct results when compared to S&R. Cheers, Simon. January Weiner wrote:> Dear all, > > I am trying to repeat an example from Sokal and Rohlfs "Biometry" -- > Box 11.4, example of a randomized-complete-blocks experiment. > > The data is fairly simple: > > series genotype weight > 1 pp 0.958 > 1 pb 0.985 > 1 bb 0.925 > 2 pp 0.971 > 2 pb 1.051 > 2 bb 0.952 > 3 pp 0.927 > 3 pb 0.891 > 3 bb 0.892 > 4 pp 0.971 > 4 pb 1.010 > 4 bb 0.955 > > The model used for ANOVA in the book is > > Y_{ij} = \mu + \alpha_i + B_i + [(\alpha B)_{ij}] + \epsilon_{ij} > > (I am not quite confident how to represent this model in R, see below) > > The ANOVA table from S&R looks like this: > > MSB series 3 0.021 0.007 10.23 ** > MSA genotypes 2 0.010 0.005 6.97 * > MSE error 6 0.004 0.001 > > In R, I am using the following model (is this correct?) > > aov.ob = aov( genotype ~ genotype + series ) > > However, my results are > > Df Sum Sq Mean Sq F value Pr(>F) > series 3 0.0135867 0.0045289 6.6360 0.02469 * > genotype 2 0.0056732 0.0028366 4.1563 0.07367 . > Residuals 6 0.0040948 0.0006825 > > What am I doing wrong? > > Regards, > January > > -- > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > >-- Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat. Centre for Resource and Environmental Studies The Australian National University Canberra ACT 0200 Australia T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au F: +61 2 6125 0757 CRICOS Provider # 00120C The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. - John Tukey.
Ops, sorry. OK, as you see, I am going through S&R and doing the examples using R. I have a further question, on the nested ANOVA example from Box 10.1 (mosquito female wing lengths). I made sure that the data is correct :-) (data below). I am not sure how to create in R a Model II nested ANOVA. aov( wing ~ cage / female ) which is, I believe, a fixed effect nested ANOVA where females are nested within cages produced the correct sum of squares, but computates a different F value for the cage effect: Df Sum Sq Mean Sq F value Pr(>F) cage 2 665.68 332.84 255.70 1.452e-10 *** cage:female 9 1720.68 191.19 146.88 6.981e-11 *** Residuals 12 15.62 1.30 (whereas in S&R, among cages F = 1.741; the rest is same). The F value for the cage:female effect is the same as in S&R. Why do I get a higly significant cage effect? In S&R, the significance of the cage effect is done by F = MSamong / MSsubgr = 332.84 / 191.19 = 1.74. In the R model, F = 255.70, and I do not understand where this value comes from (at first I thought that it is MSamong / MSerror = 332.84 / 1.3 = 256.0308). I am confused... How should I modify the model? Another question: is there a way to automatically estimate the variance components, or do I have to take the respective MS' and calculate it myself? Thanks, January OK, here is the data: cage female wing cage1 f1 58.5 cage1 f1 59.5 cage1 f2 77.8 cage1 f2 80.9 cage1 f3 84.0 cage1 f3 83.6 cage1 f4 70.1 cage1 f4 68.3 cage2 f1 69.8 cage2 f1 69.8 cage2 f2 56.0 cage2 f2 54.5 cage2 f3 50.7 cage2 f3 49.3 cage2 f4 63.8 cage2 f4 65.8 cage3 f1 56.6 cage3 f1 57.5 cage3 f2 77.8 cage3 f2 79.2 cage3 f3 69.9 cage3 f3 69.2 cage3 f4 62.1 cage3 f4 64.5 Cheers, January --
## tmp.dat is your data in a file. wing <- read.table("tmp.dat", header=TRUE) wing.aov <- aov( wing ~ cage + Error(cage:female), data=wing ) anova(wing.aov) ## Notice that at full precision, the R values of the mean squares ## give the number you are looking for 332.84 / 1.3017
> ## tmp.dat is your data in a file. > > wing <- read.table("tmp.dat", header=TRUE) > wing.aov <- aov( wing ~ cage + Error(cage:female), data=wing ) > anova(wing.aov)Thanks for the answer! However, I am not able to run the above:> wing <- read.table("nested.txt", header=TRUE) > names(wing)[1] "cage" "female" "wing"> wing.aov <- aov( wing ~ cage + Error(cage:female), data=wing )Warning message: Error() model is singular in: aov(wing ~ cage + Error(cage:female), data = wing)> anova( wing.aov )Error in anova(wing.aov) : no applicable method for "anova" j.
my apologies. anova() doesn't work on class "aovlist". It is necessary to use summary(). They are similar for "aov", but not for "aovlist". wing <- read.table("tmp.dat", header=TRUE) wing.aov <- aov( wing ~ cage + Error(cage:female), data=wing ) summary(wing.aov)