Example 8.2 from Experimental Design and Analysis for Tree Improvement
Source:R/Exam8.2.R
Exam8.2.Rd
Exam8.2 presents the Diameter at breast height (Dbh) of 60 SeedLots under layout of row column design with 6 rows and 10 columns in 18 countries and 59 provinces of 18 selected countries.
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(DataExam8.2)
# Pg.
fm8.2 <-
lmerTest::lmer(
formula = dbh ~ repl + column +
contcompf + contcompf:standard +
(1|repl:row) + (1|repl:column) +
(1|contcompv:clone)
, data = DataExam8.2
)
#> fixed-effect model matrix is rank deficient so dropping 5 columns / coefficients
if (FALSE) { # \dontrun{
varcomp(fm8.2)
} # }
anova(fm8.2)
#> Missing cells for: contcompf0:standard0, contcompf1:standardUG323, contcompf1:standardU6, contcompf1:standardPN14, contcompf1:standardSSOseed.
#> Interpret type III hypotheses with care.
#> Type III Analysis of Variance Table with Satterthwaite's method
#> Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
#> repl 3.2720 0.8180 4 26.467 2.0489 0.1162606
#> column 3.1018 0.6204 5 19.545 1.5539 0.2194719
#> contcompf 5.3203 5.3203 1 54.905 13.3265 0.0005845 ***
#> contcompf:standard 20.6587 6.8862 3 207.152 17.2488 0.0000000004896 ***
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Anova(fm8.2, type = "II", test.statistic = "Chisq")
#> Analysis of Deviance Table (Type II Wald chisquare tests)
#>
#> Response: dbh
#> Chisq Df Pr(>Chisq)
#> repl 8.1957 4 0.08467 .
#> column 7.7694 5 0.16941
#> contcompf 4.6841 1 0.03044 *
#> contcompf:standard 51.7463 3 3.392e-11 ***
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
predictmeans(model = fm8.2, modelterm = "repl")
#> Warning: Missing treatments' combination appeared, predicted means maybe misleading!
#> Warning: Missing treatments' combination appeared, predicted means maybe misleading!
#> $`Predicted Means`
#> repl
#> 1 2 3 4 5
#> 7.8926 8.2070 8.3429 8.4604 8.5464
#>
#> $`Standard Error of Means`
#> repl
#> 1 2 3 4 5
#> 0.33123 0.33126 0.32992 0.32992 0.32992
#>
#> $`Standard Error of Differences`
#> Max.SED Min.SED Aveg.SED
#> 0.2239675 0.2167320 0.2196681
#>
#> $LSD
#> Max.LSD Min.LSD Aveg.LSD
#> 0.44792 0.43345 0.43932
#> attr(,"Significant level")
#> [1] 0.05
#> attr(,"Degree of freedom")
#> [1] 60.56
#>
#> $mean_table
#> repl Mean SE Df LL(95%) UL(95%)
#> 1 1 7.8926 0.33123 60.55892 7.2302 8.5551
#> 2 2 8.2070 0.33126 60.55892 7.5445 8.8695
#> 3 3 8.3429 0.32992 60.55892 7.6831 9.0027
#> 4 4 8.4604 0.32992 60.55892 7.8006 9.1202
#> 5 5 8.5464 0.32992 60.55892 7.8866 9.2062
#>
predictmeans(model = fm8.2, modelterm = "column")
#> Warning: Missing treatments' combination appeared, predicted means maybe misleading!
#> Warning: Missing treatments' combination appeared, predicted means maybe misleading!
#> $`Predicted Means`
#> column
#> 1 2 3 4 5 6
#> 8.2214 8.4708 8.3779 7.9721 7.8166 8.7141
#>
#> $`Standard Error of Means`
#> column
#> 1 2 3 4 5 6
#> 0.31662 0.39168 0.39315 0.26648 0.26646 0.31653
#>
#> $`Standard Error of Differences`
#> Max.SED Min.SED Aveg.SED
#> 0.2714760 0.2102583 0.2373610
#>
#> $LSD
#> Max.LSD Min.LSD Aveg.LSD
#> 0.54250 0.42017 0.47433
#> attr(,"Significant level")
#> [1] 0.05
#> attr(,"Degree of freedom")
#> [1] 62.99
#>
#> $mean_table
#> column Mean SE Df LL(95%) UL(95%)
#> 1 1 8.2214 0.31662 62.99437 7.5887 8.8542
#> 2 2 8.4708 0.39168 62.99437 7.6881 9.2535
#> 3 3 8.3779 0.39315 62.99437 7.5923 9.1636
#> 4 4 7.9721 0.26648 62.99437 7.4396 8.5047
#> 5 5 7.8166 0.26646 62.99437 7.2841 8.3491
#> 6 6 8.7141 0.31653 62.99437 8.0816 9.3467
#>
emmeans(object = fm8.2, specs = ~contcompf|standard)
#> NOTE: A nesting structure was detected in the fitted model:
#> standard %in% contcompf
#> contcompf = 1, standard = 0:
#> emmean SE df lower.CL upper.CL
#> 8.91 0.117 65.9 8.67 9.14
#>
#> contcompf = 0, standard = UG323:
#> emmean SE df lower.CL upper.CL
#> 8.97 0.770 55.6 7.43 10.51
#>
#> contcompf = 0, standard = U6:
#> emmean SE df lower.CL upper.CL
#> 6.55 0.770 55.5 5.01 8.10
#>
#> contcompf = 0, standard = PN14:
#> emmean SE df lower.CL upper.CL
#> 7.70 0.771 55.8 6.16 9.25
#>
#> contcompf = 0, standard = SSOseed:
#> emmean SE df lower.CL upper.CL
#> 6.08 0.770 55.5 4.54 7.63
#>
#> Results are averaged over the levels of: repl, column
#> Degrees-of-freedom method: kenward-roger
#> Confidence level used: 0.95