Example 4.4 from Experimental Design and Analysis for Tree Improvement
Source:R/Exam4.4.R
Exam4.4.Rd
Exam4.4 presents the height means for 4 seedlots under factorial arrangement for two levels of Fertilizer and two levels of Irrigation.
References
E.R. Williams, C.E. Harwood and A.C. Matheson (2023). Experimental Design and Analysis for Tree Improvement. CSIRO Publishing (https://www.publish.csiro.au/book/3145/).
Author
Muhammad Yaseen (myaseen208@gmail.com)
Sami Ullah (samiullahuos@gmail.com)
Examples
library(car)
library(dae)
library(dplyr)
library(emmeans)
library(ggplot2)
library(lmerTest)
library(magrittr)
library(predictmeans)
data(DataExam4.4)
# Pg. 58
fm4.6 <-
aov(
formula = height ~ repl + irrig*fert*seedlot +
Error(repl/irrig:fert)
, data = DataExam4.4
)
#> Warning: Error() model is singular
# Pg. 61
summary(fm4.6)
#>
#> Error: repl
#> Df Sum Sq Mean Sq
#> repl 1 0.7564 0.7564
#>
#> Error: repl:irrig:fert
#> Df Sum Sq Mean Sq F value Pr(>F)
#> irrig 1 0.1 0.1 0.154 0.721
#> fert 1 590.6 590.6 841.110 9e-05 ***
#> irrig:fert 1 0.0 0.0 0.010 0.926
#> Residuals 3 2.1 0.7
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#>
#> Error: Within
#> Df Sum Sq Mean Sq F value Pr(>F)
#> seedlot 3 39.65 13.218 19.680 6.3e-05 ***
#> irrig:seedlot 3 1.11 0.370 0.551 0.6572
#> fert:seedlot 3 9.95 3.317 4.938 0.0185 *
#> irrig:fert:seedlot 3 1.74 0.579 0.862 0.4874
#> Residuals 12 8.06 0.672
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
# Pg. 61
model.tables(x = fm4.6, type = "means")
#> Tables of means
#> Grand mean
#>
#> 10.00437
#>
#> repl
#> repl
#> 1 2
#> 10.158 9.851
#>
#> irrig
#> irrig
#> none plus
#> 9.946 10.062
#>
#> fert
#> fert
#> none plus
#> 5.708 14.301
#>
#> seedlot
#> seedlot
#> Bulahdelah Coffs SO Pomona pltn Atherton
#> 10.178 11.404 10.149 8.287
#>
#> irrig:fert
#> fert
#> irrig none plus
#> none 5.635 14.257
#> plus 5.781 14.344
#>
#> irrig:seedlot
#> seedlot
#> irrig Bulahdelah Coffs SO Pomona pltn Atherton
#> none 10.060 11.647 10.055 8.022
#> plus 10.295 11.160 10.242 8.552
#>
#> fert:seedlot
#> seedlot
#> fert Bulahdelah Coffs SO Pomona pltn Atherton
#> none 5.687 6.790 5.410 4.945
#> plus 14.667 16.017 14.887 11.630
#>
#> irrig:fert:seedlot
#> , , seedlot = Bulahdelah
#>
#> fert
#> irrig none plus
#> none 5.275 14.845
#> plus 6.100 14.490
#>
#> , , seedlot = Coffs SO
#>
#> fert
#> irrig none plus
#> none 7.125 16.170
#> plus 6.455 15.865
#>
#> , , seedlot = Pomona pltn
#>
#> fert
#> irrig none plus
#> none 5.625 14.485
#> plus 5.195 15.290
#>
#> , , seedlot = Atherton
#>
#> fert
#> irrig none plus
#> none 4.515 11.530
#> plus 5.375 11.730
#>
# Pg. 61
emmeans(object = fm4.6, specs = ~ irrig)
#> Note: re-fitting model with sum-to-zero contrasts
#> Warning: Error() model is singular
#> NOTE: Results may be misleading due to involvement in interactions
#> irrig emmean SE df asymp.LCL asymp.UCL
#> none 9.95 NaN NaN NaN NaN
#> plus 10.06 NaN NaN NaN NaN
#>
#> Results are averaged over the levels of: repl, fert, seedlot
#> Warning: EMMs are biased unless design is perfectly balanced
#> Confidence level used: 0.95
emmip(object = fm4.6, formula = ~ irrig) +
theme_classic()
#> Note: re-fitting model with sum-to-zero contrasts
#> Warning: Error() model is singular
#> NOTE: Results may be misleading due to involvement in interactions