| Title: | Experimental Design and Analysis for Tree Improvement |
|---|---|
| Description: | Provides data sets and R Codes for E.R. Williams, C.E. Harwood and A.C. Matheson (2023). Experimental Design and Analysis for Tree Improvement, CSIRO Publishing. |
| Authors: | Muhammad Yaseen [aut, cre, cph] (ORCID: <https://orcid.org/0000-0002-5923-1714>), Sami Ullah [aut, ctb], Kent Eskridge [aut, ctb], Emlyn Williams [aut, ctb] |
| Maintainer: | Muhammad Yaseen <[email protected]> |
| License: | GPL-3 |
| Version: | 1.1.0 |
| Built: | 2026-05-31 07:27:18 UTC |
| Source: | https://github.com/myaseen208/eda4treer |
Exam2.1 is used to compare two seed lots by using single factor ANOVA.
data(DataExam2.1)data(DataExam2.1)
A data.frame with 16 rows and 2 variables.
seedlotTwo Seedlots Seed Orchad (SO) and routin plantation (P)
dbhDiameter at breast height
Muhammad Yaseen ([email protected])
Sami Ullah ([email protected])
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/).
data(DataExam2.1)data(DataExam2.1)
Exam2.2 is used to compare two seed lots by using ANOVA under RCB Design.
data(DataExam2.2)data(DataExam2.2)
A data.frame with 16 rows and 2 variables.
replrepl
blockblock
SeedlotTwo Seedlots Seed Orchad (SO) and routin plantation (P)
dbhDiameter at breast height
Muhammad Yaseen ([email protected])
Sami Ullah ([email protected])
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/).
data(DataExam2.2)data(DataExam2.2)
Exam3.1 is part of data from Australian Centre for Agricultural Research (ACIAR) in Queensland, Australia (Experiment 309).
data(DataExam3.1)data(DataExam3.1)
A data.frame with 80 rows and 6 variables.
replReplication number of different Seedlots
PlotNoPlot No of differnt Trees
seedlotSeed Lot number
TreeNoTree number of Seedlots
htHeight in meter
dglDiameter at ground level
Muhammad Yaseen ([email protected])
Sami Ullah ([email protected])
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/).
data(DataExam3.1)data(DataExam3.1)
Exam3.1.1 is part of data from Australian Centre for Agricultural Research (ACIAR) in Queensland, Australia (Experiment 309).
data(DataExam3.1.1)data(DataExam3.1.1)
A data.frame with 10 rows and 6 variables.
replReplication number of different Seedlots
PlotNoPlot No of differnt Trees
seedlotSeed Lot number
TreeNoTree number of Seedlots
htHeight in meter
VarVar
TreeCountTreeCount
Muhammad Yaseen ([email protected])
Sami Ullah ([email protected])
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/).
data(DataExam3.1.1)data(DataExam3.1.1)
Exam4.3 presents the germination count data for 4 Pre-Treatments and 6 Seedlots.
data(DataExam4.3)data(DataExam4.3)
A data.frame with 72 rows and 8 variables.
repReplication number of Treatment
rowRow number of different Seedlots
columnColumn number of differnt Trees
seedlotSeed lot number
treatTreatment types
countNumber of germinated seeds out of 25
percentGermination Percentage
contcompControl or Trated Plot
Muhammad Yaseen ([email protected])
Sami Ullah ([email protected])
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/).
data(DataExam4.3)data(DataExam4.3)
Exam4.3.1 presents the germination count data for 4 Pre-Treatments and 6 Seedlots.
data(DataExam4.3.1)data(DataExam4.3.1)
A data.frame with 72 rows and 8 variables.
RowRow number of different Seedlots
ColumnColumn number of differnt Trees
ReplicationReplication number of Treatment
ContcompControl or Trated Plot
PretreatmentTreatment types
SeedLotSeed lot number
GerminationCountNumber of germinated seeds out of 25
PercentGermination Percentage
Muhammad Yaseen ([email protected])
Sami Ullah ([email protected])
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/).
data(DataExam4.3.1)data(DataExam4.3.1)
Exam4.4 presents the height means for 4 seedlots under factorial arrangement for two levels of Fertilizer and two levels of Irrigation.
data(DataExam4.4)data(DataExam4.4)
A data.frame with 32 rows and 5 variables.
replReplication number
irrigIrrigation type
fertFertilizer type
seedlotSeed Lot number
heightHeight of the plants
Muhammad Yaseen ([email protected])
Sami Ullah ([email protected])
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/).
data(DataExam4.4)data(DataExam4.4)
Exam5.1 presents the height of 27 seedlots from 4 sites.
data(DataExam5.1)data(DataExam5.1)
A data.frame with 108 rows and 4 variables.
siteSites for the experiment
seedlotSeed lot number
htHeight of the plants
sitemeanMean Height of Each Site
Muhammad Yaseen ([email protected])
Sami Ullah ([email protected])
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/).
data(DataExam5.1)data(DataExam5.1)
Exam5.2 presents the height of 37 seedlots from 6 sites.
data(DataExam5.2)data(DataExam5.2)
A data.frame with 108 rows and 4 variables.
siteSites for the experiment
seedlotSeed lot number
htHeight of the plants
sitemeanMean Height of Each Site
Muhammad Yaseen ([email protected])
Sami Ullah ([email protected])
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/).
data(DataExam5.2)data(DataExam5.2)
Exam 6.2 Dbh mean, Dbh varince and number of trees per plot from 3 provinces("PNG","Sabah","Queensland") with 4 replicationsof 48 families.
data(DataExam6.2)data(DataExam6.2)
A data.frame with 192 rows and 7 variables.
ReplicationReplication number of different Families
Plot.numberPlot number of differnt Trees
FamilyFamily Numuber
ProvinceProvince of family
Dbh.meanAverage Diameter at breast height of trees within plot
Dbh.varianceVariance of Diameter at breast height of trees within plot
Dbh.countNumber of trees within plot
Muhammad Yaseen ([email protected])
Sami Ullah ([email protected])
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/).
data(DataExam6.2)data(DataExam6.2)
Exam8.1 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.
data(DataExam8.1)data(DataExam8.1)
A data.frame with 236 rows and 8 variables.
replThere are 4 replication for the design
rowExperiment is conducted under 6 rows
\
colExperiment is conducted under 4 columns
inocSeedling were inoculated for 2 different time periods half for one week and half for seven weeks
provprovenance
CountryData for different seedlots was collected from 18 countries
DbhDiameter at breast height
Country.1Recoded Country lables
Muhammad Yaseen ([email protected])
Sami Ullah ([email protected])
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/).
data(DataExam8.1)data(DataExam8.1)
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.
data(DataExam8.2)data(DataExam8.2)
A data.frame with 236 rows and 8 variables.
replThere are 4 replication for the design
rowExperiment is conducted under 6 rows
\
columnExperiment is conducted under 4 columns
clonenumClonenum
contcompfContcompf
standardStandard
cloneClone
dbhdbhmean
dbhvardbhvariance
hthtmean
htvarhtvariance
countcount
contcompvContcompv
Muhammad Yaseen ([email protected])
Sami Ullah ([email protected])
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/).
data(DataExam8.2)data(DataExam8.2)
Exam2.1 is used to compare two seed lots by using single factor ANOVA.
Muhammad Yaseen ([email protected])
Sami Ullah ([email protected])
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/).
library(car) library(dae) library(dplyr) library(emmeans) library(ggplot2) library(lmerTest) library(magrittr) library(predictmeans) data(DataExam2.1) # Pg. 22 fmtab2.3 <- lm(formula = dbh ~ seedlot, data = DataExam2.1) # Pg. 23 anova(fmtab2.3) # Pg. 23 emmeans(object = fmtab2.3, specs = ~ seedlot) emmip(object = fmtab2.3, formula = ~ seedlot) + theme_classic()library(car) library(dae) library(dplyr) library(emmeans) library(ggplot2) library(lmerTest) library(magrittr) library(predictmeans) data(DataExam2.1) # Pg. 22 fmtab2.3 <- lm(formula = dbh ~ seedlot, data = DataExam2.1) # Pg. 23 anova(fmtab2.3) # Pg. 23 emmeans(object = fmtab2.3, specs = ~ seedlot) emmip(object = fmtab2.3, formula = ~ seedlot) + theme_classic()
Exam2.2 is used to compare two seed lots by using ANOVA under RCB Design.
Muhammad Yaseen ([email protected])
Sami Ullah ([email protected])
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/).
library(car) library(dae) library(dplyr) library(emmeans) library(ggplot2) library(lmerTest) library(magrittr) library(predictmeans) data(DataExam2.2) # Pg. 24 fmtab2.5 <- lm( formula = dbh ~ block + seedlot , data = DataExam2.2 ) # Pg. 26 anova(fmtab2.5) # Pg. 26 emmeans(object = fmtab2.5, specs = ~ seedlot) emmip(object = fmtab2.5, formula = ~ seedlot) + theme_classic()library(car) library(dae) library(dplyr) library(emmeans) library(ggplot2) library(lmerTest) library(magrittr) library(predictmeans) data(DataExam2.2) # Pg. 24 fmtab2.5 <- lm( formula = dbh ~ block + seedlot , data = DataExam2.2 ) # Pg. 26 anova(fmtab2.5) # Pg. 26 emmeans(object = fmtab2.5, specs = ~ seedlot) emmip(object = fmtab2.5, formula = ~ seedlot) + theme_classic()
Exam3.1 is part of data from Australian Centre for Agricultural Research (ACIAR) in Queensland, Australia (Experiment 309).
Muhammad Yaseen ([email protected])
Sami Ullah ([email protected])
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/).
library(car) library(dae) library(dplyr) library(emmeans) library(ggplot2) library(lmerTest) library(magrittr) library(predictmeans) library(supernova) data(DataExam3.1) # Pg. 28 fmtab3.3 <- lm( formula = ht ~ repl*seedlot , data = DataExam3.1 ) fmtab3.3ANOVA1 <- anova(fmtab3.3) %>% mutate( "F value" = c( anova(fmtab3.3)[1:2, 3]/anova(fmtab3.3)[3, 3] , anova(fmtab3.3)[3, 4] , NA ) ) # Pg. 33 (Table 3.3) fmtab3.3ANOVA1 %>% mutate( "Pr(>F)" = c( NA , pf( q = fmtab3.3ANOVA1[2, 4] , df1 = fmtab3.3ANOVA1[2, 1] , df2 = fmtab3.3ANOVA1[3, 1], lower.tail = FALSE ) , NA , NA ) ) # Pg. 33 (Table 3.3) emmeans(object = fmtab3.3, specs = ~ seedlot) # Pg. 34 (Figure 3.2) ggplot( mapping = aes( x = fitted.values(fmtab3.3) , y = residuals(fmtab3.3) ) ) + geom_point(size = 2) + labs( x = "Fitted Values" , y = "Residual" ) + theme_classic() # Pg. 33 (Table 3.4) DataExam3.1m <- DataExam3.1 DataExam3.1m[c(28, 51, 76), 5] <- NA DataExam3.1m[c(28, 51, 76), 6] <- NA fmtab3.4 <- lm( formula = ht ~ repl*seedlot , data = DataExam3.1m ) fmtab3.4ANOVA1 <- anova(fmtab3.4) %>% mutate( "F value" = c( anova(fmtab3.4)[1:2, 3]/anova(fmtab3.4)[3, 3] , anova(fmtab3.4)[3, 4] , NA ) ) # Pg. 33 (Table 3.4) fmtab3.4ANOVA1 %>% mutate( "Pr(>F)" = c( NA , pf( q = fmtab3.4ANOVA1[2, 4] , df1 = fmtab3.4ANOVA1[2, 1] , df2 = fmtab3.4ANOVA1[3, 1], lower.tail = FALSE ) , NA , NA ) ) # Pg. 33 (Table 3.4) emmeans(object = fmtab3.4, specs = ~ seedlot)library(car) library(dae) library(dplyr) library(emmeans) library(ggplot2) library(lmerTest) library(magrittr) library(predictmeans) library(supernova) data(DataExam3.1) # Pg. 28 fmtab3.3 <- lm( formula = ht ~ repl*seedlot , data = DataExam3.1 ) fmtab3.3ANOVA1 <- anova(fmtab3.3) %>% mutate( "F value" = c( anova(fmtab3.3)[1:2, 3]/anova(fmtab3.3)[3, 3] , anova(fmtab3.3)[3, 4] , NA ) ) # Pg. 33 (Table 3.3) fmtab3.3ANOVA1 %>% mutate( "Pr(>F)" = c( NA , pf( q = fmtab3.3ANOVA1[2, 4] , df1 = fmtab3.3ANOVA1[2, 1] , df2 = fmtab3.3ANOVA1[3, 1], lower.tail = FALSE ) , NA , NA ) ) # Pg. 33 (Table 3.3) emmeans(object = fmtab3.3, specs = ~ seedlot) # Pg. 34 (Figure 3.2) ggplot( mapping = aes( x = fitted.values(fmtab3.3) , y = residuals(fmtab3.3) ) ) + geom_point(size = 2) + labs( x = "Fitted Values" , y = "Residual" ) + theme_classic() # Pg. 33 (Table 3.4) DataExam3.1m <- DataExam3.1 DataExam3.1m[c(28, 51, 76), 5] <- NA DataExam3.1m[c(28, 51, 76), 6] <- NA fmtab3.4 <- lm( formula = ht ~ repl*seedlot , data = DataExam3.1m ) fmtab3.4ANOVA1 <- anova(fmtab3.4) %>% mutate( "F value" = c( anova(fmtab3.4)[1:2, 3]/anova(fmtab3.4)[3, 3] , anova(fmtab3.4)[3, 4] , NA ) ) # Pg. 33 (Table 3.4) fmtab3.4ANOVA1 %>% mutate( "Pr(>F)" = c( NA , pf( q = fmtab3.4ANOVA1[2, 4] , df1 = fmtab3.4ANOVA1[2, 1] , df2 = fmtab3.4ANOVA1[3, 1], lower.tail = FALSE ) , NA , NA ) ) # Pg. 33 (Table 3.4) emmeans(object = fmtab3.4, specs = ~ seedlot)
Exam3.1.1 is part of data from Australian Centre for Agricultural Research (ACIAR) in Queensland, Australia (Experiment 309).
Muhammad Yaseen ([email protected])
Sami Ullah ([email protected])
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/).
library(car) library(dae) library(dplyr) library(emmeans) library(ggplot2) library(lmerTest) library(magrittr) library(predictmeans) data(DataExam3.1.1) # Pg. 36 fm3.8 <- lm( formula = ht ~ repl + seedlot , data = DataExam3.1.1 ) # Pg. 40 anova(fm3.8) # Pg. 40 emmeans(object = fm3.8, specs = ~seedlot) emmip(object = fm3.8, formula = ~seedlot) + theme_classic()library(car) library(dae) library(dplyr) library(emmeans) library(ggplot2) library(lmerTest) library(magrittr) library(predictmeans) data(DataExam3.1.1) # Pg. 36 fm3.8 <- lm( formula = ht ~ repl + seedlot , data = DataExam3.1.1 ) # Pg. 40 anova(fm3.8) # Pg. 40 emmeans(object = fm3.8, specs = ~seedlot) emmip(object = fm3.8, formula = ~seedlot) + theme_classic()
Exam4.3 presents the germination count data for 4 Pre-Treatments and 6 Seedlots.
Muhammad Yaseen ([email protected])
Sami Ullah ([email protected])
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/).
library(car) library(dae) library(dplyr) library(emmeans) library(ggplot2) library(lmerTest) library(magrittr) library(predictmeans) data(DataExam4.3) # Pg. 50 fm4.2 <- aov( formula = percent ~ repl + contcomp + seedlot + treat/contcomp + contcomp/seedlot + treat/contcomp/seedlot , data = DataExam4.3 ) # Pg. 54 anova(fm4.2) # Pg. 54 model.tables(x = fm4.2, type = "means") emmeans(object = fm4.2, specs = ~ contcomp) emmeans(object = fm4.2, specs = ~ seedlot) emmeans(object = fm4.2, specs = ~ contcomp + treat) emmeans(object = fm4.2, specs = ~ contcomp + seedlot) emmeans(object = fm4.2, specs = ~ contcomp + treat + seedlot) DataExam4.3 %>% dplyr::group_by(treat, contcomp, seedlot) %>% dplyr::summarize(Mean = mean(percent)) RESFIT <- data.frame( residualvalue = residuals(fm4.2) , fittedvalue = fitted.values(fm4.2) ) ggplot(mapping = aes( x = fitted.values(fm4.2) , y = residuals(fm4.2))) + geom_point(size = 2) + labs( x = "Fitted Values" , y = "Residuals" ) + theme_classic()library(car) library(dae) library(dplyr) library(emmeans) library(ggplot2) library(lmerTest) library(magrittr) library(predictmeans) data(DataExam4.3) # Pg. 50 fm4.2 <- aov( formula = percent ~ repl + contcomp + seedlot + treat/contcomp + contcomp/seedlot + treat/contcomp/seedlot , data = DataExam4.3 ) # Pg. 54 anova(fm4.2) # Pg. 54 model.tables(x = fm4.2, type = "means") emmeans(object = fm4.2, specs = ~ contcomp) emmeans(object = fm4.2, specs = ~ seedlot) emmeans(object = fm4.2, specs = ~ contcomp + treat) emmeans(object = fm4.2, specs = ~ contcomp + seedlot) emmeans(object = fm4.2, specs = ~ contcomp + treat + seedlot) DataExam4.3 %>% dplyr::group_by(treat, contcomp, seedlot) %>% dplyr::summarize(Mean = mean(percent)) RESFIT <- data.frame( residualvalue = residuals(fm4.2) , fittedvalue = fitted.values(fm4.2) ) ggplot(mapping = aes( x = fitted.values(fm4.2) , y = residuals(fm4.2))) + geom_point(size = 2) + labs( x = "Fitted Values" , y = "Residuals" ) + theme_classic()
Exam4.3.1 presents the germination count data for 4 Pre-Treatments and 6 Seedlots.
Muhammad Yaseen ([email protected])
Sami Ullah ([email protected])
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/).
library(car) library(dae) library(dplyr) library(emmeans) library(ggplot2) library(lmerTest) library(magrittr) library(predictmeans) data(DataExam4.3) # Pg. 57 fm4.4 <- aov( formula = percent ~ repl + treat*seedlot , data = DataExam4.3 %>% filter(treat != "control") ) # Pg. 57 anova(fm4.4) model.tables(x = fm4.4, type = "means", se = TRUE) emmeans(object = fm4.4, specs = ~ treat) emmeans(object = fm4.4, specs = ~ seedlot) emmeans(object = fm4.4, specs = ~ treat * seedlot)library(car) library(dae) library(dplyr) library(emmeans) library(ggplot2) library(lmerTest) library(magrittr) library(predictmeans) data(DataExam4.3) # Pg. 57 fm4.4 <- aov( formula = percent ~ repl + treat*seedlot , data = DataExam4.3 %>% filter(treat != "control") ) # Pg. 57 anova(fm4.4) model.tables(x = fm4.4, type = "means", se = TRUE) emmeans(object = fm4.4, specs = ~ treat) emmeans(object = fm4.4, specs = ~ seedlot) emmeans(object = fm4.4, specs = ~ treat * seedlot)
Exam4.4 presents the height means for 4 seedlots under factorial arrangement for two levels of Fertilizer and two levels of Irrigation.
Muhammad Yaseen ([email protected])
Sami Ullah ([email protected])
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/).
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 ) # Pg. 61 summary(fm4.6) # Pg. 61 model.tables(x = fm4.6, type = "means") # Pg. 61 emmeans(object = fm4.6, specs = ~ irrig) emmip(object = fm4.6, formula = ~ irrig) + theme_classic()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 ) # Pg. 61 summary(fm4.6) # Pg. 61 model.tables(x = fm4.6, type = "means") # Pg. 61 emmeans(object = fm4.6, specs = ~ irrig) emmip(object = fm4.6, formula = ~ irrig) + theme_classic()
Exam5.1 presents the height of 27 seedlots from 4 sites.
Muhammad Yaseen ([email protected])
Sami Ullah ([email protected])
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/).
library(car) library(dae) library(dplyr) library(emmeans) library(ggplot2) library(lmerTest) library(magrittr) library(predictmeans) data(DataExam5.1) # Pg.68 fm5.4 <- lm( formula = ht ~ site*seedlot , data = DataExam5.1 ) # Pg. 73 anova(fm5.4) # Pg. 73 emmeans(object = fm5.4, specs = ~ site) emmeans(object = fm5.4, specs = ~ seedlot) ANOVAfm5.4 <- anova(fm5.4) ANOVAfm5.4[4, 1:3] <- c(208, 208*1040, 1040) ANOVAfm5.4[3, 4] <- ANOVAfm5.4[3, 3]/ANOVAfm5.4[4, 3] ANOVAfm5.4[3, 5] <- pf( q = ANOVAfm5.4[3, 4] , df1 = ANOVAfm5.4[3, 1] , df2 = ANOVAfm5.4[4, 1] , lower.tail = FALSE ) # Pg. 73 ANOVAfm5.4 # Pg. 80 DataExam5.1 %>% filter(seedlot %in% c("13653", "13871")) %>% ggplot( data = . , mapping = aes( x = sitemean , y = ht , color = seedlot , shape = seedlot ) ) + geom_point() + geom_smooth( method = lm , se = FALSE , fullrange = TRUE ) + theme_classic() + labs( x = "SiteMean" , y = "SeedLot Mean" ) Tab5.10 <- DataExam5.1 %>% summarise(Mean = mean(ht), .by = seedlot) %>% left_join( DataExam5.1 %>% nest_by(seedlot) %>% mutate(fm1 = list(lm(ht ~ sitemean, data = data))) %>% summarise(Slope = coef(fm1)[2]) , by = "seedlot" ) # Pg. 81 Tab5.10 ggplot(data = Tab5.10, mapping = aes(x = Mean, y = Slope)) + geom_point(size = 2) + theme_bw() + labs( x = "SeedLot Mean" , y = "Regression Coefficient" ) DevSS1 <- DataExam5.1 %>% nest_by(seedlot) %>% mutate(fm1 = list(lm(ht ~ sitemean, data = data))) %>% summarise(SSE = anova(fm1)[2, 2]) %>% ungroup() %>% summarise(Dev = sum(SSE)) %>% as.numeric() ANOVAfm5.4[2, 2] length(levels(DataExam5.1$SeedLot)) ANOVAfm5.4.1 <- rbind( ANOVAfm5.4[1:3, ] , c( ANOVAfm5.4[2, 1] , ANOVAfm5.4[3, 2] - DevSS1 , (ANOVAfm5.4[3, 2] - DevSS1)/ANOVAfm5.4[2, 1] , NA , NA ) , c( ANOVAfm5.4[3, 1]-ANOVAfm5.4[2, 1] , DevSS1 , DevSS1/(ANOVAfm5.4[3, 1]-ANOVAfm5.4[2, 1]) , DevSS1/(ANOVAfm5.4[3, 1]-ANOVAfm5.4[2, 1])/ANOVAfm5.4[4, 3] , pf( q = DevSS1/(ANOVAfm5.4[3, 1]-ANOVAfm5.4[2, 1])/ANOVAfm5.4[4, 3] , df1 = ANOVAfm5.4[3, 1]-ANOVAfm5.4[2, 1] , df2 = ANOVAfm5.4[4, 1] , lower.tail = FALSE ) ) , ANOVAfm5.4[4, ] ) rownames(ANOVAfm5.4.1) <- c( "Site" , "seedlot" , "site:seedlot" , " regressions" , " deviations" , "Residuals" ) # Pg. 82 ANOVAfm5.4.1library(car) library(dae) library(dplyr) library(emmeans) library(ggplot2) library(lmerTest) library(magrittr) library(predictmeans) data(DataExam5.1) # Pg.68 fm5.4 <- lm( formula = ht ~ site*seedlot , data = DataExam5.1 ) # Pg. 73 anova(fm5.4) # Pg. 73 emmeans(object = fm5.4, specs = ~ site) emmeans(object = fm5.4, specs = ~ seedlot) ANOVAfm5.4 <- anova(fm5.4) ANOVAfm5.4[4, 1:3] <- c(208, 208*1040, 1040) ANOVAfm5.4[3, 4] <- ANOVAfm5.4[3, 3]/ANOVAfm5.4[4, 3] ANOVAfm5.4[3, 5] <- pf( q = ANOVAfm5.4[3, 4] , df1 = ANOVAfm5.4[3, 1] , df2 = ANOVAfm5.4[4, 1] , lower.tail = FALSE ) # Pg. 73 ANOVAfm5.4 # Pg. 80 DataExam5.1 %>% filter(seedlot %in% c("13653", "13871")) %>% ggplot( data = . , mapping = aes( x = sitemean , y = ht , color = seedlot , shape = seedlot ) ) + geom_point() + geom_smooth( method = lm , se = FALSE , fullrange = TRUE ) + theme_classic() + labs( x = "SiteMean" , y = "SeedLot Mean" ) Tab5.10 <- DataExam5.1 %>% summarise(Mean = mean(ht), .by = seedlot) %>% left_join( DataExam5.1 %>% nest_by(seedlot) %>% mutate(fm1 = list(lm(ht ~ sitemean, data = data))) %>% summarise(Slope = coef(fm1)[2]) , by = "seedlot" ) # Pg. 81 Tab5.10 ggplot(data = Tab5.10, mapping = aes(x = Mean, y = Slope)) + geom_point(size = 2) + theme_bw() + labs( x = "SeedLot Mean" , y = "Regression Coefficient" ) DevSS1 <- DataExam5.1 %>% nest_by(seedlot) %>% mutate(fm1 = list(lm(ht ~ sitemean, data = data))) %>% summarise(SSE = anova(fm1)[2, 2]) %>% ungroup() %>% summarise(Dev = sum(SSE)) %>% as.numeric() ANOVAfm5.4[2, 2] length(levels(DataExam5.1$SeedLot)) ANOVAfm5.4.1 <- rbind( ANOVAfm5.4[1:3, ] , c( ANOVAfm5.4[2, 1] , ANOVAfm5.4[3, 2] - DevSS1 , (ANOVAfm5.4[3, 2] - DevSS1)/ANOVAfm5.4[2, 1] , NA , NA ) , c( ANOVAfm5.4[3, 1]-ANOVAfm5.4[2, 1] , DevSS1 , DevSS1/(ANOVAfm5.4[3, 1]-ANOVAfm5.4[2, 1]) , DevSS1/(ANOVAfm5.4[3, 1]-ANOVAfm5.4[2, 1])/ANOVAfm5.4[4, 3] , pf( q = DevSS1/(ANOVAfm5.4[3, 1]-ANOVAfm5.4[2, 1])/ANOVAfm5.4[4, 3] , df1 = ANOVAfm5.4[3, 1]-ANOVAfm5.4[2, 1] , df2 = ANOVAfm5.4[4, 1] , lower.tail = FALSE ) ) , ANOVAfm5.4[4, ] ) rownames(ANOVAfm5.4.1) <- c( "Site" , "seedlot" , "site:seedlot" , " regressions" , " deviations" , "Residuals" ) # Pg. 82 ANOVAfm5.4.1
Exam5.2 presents the height of 37 seedlots from 6 sites.
Muhammad Yaseen ([email protected])
Sami Ullah ([email protected])
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/).
library(car) library(dae) library(dplyr) library(emmeans) library(ggplot2) library(lmerTest) library(magrittr) library(predictmeans) data(DataExam5.2) # Pg. 75 fm5.7 <- lm( formula = ht ~ site*seedlot , data = DataExam5.2 ) # Pg. 77 anova(fm5.7) fm5.9 <- lm( formula = ht ~ site*seedlot , data = DataExam5.2 ) # Pg. 77 anova(fm5.9) ANOVAfm5.9 <- anova(fm5.9) ANOVAfm5.9[4, 1:3] <- c(384, 384*964, 964) ANOVAfm5.9[3, 4] <- ANOVAfm5.9[3, 3]/ANOVAfm5.9[4, 3] ANOVAfm5.9[3, 5] <- pf( q = ANOVAfm5.9[3, 4] , df1 = ANOVAfm5.9[3, 1] , df2 = ANOVAfm5.9[4, 1] , lower.tail = FALSE ) # Pg. 77 ANOVAfm5.9 Tab5.14 <- DataExam5.2 %>% summarise( Mean = round(mean(ht, na.rm = TRUE), 0) , .by = seedlot ) %>% left_join( DataExam5.2 %>% nest_by(seedlot) %>% mutate(fm2 = list(lm(ht ~ sitemean, data = data))) %>% summarise(Slope = round(coef(fm2)[2], 2)) , by = "seedlot" ) %>% as.data.frame() # Pg. 81 Tab5.14 DevSS2 <- DataExam5.2 %>% nest_by(seedlot) %>% mutate(fm2 = list(lm(ht ~ sitemean, data = data))) %>% summarise(SSE = anova(fm2)[2, 2]) %>% ungroup() %>% summarise(Dev = sum(SSE)) %>% as.numeric() ANOVAfm5.9.1 <- rbind( ANOVAfm5.9[1:3, ] , c( ANOVAfm5.9[2, 1] , ANOVAfm5.9[3, 2] - DevSS2 , (ANOVAfm5.9[3, 2] - DevSS2)/ANOVAfm5.9[2, 1] , NA , NA ) , c( ANOVAfm5.9[3, 1]-ANOVAfm5.9[2, 1] , DevSS2 , DevSS2/(ANOVAfm5.9[3, 1]-ANOVAfm5.9[2, 1]) , DevSS2/(ANOVAfm5.9[3, 1]-ANOVAfm5.9[2, 1])/ANOVAfm5.9[4, 3] , pf( q = DevSS2/(ANOVAfm5.9[3, 1]-ANOVAfm5.9[2, 1])/ANOVAfm5.9[4, 3] , df1 = ANOVAfm5.9[3, 1]-ANOVAfm5.9[2, 1] , df2 = ANOVAfm5.9[4, 1] , lower.tail = FALSE ) ) , ANOVAfm5.9[4, ] ) rownames(ANOVAfm5.9.1) <- c( "site" , "seedlot" , "site:seedlot" , " regressions" , " deviations" , "Residuals" ) # Pg. 82 ANOVAfm5.9.1 Code <- c( "a","a","a","a","b","b","b","b" , "c","d","d","d","d","e","f","g" , "h","h","i","i","j","k","l","m" ,"n","n","n","o","p","p","q","r" , "s","t","t","u","v" ) Tab5.14$Code <- Code ggplot( data = Tab5.14 , mapping = aes(x = Mean, y = Slope) ) + geom_point(size = 2) + geom_text( mapping = aes(label = Code) , hjust = -0.5 , vjust = -0.5 ) + theme_bw() + labs( x = "SeedLot Mean" , y = "Regression Coefficient" )library(car) library(dae) library(dplyr) library(emmeans) library(ggplot2) library(lmerTest) library(magrittr) library(predictmeans) data(DataExam5.2) # Pg. 75 fm5.7 <- lm( formula = ht ~ site*seedlot , data = DataExam5.2 ) # Pg. 77 anova(fm5.7) fm5.9 <- lm( formula = ht ~ site*seedlot , data = DataExam5.2 ) # Pg. 77 anova(fm5.9) ANOVAfm5.9 <- anova(fm5.9) ANOVAfm5.9[4, 1:3] <- c(384, 384*964, 964) ANOVAfm5.9[3, 4] <- ANOVAfm5.9[3, 3]/ANOVAfm5.9[4, 3] ANOVAfm5.9[3, 5] <- pf( q = ANOVAfm5.9[3, 4] , df1 = ANOVAfm5.9[3, 1] , df2 = ANOVAfm5.9[4, 1] , lower.tail = FALSE ) # Pg. 77 ANOVAfm5.9 Tab5.14 <- DataExam5.2 %>% summarise( Mean = round(mean(ht, na.rm = TRUE), 0) , .by = seedlot ) %>% left_join( DataExam5.2 %>% nest_by(seedlot) %>% mutate(fm2 = list(lm(ht ~ sitemean, data = data))) %>% summarise(Slope = round(coef(fm2)[2], 2)) , by = "seedlot" ) %>% as.data.frame() # Pg. 81 Tab5.14 DevSS2 <- DataExam5.2 %>% nest_by(seedlot) %>% mutate(fm2 = list(lm(ht ~ sitemean, data = data))) %>% summarise(SSE = anova(fm2)[2, 2]) %>% ungroup() %>% summarise(Dev = sum(SSE)) %>% as.numeric() ANOVAfm5.9.1 <- rbind( ANOVAfm5.9[1:3, ] , c( ANOVAfm5.9[2, 1] , ANOVAfm5.9[3, 2] - DevSS2 , (ANOVAfm5.9[3, 2] - DevSS2)/ANOVAfm5.9[2, 1] , NA , NA ) , c( ANOVAfm5.9[3, 1]-ANOVAfm5.9[2, 1] , DevSS2 , DevSS2/(ANOVAfm5.9[3, 1]-ANOVAfm5.9[2, 1]) , DevSS2/(ANOVAfm5.9[3, 1]-ANOVAfm5.9[2, 1])/ANOVAfm5.9[4, 3] , pf( q = DevSS2/(ANOVAfm5.9[3, 1]-ANOVAfm5.9[2, 1])/ANOVAfm5.9[4, 3] , df1 = ANOVAfm5.9[3, 1]-ANOVAfm5.9[2, 1] , df2 = ANOVAfm5.9[4, 1] , lower.tail = FALSE ) ) , ANOVAfm5.9[4, ] ) rownames(ANOVAfm5.9.1) <- c( "site" , "seedlot" , "site:seedlot" , " regressions" , " deviations" , "Residuals" ) # Pg. 82 ANOVAfm5.9.1 Code <- c( "a","a","a","a","b","b","b","b" , "c","d","d","d","d","e","f","g" , "h","h","i","i","j","k","l","m" ,"n","n","n","o","p","p","q","r" , "s","t","t","u","v" ) Tab5.14$Code <- Code ggplot( data = Tab5.14 , mapping = aes(x = Mean, y = Slope) ) + geom_point(size = 2) + geom_text( mapping = aes(label = Code) , hjust = -0.5 , vjust = -0.5 ) + theme_bw() + labs( x = "SeedLot Mean" , y = "Regression Coefficient" )
Exam 6.2 Dbh mean, Dbh varince and number of trees per plot from 3 provinces("PNG","Sabah","Queensland") with 4 replications of 48 families.
Muhammad Yaseen ([email protected])
Sami Ullah ([email protected])
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/).
library(car) library(dae) library(dplyr) library(emmeans) library(ggplot2) library(lmerTest) library(magrittr) library(predictmeans) data(DataExam6.2) DataExam6.2.1 <- DataExam6.2 %>% filter(Province == "PNG") # Pg. 94 fm6.3 <- lm( formula = Dbh.mean ~ Replication + Family , data = DataExam6.2.1 ) b <- anova(fm6.3) HM <- function(x){length(x)/sum(1/x)} w <- HM(DataExam6.2.1$Dbh.count) S2 <- b[["Mean Sq"]][length(b[["Mean Sq"]])] Sigma2t <- mean(DataExam6.2.1$Dbh.variance) sigma2m <- S2-(Sigma2t/w) fm6.3.1 <- lmer( formula = Dbh.mean ~ 1 + Replication + (1|Family) , data = DataExam6.2.1 , REML = TRUE ) # Pg. 104 # summary(fm6.3.1) varcomp(fm6.3.1) sigma2f <- 0.2584 h2 <- (sigma2f/(0.3))/(Sigma2t + sigma2m + sigma2f) cbind(hmean = w, Sigma2t, sigma2m, sigma2f, h2) fm6.4 <- lm( formula = Dbh.mean ~ Replication+Family , data = DataExam6.2 ) b <- anova(fm6.4) HM <- function(x){length(x)/sum(1/x)} w <- HM(DataExam6.2$Dbh.count) S2 <- b[["Mean Sq"]][length(b[["Mean Sq"]])] Sigma2t <- mean(DataExam6.2$Dbh.variance) sigma2m <- S2-(Sigma2t/w) fm6.4.1 <- lmer( formula = Dbh.mean ~ 1 + Replication + Province + (1|Family) , data = DataExam6.2 , REML = TRUE ) # Pg. 107 varcomp(fm6.4.1) sigma2f <- 0.3514 h2 <- (sigma2f/(0.3))/(Sigma2t+sigma2m+sigma2f) cbind(hmean = w, Sigma2t, sigma2m, sigma2f, h2) fm6.7.1 <- lmer( formula = Dbh.mean ~ 1+Replication+(1|Family) , data = DataExam6.2.1 , REML = TRUE ) # Pg. 116 varcomp(fm6.7.1) sigma2f[1] <- 0.2584 fm6.7.2<- lmer( formula = Ht.mean ~ 1 + Replication + (1|Family) , data = DataExam6.2.1 , REML = TRUE ) # Pg. 116 varcomp(fm6.7.2) sigma2f[2] <- 0.2711 fm6.7.3 <- lmer( formula = Sum.means ~ 1 + Replication + (1|Family) , data = DataExam6.2.1 , REML = TRUE , control = lmerControl() ) # Pg. 116 varcomp(fm6.7.3) sigma2f[3] <- 0.873 sigma2xy <- 0.5*(sigma2f[3]-sigma2f[1]-sigma2f[2]) GenCorr <- sigma2xy/sqrt(sigma2f[1]*sigma2f[2]) cbind( S2x = sigma2f[1] , S2y = sigma2f[2] , S2.x.plus.y = sigma2f[3] , GenCorr )library(car) library(dae) library(dplyr) library(emmeans) library(ggplot2) library(lmerTest) library(magrittr) library(predictmeans) data(DataExam6.2) DataExam6.2.1 <- DataExam6.2 %>% filter(Province == "PNG") # Pg. 94 fm6.3 <- lm( formula = Dbh.mean ~ Replication + Family , data = DataExam6.2.1 ) b <- anova(fm6.3) HM <- function(x){length(x)/sum(1/x)} w <- HM(DataExam6.2.1$Dbh.count) S2 <- b[["Mean Sq"]][length(b[["Mean Sq"]])] Sigma2t <- mean(DataExam6.2.1$Dbh.variance) sigma2m <- S2-(Sigma2t/w) fm6.3.1 <- lmer( formula = Dbh.mean ~ 1 + Replication + (1|Family) , data = DataExam6.2.1 , REML = TRUE ) # Pg. 104 # summary(fm6.3.1) varcomp(fm6.3.1) sigma2f <- 0.2584 h2 <- (sigma2f/(0.3))/(Sigma2t + sigma2m + sigma2f) cbind(hmean = w, Sigma2t, sigma2m, sigma2f, h2) fm6.4 <- lm( formula = Dbh.mean ~ Replication+Family , data = DataExam6.2 ) b <- anova(fm6.4) HM <- function(x){length(x)/sum(1/x)} w <- HM(DataExam6.2$Dbh.count) S2 <- b[["Mean Sq"]][length(b[["Mean Sq"]])] Sigma2t <- mean(DataExam6.2$Dbh.variance) sigma2m <- S2-(Sigma2t/w) fm6.4.1 <- lmer( formula = Dbh.mean ~ 1 + Replication + Province + (1|Family) , data = DataExam6.2 , REML = TRUE ) # Pg. 107 varcomp(fm6.4.1) sigma2f <- 0.3514 h2 <- (sigma2f/(0.3))/(Sigma2t+sigma2m+sigma2f) cbind(hmean = w, Sigma2t, sigma2m, sigma2f, h2) fm6.7.1 <- lmer( formula = Dbh.mean ~ 1+Replication+(1|Family) , data = DataExam6.2.1 , REML = TRUE ) # Pg. 116 varcomp(fm6.7.1) sigma2f[1] <- 0.2584 fm6.7.2<- lmer( formula = Ht.mean ~ 1 + Replication + (1|Family) , data = DataExam6.2.1 , REML = TRUE ) # Pg. 116 varcomp(fm6.7.2) sigma2f[2] <- 0.2711 fm6.7.3 <- lmer( formula = Sum.means ~ 1 + Replication + (1|Family) , data = DataExam6.2.1 , REML = TRUE , control = lmerControl() ) # Pg. 116 varcomp(fm6.7.3) sigma2f[3] <- 0.873 sigma2xy <- 0.5*(sigma2f[3]-sigma2f[1]-sigma2f[2]) GenCorr <- sigma2xy/sqrt(sigma2f[1]*sigma2f[2]) cbind( S2x = sigma2f[1] , S2y = sigma2f[2] , S2.x.plus.y = sigma2f[3] , GenCorr )
Exam8.1 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.
Muhammad Yaseen ([email protected])
Sami Ullah ([email protected])
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/).
library(car) library(dae) library(dplyr) library(emmeans) library(ggplot2) library(lmerTest) library(magrittr) library(predictmeans) data(DataExam8.1) # Pg. 141 fm8.4 <- aov( formula = dbh ~ inoc + Error(repl/inoc) + inoc*country*prov , data = DataExam8.1 ) # Pg. 150 summary(fm8.4) # Pg. 150 model.tables(x = fm8.4, type = "means") RESFit <- data.frame( fittedvalue = fitted.aovlist(fm8.4) , residualvalue = proj(fm8.4)$Within[,"Residuals"] ) ggplot( data = RESFit , mapping = aes(x = fittedvalue, y = residualvalue) ) + geom_point(size = 2) + labs( x = "Residuals vs Fitted Values" , y = "" ) + theme_bw() # Pg. 153 fm8.6 <- aov( formula = terms( dbh ~ inoc + repl + col + repl:row + repl:col + prov + inoc:prov , keep.order = TRUE ) , data = DataExam8.1 ) summary(fm8.6)library(car) library(dae) library(dplyr) library(emmeans) library(ggplot2) library(lmerTest) library(magrittr) library(predictmeans) data(DataExam8.1) # Pg. 141 fm8.4 <- aov( formula = dbh ~ inoc + Error(repl/inoc) + inoc*country*prov , data = DataExam8.1 ) # Pg. 150 summary(fm8.4) # Pg. 150 model.tables(x = fm8.4, type = "means") RESFit <- data.frame( fittedvalue = fitted.aovlist(fm8.4) , residualvalue = proj(fm8.4)$Within[,"Residuals"] ) ggplot( data = RESFit , mapping = aes(x = fittedvalue, y = residualvalue) ) + geom_point(size = 2) + labs( x = "Residuals vs Fitted Values" , y = "" ) + theme_bw() # Pg. 153 fm8.6 <- aov( formula = terms( dbh ~ inoc + repl + col + repl:row + repl:col + prov + inoc:prov , keep.order = TRUE ) , data = DataExam8.1 ) summary(fm8.6)
Exam8.1.1 presents the Mixed Effects Analysis of 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 given in Example 8.1.
Muhammad Yaseen ([email protected])
Sami Ullah ([email protected])
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/).
library(car) library(dae) library(dplyr) library(emmeans) library(ggplot2) library(lmerTest) library(magrittr) library(predictmeans) data(DataExam8.1) # Pg. 155 fm8.8 <- lmerTest::lmer( formula = dbh ~ 1 + repl + col + prov + (1|repl:row) + (1|repl:col) , data = DataExam8.1 , REML = TRUE ) # Pg. 157 ## Not run: varcomp(fm8.8) ## End(Not run) anova(fm8.8) anova(fm8.8, ddf = "Kenward-Roger") predictmeans(model = fm8.8, modelterm = "repl") predictmeans(model = fm8.8, modelterm = "col") predictmeans(model = fm8.8, modelterm = "prov") # Pg. 161 RCB1 <- aov(dbh ~ prov + repl, data = DataExam8.1) RCB <- emmeans(RCB1, specs = "prov") %>% as_tibble() Mixed <- emmeans(fm8.8, specs = "prov") %>% as_tibble() table8.9 <- left_join( x = RCB , y = Mixed , by = "prov" , suffix = c(".RCBD", ".Mixed") ) print(table8.9)library(car) library(dae) library(dplyr) library(emmeans) library(ggplot2) library(lmerTest) library(magrittr) library(predictmeans) data(DataExam8.1) # Pg. 155 fm8.8 <- lmerTest::lmer( formula = dbh ~ 1 + repl + col + prov + (1|repl:row) + (1|repl:col) , data = DataExam8.1 , REML = TRUE ) # Pg. 157 ## Not run: varcomp(fm8.8) ## End(Not run) anova(fm8.8) anova(fm8.8, ddf = "Kenward-Roger") predictmeans(model = fm8.8, modelterm = "repl") predictmeans(model = fm8.8, modelterm = "col") predictmeans(model = fm8.8, modelterm = "prov") # Pg. 161 RCB1 <- aov(dbh ~ prov + repl, data = DataExam8.1) RCB <- emmeans(RCB1, specs = "prov") %>% as_tibble() Mixed <- emmeans(fm8.8, specs = "prov") %>% as_tibble() table8.9 <- left_join( x = RCB , y = Mixed , by = "prov" , suffix = c(".RCBD", ".Mixed") ) print(table8.9)
Exam8.1.2 presents the Analysis of Nested Seedlot Structure of 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 given in Example 8.1.
Muhammad Yaseen ([email protected])
Sami Ullah ([email protected])
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/).
library(car) library(dae) library(dplyr) library(emmeans) library(ggplot2) library(lmerTest) library(magrittr) library(predictmeans) data(DataExam8.1) # Pg. 167 fm8.11 <- aov( formula = dbh ~ country + country:prov , data = DataExam8.1 ) b <- anova(fm8.11) Res <- length(b[["Sum Sq"]]) df <- 119 MSS <- 0.1951 b[["Df"]][Res] <- df b[["Sum Sq"]][Res] <- MSS*df b[["Mean Sq"]][Res] <- b[["Sum Sq"]][Res]/b[["Df"]][Res] b[["F value"]][1:Res-1] <- b[["Mean Sq"]][1:Res-1]/b[["Mean Sq"]][Res] b[["Pr(>F)"]][Res-1] <- df( b[["F value"]][Res-1] , b[["Df"]][Res-1] , b[["Df"]][Res] ) b emmeans(fm8.11, specs = "country")library(car) library(dae) library(dplyr) library(emmeans) library(ggplot2) library(lmerTest) library(magrittr) library(predictmeans) data(DataExam8.1) # Pg. 167 fm8.11 <- aov( formula = dbh ~ country + country:prov , data = DataExam8.1 ) b <- anova(fm8.11) Res <- length(b[["Sum Sq"]]) df <- 119 MSS <- 0.1951 b[["Df"]][Res] <- df b[["Sum Sq"]][Res] <- MSS*df b[["Mean Sq"]][Res] <- b[["Sum Sq"]][Res]/b[["Df"]][Res] b[["F value"]][1:Res-1] <- b[["Mean Sq"]][1:Res-1]/b[["Mean Sq"]][Res] b[["Pr(>F)"]][Res-1] <- df( b[["F value"]][Res-1] , b[["Df"]][Res-1] , b[["Df"]][Res] ) b emmeans(fm8.11, specs = "country")
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.
Muhammad Yaseen ([email protected])
Sami Ullah ([email protected])
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/).
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 ) ## Not run: varcomp(fm8.2) ## End(Not run) anova(fm8.2) Anova(fm8.2, type = "II", test.statistic = "Chisq") predictmeans(model = fm8.2, modelterm = "repl") predictmeans(model = fm8.2, modelterm = "column") emmeans(object = fm8.2, specs = ~contcompf|standard)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 ) ## Not run: varcomp(fm8.2) ## End(Not run) anova(fm8.2) Anova(fm8.2, type = "II", test.statistic = "Chisq") predictmeans(model = fm8.2, modelterm = "repl") predictmeans(model = fm8.2, modelterm = "column") emmeans(object = fm8.2, specs = ~contcompf|standard)