Example 2.1 from Experimental Design and Analysis for Tree Improvement
Source:R/Exam2.1.R
Exam2.1.Rd
Exam2.1 is used to compare two seed lots by using single factor ANOVA.
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)
#> Loading required package: carData
library(dae)
#> Loading required package: ggplot2
library(dplyr)
#>
#> Attaching package: ‘dplyr’
#> The following object is masked from ‘package:car’:
#>
#> recode
#> The following objects are masked from ‘package:stats’:
#>
#> filter, lag
#> The following objects are masked from ‘package:base’:
#>
#> intersect, setdiff, setequal, union
library(emmeans)
#> Welcome to emmeans.
#> Caution: You lose important information if you filter this package's results.
#> See '? untidy'
library(ggplot2)
library(lmerTest)
#> Loading required package: lme4
#> Loading required package: Matrix
#>
#> Attaching package: ‘lmerTest’
#> The following object is masked from ‘package:lme4’:
#>
#> lmer
#> The following object is masked from ‘package:stats’:
#>
#> step
library(magrittr)
library(predictmeans)
#> Loading required package: glmmTMB
#> Loading required package: nlme
#>
#> Attaching package: ‘nlme’
#> The following object is masked from ‘package:lme4’:
#>
#> lmList
#> The following object is masked from ‘package:dplyr’:
#>
#> collapse
data(DataExam2.1)
# Pg. 22
fmtab2.3 <- lm(formula = dbh ~ seedlot, data = DataExam2.1)
# Pg. 23
anova(fmtab2.3)
#> Analysis of Variance Table
#>
#> Response: dbh
#> Df Sum Sq Mean Sq F value Pr(>F)
#> seedlot 1 14.27 14.2695 3.2531 0.09284 .
#> Residuals 14 61.41 4.3864
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
# Pg. 23
emmeans(object = fmtab2.3, specs = ~ seedlot)
#> seedlot emmean SE df lower.CL upper.CL
#> SO 30.6 0.74 14 29.0 32.2
#> P 28.7 0.74 14 27.1 30.3
#>
#> Confidence level used: 0.95
emmip(object = fmtab2.3, formula = ~ seedlot) +
theme_classic()