Description Format Details Source References Examples

Potato factorial experiment with missing values

A data frame with 80 observations on the following 3 variables.

`trt`

treatment factor with levels

`0`

`K`

`N`

`P`

`NK`

`KP`

`NP`

`NKP`

`block`

block, 10 levels

`y`

infection intensity

The response variable `y`

is the intensity of infection of potato
tubers innoculated with *Phytophthora Erythroseptica*.

Yates (1933) presents an iterative algorithm to estimate missing values in a matrix, using this data as an example.

F. Yates, 1933.
The analysis of replicated experiments when the field results are incomplete.
*Emp. J. Exp. Agric.*, 1, 129–142.

Steel & Torrie, 1980, Principles and Procedures of Statistics, 2nd Edition, page 212.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | ```
## Not run:
library(agridat)
data(yates.missing)
dat <- yates.missing
libs(lattice)
bwplot(y ~ trt, data=dat,
xlab="Treatment", ylab="Infection intensity",
main="yates.missing")
libs(reshape2)
mat0 <- acast(dat[, c('trt','block','y')], trt~block,
id.var=c('trt','block'), value.var='y')
# Use lm to estimate missing values. The estimated missing values
# are the same as in Yates (1933)
m1 <- lm(y~trt+block, dat)
dat$pred <- predict(m1, new=dat[, c('trt','block')])
dat$filled <- ifelse(is.na(dat$y), dat$pred, dat$y)
mat1 <- acast(dat[, c('trt','block','pred')], trt~block,
id.var=c('trt','block'), value.var='pred')
# Another method to estimate missing values via PCA
libs("nipals")
m2 <- nipals(mat0, center=FALSE, ncomp=3, fitted=TRUE)
# mat2 <- m2$scores
mat2 <- m2$fitted
# Compare
ord <- c("0","N","K","P","NK","NP","KP","NKP")
print(mat0[ord,], na.print=".")
round(mat1[ord,] ,2)
round(mat2[ord,] ,2)
# SVD with 3 components recovers original data better
sum((mat0-mat1)^2, na.rm=TRUE)
sum((mat0-mat2)^2, na.rm=TRUE) # Smaller SS => better fit
## End(Not run)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.