#> Online License checked out Mon Mar 30 10:33:42 2026
2026-01-01
Define your research questions/hypothesis.
We need a null hypothesis for each question, for example:
Does irrigation affect the yield of different cultivars differently?
\(H_0:i_1cv_1=i_2cv_2= ...=i_ncv_n=0\)
\(H_a:\) at least one combination of cultivar and irrication will yield differently.
First of all, I will load all packages I know will used downstream.
#> Online License checked out Mon Mar 30 10:33:42 2026
What design should I choose?
You can use FielD. Lets create a split plot design and save it as “Split-Plot_2025-04-04.csv”.
After running the experiment and collecting data with the hightest quality possible, Loading the data and creating a “fake” split-plot with the same response variable to illustrate the split-plot analysis.
alfaRCBD <- read.table("ALFALFA.txt", header = TRUE, na.string = "*")
alfaSPLIT <- read_csv("Split-Plot_2025-04-04.csv") |>
mutate(resp = alfaRCBD$Resp) |>
rename(irrigation = "WHOLE_PLOT", cv = "SUB_PLOT", col = "COLUMN", block = "REP") |>
select(-ID, -LOCATION, -TRT_COMB)
colnames(alfaSPLIT) <- tolower(colnames(alfaSPLIT))Creating factors
Understanding the experiment
A mixed model with cv as a random effect by all the ANOVA assumptions still hold.
#> ASReml Version 4.2 30/03/2026 10:33:43
#> LogLik Sigma2 DF wall
#> 1 48.73447 0.06197422 66 10:33:43
#> 2 50.02113 0.05731910 66 10:33:43
#> 3 51.15010 0.05255230 66 10:33:43
#> 4 51.69752 0.04874910 66 10:33:43
#> 5 51.73661 0.04775121 66 10:33:43
#> 6 51.73696 0.04765360 66 10:33:43
Dropping the assumtion of homogeneity of variances (“diag()” estructure) across cultivars.
#> ASReml Version 4.2 30/03/2026 10:33:43
#> LogLik Sigma2 DF wall
#> 1 48.02611 1.0 66 10:33:43 ( 1 restrained)
#> 2 52.37703 1.0 66 10:33:43 ( 1 restrained)
#> 3 52.85416 1.0 66 10:33:43 ( 1 restrained)
#> 4 57.36453 1.0 66 10:33:43 ( 1 restrained)
#> 5 58.08428 1.0 66 10:33:43 ( 1 restrained)
#> 6 58.15785 1.0 66 10:33:43
#> 7 58.16005 1.0 66 10:33:43
Dropping the assumtion of independent residuals (“ar1()” estructure) across cultivars.
#> ASReml Version 4.2 30/03/2026 10:33:43
#> LogLik Sigma2 DF wall
#> 1 49.93931 0.06124234 66 10:33:43
#> 2 53.07193 0.05568745 66 10:33:43
#> 3 55.48466 0.05307777 66 10:33:43
#> 4 56.29486 0.05281485 66 10:33:43
#> 5 56.43731 0.05330333 66 10:33:43
#> 6 56.44170 0.05381629 66 10:33:43
#> 7 56.44196 0.05399564 66 10:33:43
Dropping the assumtions of independence and homogeneity of variances (“ar1()” estructure) across cultivars.
#> ASReml Version 4.2 30/03/2026 10:33:44
#> LogLik Sigma2 DF wall
#> 1 49.59856 1.0 66 10:33:44 ( 1 restrained)
#> 2 57.09737 1.0 66 10:33:44 ( 1 restrained)
#> 3 61.70343 1.0 66 10:33:44 ( 1 restrained)
#> 4 63.34096 1.0 66 10:33:44 ( 1 restrained)
#> 5 63.35612 1.0 66 10:33:44 ( 1 restrained)
#> 6 63.77299 1.0 66 10:33:44 ( 1 restrained)
#> 7 63.44874 1.0 66 10:33:44 ( 1 restrained)
#> 8 63.97328 1.0 66 10:33:44
#> 9 63.96703 1.0 66 10:33:44
#> 10 63.63862 1.0 66 10:33:44 ( 1 restrained)
#> 11 62.72847 1.0 66 10:33:44
#> 12 63.54572 1.0 66 10:33:44
#> 13 63.95277 1.0 66 10:33:44
#> ASReml Version 4.2 30/03/2026 10:33:44
#> LogLik Sigma2 DF wall
#> 1 11.59703 0.1189617 48 10:33:44 ( 1 restrained)
#> 2 12.45475 0.1160740 48 10:33:44 ( 1 restrained)
#> 3 12.72741 0.1127543 48 10:33:44 ( 1 restrained)
#> 4 12.83207 0.1099238 48 10:33:44 ( 1 restrained)
#> 5 12.83719 0.1092731 48 10:33:44
If the statistical model did not reach convergence, you can try the update function.
The function vc()from the package lucid can extract the variance components from asreml, lme4, mmer, nlme and mcmc.list objects.
Fixed effects: estimates
Random effects: Predictions
How do we get predicted values (you can think of adjusted means).
identity
residual variance from asreml
correlation (between measures taken on the same plants in multiple times) from asreml
#> ASReml Version 4.2 30/03/2026 10:33:45
#> LogLik Sigma2 DF wall
#> 1 -205.4312 252.5043 60 10:33:45 ( 1 restrained)
#> 2 -193.2995 192.1892 60 10:33:45 ( 1 restrained)
#> 3 -182.9788 203.0901 60 10:33:45
#> 4 -181.3071 350.9370 60 10:33:45
#> 5 -181.0678 280.9927 60 10:33:45
#> 6 -181.0631 289.0975 60 10:33:45
#> 7 -181.0630 287.7454 60 10:33:45
#> ASReml Version 4.2 30/03/2026 10:33:45
#> LogLik Sigma2 DF wall
#> 1 -194.8709 1.0 60 10:33:45
#> 2 -193.9222 1.0 60 10:33:45
#> 3 -193.1067 1.0 60 10:33:45
#> 4 -192.7882 1.0 60 10:33:45
#> 5 -192.7819 1.0 60 10:33:45
#> fixedDF varDF NBound AIC BIC loglik
#> 1 0 1 0 420.8836 422.9779 -209.4418
#> 2 0 2 0 397.7535 401.9422 -196.8768
#> 3 0 2 0 366.1259 370.3146 -181.0630
#> 4 0 5 1 395.5637 406.0354 -192.7819
#> 5 0 15 1 346.0712 377.4863 -158.0356
#> [0;34mWald tests for fixed effects.[0m
#> [0;34mResponse: y[0m
#> [0;34mTerms added sequentially; adjusted for those above.[0m
#>
#> Df Sum of Sq Wald statistic Pr(Chisq)
#> (Intercept) 1 305303 1066.34 < 2.2e-16 ***
#> Tmt 1 8707 30.41 3.495e-08 ***
#> Time 4 27554 96.24 < 2.2e-16 ***
#> Tmt:Time 4 2581 9.02 0.06072 .
#> residual (MS) 286
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> Anova Table (Type II tests)
#>
#> Response: y
#> Sum Sq Df F value Pr(>F)
#> Tmt 8707.0 1 30.4112 7.810e-07 ***
#> Time 27554.1 4 24.0597 6.614e-12 ***
#> Tmt:Time 2581.1 4 2.2538 0.0738 .
#> Residuals 17178.6 60
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
The model below won’t work because of the order the data was arranged.
Pvalues for fixed effects
#> [0;34mWald tests for fixed effects.[0m
#> [0;34mResponse: resp[0m
#> [0;34mTerms added sequentially; adjusted for those above.[0m
#>
#> Df Sum of Sq Wald statistic Pr(Chisq)
#> (Intercept) 1 38.534 352.78 <2e-16 ***
#> irrigation 1 0.192 1.76 0.1852
#> cv 11 0.562 5.15 0.9237
#> irrigation:cv 11 0.758 6.94 0.8040
#> residual (MS) 0.109
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> [0;34mWald tests for fixed effects.[0m
#> [0;34mResponse: resp[0m
#> [0;34mTerms added sequentially; adjusted for those above.[0m
#>
#> Df Sum of Sq Wald statistic Pr(Chisq)
#> (Intercept) 1 24.9437 218.621 <2e-16 ***
#> irrigation 1 0.1667 1.461 0.2268
#> cv 11 0.8835 7.743 0.7361
#> irrigation:cv 11 1.2929 11.332 0.4159
#> residual (MS) 0.1141
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AGST 50104 - Design of Experiments | Spring 2026