I’ll upload one data in R.
if(!require(readr)) install.packages("readr")
library(readr)
github= paste0("https://raw.githubusercontent.com/agronomy4future/",
"raw_data_practice/refs/heads/main/",
"corn_grain_yield.csv")
dataA=data.frame(read_csv(url(github),show_col_types = FALSE))
print(head(dataA, 5)) year season variety population location ear AGW KN GY 1 2022 Long Season CV1 High D Site 1 1 297.5 3550 10439 2 2022 Long Season CV1 High D Site 1 2 283.9 3408 9562 3 2022 Long Season CV1 High D Site 1 3 270.8 3834 10264 4 2022 Long Season CV1 High D Site 1 4 328.1 3408 11053 5 2022 Long Season CV1 High D Site 1 5 298.1 3692 10878 . . .
I have 10 corn varieties and want to analyze the impact of nitrogen treatments (N0 and N1), variety, and their interaction on grain yield. Since replicates are considered as blocks, I will conduct a two-way ANOVA analysis with blocks as the statistical model.
The statistical model for two-way ANOVA with blocks is as follows:
yijk = μ + αi + βj + δij + γk + εijk where yijk: observed values for treatment (ij; i = factor 1, j = factor 2) and replicates (k) μ: grand mean of observed values αi: treatment effect of factor 1 βj: treatment effect of factor 2 δij: interaction effect between factor 1 (i) and factor 2 (j) γk: block effect εijk: residuals
Based on the statistical model for two-way ANOVA with blocks, we can conduct the analysis using R. Below is an example code:
anova2way= aov (GY ~ variety + population + variety:population, data=dataA)
summary(anova2way)
Df Sum Sq Mean Sq F value Pr(>F)
variety 22 9.569e+08 43496413 9.309 < 2e-16 ***
population 1 8.215e+08 821484359 175.810 < 2e-16 ***
variety:population 22 2.117e+08 9620751 2.059 0.00262 **
Residuals 2205 1.030e+10 4672566
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

We aim to develop open-source code for agronomy ([email protected])
© 2022 – 2025 https://agronomy4future.com – All Rights Reserved.
Last Updated: 11/16/2020