
Split-Plot Design with Factorial Main and Sub-Plots
Source:R/design_split_plot.R
anova_spd_ab_cd.RdSplit-plot design where the main plots carry A x B and the sub-plots carry C x D. Main-plot sources are tested against Error(a), all other sources against Error(b).
Usage
anova_spd_ab_cd(
data,
response,
main_factor1,
main_factor2,
sub_factor1,
sub_factor2,
replication,
verbose = TRUE,
posthoc = "lsd",
alpha = 0.05
)Arguments
- data
Data frame containing the experimental data.
- response
Name of the response variable.
- main_factor1
First main-plot factor (A).
- main_factor2
Second main-plot factor (B).
- sub_factor1
First sub-plot factor (C).
- sub_factor2
Second sub-plot factor (D).
- replication
Name of the replication column.
- verbose
Logical. If TRUE (default), prints the report.
- posthoc
Method for the letters (default
"lsd").- alpha
Significance level. Default 0.05.
Value
An object of class aridagri_spd_abcd; see
anova_spd_ab_main for the components.
Examples
data <- expand.grid(rep = 1:3, irrigation = c("I1", "I2"),
tillage = c("CT", "ZT"), variety = c("V1", "V2"),
nitrogen = c("N1", "N2", "N3"))
set.seed(5)
data$yield <- rnorm(nrow(data), 1200, 80)
res <- anova_spd_ab_cd(data, response = "yield",
main_factor1 = "irrigation", main_factor2 = "tillage",
sub_factor1 = "variety", sub_factor2 = "nitrogen",
replication = "rep", verbose = FALSE)
res$anova_table
#> Df Sum Sq Mean Sq F value
#> rep 2 16420.93277 8210.46639 1.105353590
#> irrigation 1 9360.69652 9360.69652 1.260206061
#> tillage 1 16439.93329 16439.93329 2.213265171
#> irrigation:tillage 1 18.10413 18.10413 0.002437311
#> Error(a) 6 44567.45674 7427.90946 NA
#> variety 1 37683.26118 37683.26118 8.467106842
#> nitrogen 2 15213.08351 7606.54176 1.709124946
#> irrigation:variety 1 3079.15161 3079.15161 0.691859060
#> tillage:variety 1 6436.68371 6436.68371 1.446267838
#> irrigation:nitrogen 2 2347.06776 1173.53388 0.263683037
#> tillage:nitrogen 2 32802.85473 16401.42737 3.685260604
#> variety:nitrogen 2 19012.37030 9506.18515 2.135958588
#> irrigation:tillage:variety 1 1713.42726 1713.42726 0.384992466
#> irrigation:tillage:nitrogen 2 13070.13055 6535.06527 1.468373335
#> irrigation:variety:nitrogen 2 7678.82966 3839.41483 0.862683710
#> tillage:variety:nitrogen 2 23726.93224 11863.46612 2.665619482
#> irrigation:tillage:variety:nitrogen 2 25790.47466 12895.23733 2.897449659
#> Error(b) 40 178021.89995 4450.54750 NA
#> Pr(>F)
#> rep 0.390222277
#> irrigation 0.304515100
#> tillage 0.187392487
#> irrigation:tillage 0.962227530
#> Error(a) NA
#> variety 0.005881108
#> nitrogen 0.193978479
#> irrigation:variety 0.410471026
#> tillage:variety 0.236198364
#> irrigation:nitrogen 0.769541846
#> tillage:nitrogen 0.033965387
#> variety:nitrogen 0.131411460
#> irrigation:tillage:variety 0.538462784
#> irrigation:tillage:nitrogen 0.242447177
#> irrigation:variety:nitrogen 0.429730753
#> tillage:variety:nitrogen 0.081893238
#> irrigation:tillage:variety:nitrogen 0.066812490
#> Error(b) NA