Learn R Programming

sommer (version 2.1)

yates.oats: Yield of oats in a split-block experiment

Description

The yield of oats from a split-plot field trial using three varieties and four levels of manurial treatment. The experiment was laid out in 6 blocks of 3 main plots, each split into 4 sub-plots. The varieties were applied to the main plots and the manurial (nitrogen) treatments to the sub-plots.

Arguments

Format

Source

Yates, Frank (1935) Complex experiments, Journal of the Royal Statistical Society Suppl. 2, 181--247.

References

Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer.

Examples

Run this code

### ========================== ###
### using the mmer2 function 
### ========================== ###

data(yates.oats)
head(yates.oats)
m3 <- mmer2(fixed=Y ~ V*N, random = ~ B + B:MP, 
            rcov = ~ ar1(col):ar1(row),
            data = yates.oats)
summary(m3)       
m3$var.comp

### ========================== ###
### using the mmer function 
### ========================== ###

###response
y<-yates.oats$Y
###fixed effects
X1 <- model.matrix(~V*N,yates.oats)
###random effects
Z1 <- model.matrix(~B-1, yates.oats)
Z2 <- model.matrix(~B:MP-1, yates.oats)
ETA <- list(B=list(Z=Z1),BMP=list(Z=Z2))
###residual structures
R1 <- AR1.mat(.25,4) #col 4
R2 <- AR1.mat(.25,18) #row 18 
RETA <- list(list(R1,R2,type=c("AR1","AR1")))
###run the model
m4 <- mmer(Y=y,X=X1,Z=ETA,R=RETA)
summary(m4)

Run the code above in your browser using DataLab