Analysis of variance for a three-factor factorial experiment in a
randomized complete block design (when replication is given) or
a completely randomized design, with SEm, SEd and CD for every main
effect and interaction and letter groupings for main-effect means and
treatment combinations.
Usage
anova_factorial_3way(
data,
response,
factor1,
factor2,
factor3,
replication = NULL,
alpha = 0.05,
verbose = TRUE,
posthoc = "lsd"
)Arguments
- data
Data frame containing the data.
- response
Name of the response variable.
- factor1
Name of the first factor (A).
- factor2
Name of the second factor (B).
- factor3
Name of the third factor (C).
- replication
Name of the replication (block) column, or
NULLfor a completely randomized layout.- alpha
Significance level for CD and letters. Default 0.05.
- verbose
Logical. If TRUE (default), prints the report.
- posthoc
Post-hoc method for the letters (see
perform_posthoc). Default"lsd".
Value
An object of class aridagri_factorial3 with
anova_table, model, grand_mean, cv,
ms_error, df_error, comparisons (SEm, SEd and CD
for all seven effects), means (a list of tables for A, B, C,
A x B, A x C, B x C and A x B x C, with letters) and posthoc.
Examples
data <- expand.grid(rep = 1:3, A = c("A1", "A2"), B = c("B1", "B2"),
C = c("C1", "C2", "C3"))
set.seed(2)
data$yield <- rnorm(nrow(data), 1200, 60)
res <- anova_factorial_3way(data, "yield", "A", "B", "C", "rep")
#>
#> ======================================================================
#> THREE-FACTOR FACTORIAL (RCBD)
#> ======================================================================
#> Response : yield
#> Factor A : A
#> Factor B : B
#> Factor C : C
#> Observations : 36
#>
#> Analysis of variance
#> Source Df Sum Sq Mean Sq F value Pr(>F)
#> rep 2 42406.20 21203.10 6.852 0.0049 **
#> A 1 5505.52 5505.52 1.779 0.1959 NS
#> B 1 16395.94 16395.94 5.298 0.0312 *
#> C 2 5626.54 2813.27 0.909 0.4175 NS
#> A:B 1 2429.03 2429.03 0.785 0.3852 NS
#> A:C 2 588.81 294.41 0.095 0.9096 NS
#> B:C 2 3753.96 1876.98 0.607 0.5541 NS
#> A:B:C 2 9538.89 4769.45 1.541 0.2364 NS
#> Error 22 68081.18 3094.60
#> Total 35 154326.07
#> Signif. codes: *** p < 0.001, ** p < 0.01, * p < 0.05, NS not significant
#>
#> Grand mean = 1212.230 CV = 4.59%
#>
#> SE and CD (alpha = 0.05)
#> Effect Obs_per_mean SEm SEd CD
#> A 18 13.112 18.543 38.456
#> B 18 13.112 18.543 38.456
#> C 12 16.059 22.710 47.099
#> A x B 9 18.543 26.224 54.385
#> A x C 6 22.710 32.117 66.608
#> B x C 6 22.710 32.117 66.608
#> A x B x C 3 32.117 45.421 94.197
#>
#> Means of A
#> A Mean SE Obs Group
#> A1 1224.60 13.112 18 a
#> A2 1199.86 13.112 18 a
#>
#> Means of B
#> B Mean SE Obs Group
#> B1 1190.89 13.112 18 b
#> B2 1233.57 13.112 18 a
#>
#> Means of C
#> C Mean SE Obs Group
#> C1 1217.55 16.059 12 a
#> C2 1224.17 16.059 12 a
#> C3 1194.97 16.059 12 a
#>
#> Two- and three-way tables are in $means.
res$comparisons
#> Effect Obs_per_mean SEm SEd CD
#> 1 A 18 13.11191 18.54304 38.45591
#> 2 B 18 13.11191 18.54304 38.45591
#> 3 C 12 16.05874 22.71049 47.09868
#> 4 A x B 9 18.54304 26.22382 54.38487
#> 5 A x C 6 22.71049 32.11749 66.60759
#> 6 B x C 6 22.71049 32.11749 66.60759
#> 7 A x B x C 3 32.11749 45.42099 94.19736
