# Exercise 5.2 in Pinheiro & Bates, 2000 library(nlme) data(Oats) # (a) fm4Oats <- lme(yield~nitro, data=Oats, random=~1|Block/Variety) fm4Oats.cor1 <- update(fm4Oats, random=~1|Block, corr=corSymm(form=~1|Block/Variety)) summary(fm4Oats.cor1) # (b) intervals(fm4Oats.cor1) fm4Oats.cor2 <- update(fm4Oats.cor1, correlation=corCompSymm(form=~1|Block/Variety)) anova(fm4Oats.cor1,fm4Oats.cor2) summary(fm1BW.lme.het) # (c) summary(fm4Oats) summary(fm4Oats.cor2) sqrt(11.00500^2+12.8669^2) # within-block variance 11.00500^2/(11.00500^2+12.8669^2) # within-wholeplot variance # (d) fm4Oats.cor3 <- gls(yield~nitro, data=Oats, corr=corCompSymm(form=~1|Block/Variety)) summary(fm4Oats.cor3) anova(fm4Oats.cor2,fm4Oats.cor3)