A classical N, P, K (nitrogen, phosphate, potassium) factorial experiment on the growth of peas conducted on 6 blocks. Each half of a fractional factorial design confounding the NPK interaction was used on 3 of the plots.

npk

Format

The npk data frame has 24 rows and 5 columns:

block

which block (label 1 to 6).

N

indicator (0/1) for the application of nitrogen.

P

indicator (0/1) for the application of phosphate.

K

indicator (0/1) for the application of potassium.

yield

Yield of peas, in pounds/plot (the plots were (1/70) acre).

Note

This dataset is also contained in R 3.0.2 and later.

Source

Imperial College, London, M.Sc. exercise sheet.

References

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

Examples

options(contrasts = c("contr.sum", "contr.poly"))
npk.aov <- aov(yield ~ block + N*P*K, npk)
## IGNORE_RDIFF_BEGIN
npk.aov
#> Call:
#>    aov(formula = yield ~ block + N * P * K, data = npk)
#> 
#> Terms:
#>                  block      N      P      K    N:P    N:K    P:K Residuals
#> Sum of Squares  343.29 189.28   8.40  95.20  21.28  33.14   0.48    185.29
#> Deg. of Freedom      5      1      1      1      1      1      1        12
#> 
#> Residual standard error: 3.9294
#> 1 out of 13 effects not estimable
#> Estimated effects may be unbalanced
summary(npk.aov)
#>             Df Sum Sq Mean Sq F value Pr(>F)   
#> block        5    343    68.7    4.45 0.0159 * 
#> N            1    189   189.3   12.26 0.0044 **
#> P            1      8     8.4    0.54 0.4749   
#> K            1     95    95.2    6.17 0.0288 * 
#> N:P          1     21    21.3    1.38 0.2632   
#> N:K          1     33    33.1    2.15 0.1686   
#> P:K          1      0     0.5    0.03 0.8628   
#> Residuals   12    185    15.4                  
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
alias(npk.aov)
#> Model :
#> yield ~ block + N * P * K
#> 
#> Complete :
#>          (Intercept) block1 block2 block3 block4 block5 N1 P1 K1 N1:P1 N1:K1
#> N1:P1:K1  0           1     -1     -1     -1      1      0  0  0  0     0   
#>          P1:K1
#> N1:P1:K1  0   
#> 
coef(npk.aov)
#> (Intercept)      block1      block2      block3      block4      block5 
#>    54.87500    -0.85000     2.57500     5.90000    -4.75000    -4.35000 
#>          N1          P1          K1       N1:P1       N1:K1       P1:K1 
#>    -2.80833     0.59167     1.99167    -0.94167    -1.17500     0.14167 
options(contrasts = c("contr.treatment", "contr.poly"))
npk.aov1 <- aov(yield ~ block + N + K, data = npk)
summary.lm(npk.aov1)
#> 
#> Call:
#> aov(formula = yield ~ block + N + K, data = npk)
#> 
#> Residuals:
#>    Min     1Q Median     3Q    Max 
#> -6.408 -2.144  0.204  2.329  7.075 
#> 
#> Coefficients:
#>             Estimate Std. Error t value Pr(>|t|)    
#> (Intercept)    53.21       2.28   23.38  8.5e-14 ***
#> block2          3.42       2.79    1.23    0.237    
#> block3          6.75       2.79    2.42    0.028 *  
#> block4         -3.90       2.79   -1.40    0.181    
#> block5         -3.50       2.79   -1.26    0.227    
#> block6          2.32       2.79    0.83    0.416    
#> N1              5.62       1.61    3.49    0.003 ** 
#> K1             -3.98       1.61   -2.48    0.025 *  
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
#> Residual standard error: 3.94 on 16 degrees of freedom
#> Multiple R-squared:  0.716,	Adjusted R-squared:  0.592 
#> F-statistic: 5.77 on 7 and 16 DF,  p-value: 0.00181
#> 
se.contrast(npk.aov1, list(N=="0", N=="1"), data = npk)
#> [1] 1.6092
model.tables(npk.aov1, type = "means", se = TRUE)
#> Tables of means
#> Grand mean
#>        
#> 54.875 
#> 
#>  block 
#> block
#>     1     2     3     4     5     6 
#> 54.03 57.45 60.78 50.13 50.53 56.35 
#> 
#>  N 
#> N
#>     0     1 
#> 52.07 57.68 
#> 
#>  K 
#> K
#>     0     1 
#> 56.87 52.88 
#> 
#> Standard errors for differences of means
#>         block     N     K
#>         2.787 1.609 1.609
#> replic.     4    12    12
## IGNORE_RDIFF_END