| Type: | Package |
| Title: | Comprehensive Statistical Tools for Agricultural Research |
| Version: | 2.1.0 |
| Description: | Analysis of variance for the experimental designs used in agricultural research, with the correct error term for every stratum, standard error of mean (SEm), standard error of difference (SEd), critical difference (CD), coefficient of variation (CV) and letter groupings: completely randomized design (CRD), randomized complete block design (RCBD) with missing plots, Latin square, two- and three-factor factorials, split-plot designs (including factorial main or sub-plots), split-split-plot and strip-plot designs, and combined analysis over environments. Also covers the augmented randomized complete block design with adjusted means and genetic parameters (Federer, 1961 <doi:10.2307/2527837>), alpha lattice designs with intra-block or residual maximum likelihood (REML) analysis (Patterson and Williams, 1976 <doi:10.1093/biomet/63.1.83>) and repeated measures with Greenhouse-Geisser and Huynh-Feldt corrections and covariance structure models. Mean comparisons (least significant difference, Duncan, Tukey, Student-Newman-Keuls, Scheffe, Bonferroni and Dunnett) follow Gomez and Gomez (1984, ISBN:0471870927), with letters assigned by the algorithm of Piepho (2004) <doi:10.1198/1061860043515>. Stability analysis includes Eberhart and Russell (1966) <doi:10.2135/cropsci1966.0011183X000600010011x> regression, additive main effects and multiplicative interaction (AMMI), Finlay-Wilkinson, Shukla, Wricke, coefficient of variation and Lin-Binns methods, and genotype plus genotype-by-environment (GGE) biplots (Yan et al., 2000 <doi:10.2135/cropsci2000.403597x>). Further tools compute growing degree days, helio-thermal and photo-thermal units, crop growth rate, relative growth rate, net assimilation rate, leaf area index and leaf area duration, harvest index, yield gaps with the technology index, nutrient use efficiency, quadratic, plateau and Mitscherlich response curves with the economic optimum dose, benefit-cost ratio, correlation, principal component, path and structural equation analysis, publication tables for many traits and figures. |
| License: | GPL-3 |
| Encoding: | UTF-8 |
| LazyData: | true |
| Depends: | R (≥ 4.0.0) |
| Imports: | grDevices, graphics, nlme, stats, utils |
| Suggests: | agricolae, corrplot, emmeans, factoextra, ggplot2 (≥ 3.4.0), knitr, lavaan, multcomp, rmarkdown, semPlot, testthat (≥ 3.0.0), tibble, writexl |
| VignetteBuilder: | knitr |
| URL: | https://github.com/lalitrolaniya/aridagri, https://lalitrolaniya.github.io/aridagri/ |
| BugReports: | https://github.com/lalitrolaniya/aridagri/issues |
| Config/testthat/edition: | 3 |
| NeedsCompilation: | no |
| Config/roxygen2/version: | 8.1.1 |
| Packaged: | 2026-11-09 12:28:43 UTC; root |
| Author: | Lalit Kumar Rolaniya
|
| Maintainer: | Lalit Kumar Rolaniya <lalitrolaniya@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-11-10 23:00:02 UTC |
aridagri: Statistical Tools for Agricultural Research
Description
Analysis of variance for the common field designs with correct error terms, standard errors, critical differences and letter groupings, plus stability analysis, repeated measures, thermal indices, crop growth analysis, nutrient use efficiency, response curves and economics.
Experimental designs
-
anova_crd,anova_rbd,anova_latin: single-factor designs (missing plots and unequal replication handled exactly) -
anova_factorial,anova_factorial_3way: factorial experiments -
anova_spd,anova_spd_ab_main,anova_spd_c_main_ab_sub,anova_spd_ab_cd,anova_sspd,anova_strip: split-plot family with SE and CD for every comparison -
anova_rbd_pooled,anova_spd_pooled,anova_sspd_pooled: combined analysis over environments -
anova_augmented,anova_alpha_lattice: designs for germplasm and breeding trials -
anova_repeated: repeated measures with sphericity corrections and covariance-structure models -
anova_traits: publication table for many traits
Mean comparisons and diagnostics
perform_posthoc, compare_means,
check_assumptions.
Genotype x environment analysis
stability_analysis (Eberhart-Russell, AMMI,
Finlay-Wilkinson, Shukla, Wricke, CV, Lin-Binns) and
gge_biplot.
Agronomic indices
thermal_indices, day_length,
crop_growth_analysis, harvest_index,
yield_gap_analysis, economic_indices,
economic_analysis, nue_calculate,
nutrient_response.
Multivariate methods
correlation_analysis, pca_analysis,
path_analysis, sem_analysis.
Figures and export
plot_means, plot_interaction,
plot_stability, plot_response,
plot() methods, theme_aridagri (ggplot2);
arid_plot (base graphics); export_results.
Author(s)
Lalit Kumar Rolaniya (maintainer), Ram Lal Jat, Monika Punia (deceased), Raja Ram Choudhary and Hemant Poonia (deceased)
See Also
Useful links:
Report bugs at https://github.com/lalitrolaniya/aridagri/issues
Alpha Lattice Design ANOVA
Description
Analysis of an alpha lattice (resolvable incomplete block) design.
Gives the intra-block ANOVA, genotype means adjusted for incomplete
blocks with exact standard errors and letter groupings, and the
efficiency of the design relative to a randomized complete block design.
By default replications and blocks are treated as random (REML), so
that inter-block information is recovered (Patterson and Williams,
1976); analysis = "intra" gives the classical intra-block
estimates.
Usage
anova_alpha_lattice(
data,
response,
genotype,
replication,
block,
verbose = TRUE,
analysis = c("reml", "intra"),
posthoc = "lsd",
alpha = 0.05
)
Arguments
data |
Data frame containing the data. |
response |
Name of the response variable. |
genotype |
Name of the genotype column. |
replication |
Name of the replication column. |
block |
Name of the incomplete block column (nested within replication; labels may repeat across replications). |
verbose |
Logical. If TRUE (default), prints the report. |
analysis |
|
posthoc |
Method for the letters (default |
alpha |
Significance level. Default 0.05. |
Details
The intra-block ANOVA is the sequential analysis of the model
replication + block(replication) + genotype: genotypes are tested after
blocks. Blocks within replications are also shown adjusted for
genotypes. Adjusted means are least-squares means. The efficiency
relative to an RCBD is the average variance of a difference under the
RCBD analysis (2 MSE_{RCBD} / r) divided by the average variance
of a difference of adjusted means. With REML, letters and CD use the
intra-block error degrees of freedom, an approximation.
Value
An object of class aridagri_alpha with
anova_table, genotype_means (adjusted means with SE and
letters, highest first), avg_sed, cd (from the average
SEd), efficiency (percent, relative to RCBD), cv,
grand_mean, posthoc, variance_components (REML)
and model.
Author(s)
Lalit Kumar Rolaniya, Ram Lal Jat, Monika Punia, Raja Ram Choudhary, Hemant Poonia
References
Patterson, H.D. and Williams, E.R. (1976). A new class of resolvable incomplete block designs. Biometrika, 63(1), 83-92. doi:10.1093/biomet/63.1.83
Examples
data(cowpea_alpha)
res <- anova_alpha_lattice(cowpea_alpha, response = "grain_yield",
genotype = "genotype", replication = "rep",
block = "block")
head(res$genotype_means)
Augmented Randomized Complete Block Design
Description
Analysis of an augmented randomized complete block design (Federer, 1956), where a few check varieties are replicated in every block and the new (test) entries appear once. Gives the ANOVA with the treatment sum of squares split into checks, tests and checks vs tests, adjusted means of all entries, the four standard errors of difference, a comparison of every test entry with the checks, and genetic parameters of the test entries.
Usage
anova_augmented(
data,
response,
genotype,
block,
check_names,
verbose = TRUE,
alpha = 0.05,
k = 2.063
)
Arguments
data |
Data frame containing the data. |
response |
Name of the response variable. |
genotype |
Name of the entry (genotype) column. |
block |
Name of the block column. |
check_names |
Character vector with the names of the check entries. |
verbose |
Logical. If TRUE (default), prints the report. |
alpha |
Significance level for CD. Default 0.05. |
k |
Standardized selection differential for genetic advance. Default 2.063 (5% selection intensity). |
Details
Block effects are estimated from the checks and removed from the test
entries: adjusted value = observed value - (mean of checks in its block -
overall check mean). This equals the least-squares mean from the model
response ~ block + genotype, which is used here, so the standard
errors are exact. With b blocks and c checks the four
standard errors of difference are: two check means
\sqrt{2 MSE / b}; two test entries in the same block
\sqrt{2 MSE}; two test entries in different blocks
\sqrt{2 MSE (1 + 1/c)}; a test entry and a check mean
\sqrt{MSE (1 + 1/b + 1/c - 1/(bc))}.
Two ANOVA tables are given. In the first, treatments are fitted after blocks and their sum of squares is split into tests vs checks, checks and tests, each adjusted for blocks. In the second, blocks are fitted after treatments and the treatment sum of squares (ignoring blocks) is split into checks, tests and checks vs tests (Federer, 1961).
Genetic parameters of the test entries use the block-adjusted mean
square among tests from the first table: phenotypic variance
\sigma^2_p = MS(tests), error variance \sigma^2_e = MSE,
genotypic variance \sigma^2_g = \sigma^2_p - \sigma^2_e,
broad-sense heritability h^2 = \sigma^2_g / \sigma^2_p, GCV and
PCV in percent of the mean of the adjusted test values, and genetic
advance GA = k h^2 \sigma_p.
Value
An object of class aridagri_augmented with
anova_adjusted (treatments after blocks),
anova_partitioned (blocks after treatments, treatments split),
adjusted_means (all entries with type, raw and adjusted mean,
SE and block), se_diff and cd (the four comparisons),
test_vs_checks (difference of each test entry from the check
mean and the best check, with significance), block_effects,
genetic_parameters, mse, df_error,
anova_checks and model.
Author(s)
Lalit Kumar Rolaniya, Ram Lal Jat, Monika Punia, Raja Ram Choudhary, Hemant Poonia
References
Federer, W.T. (1956). Augmented (or hoonuiaku) designs. Hawaiian Planters' Record, 55, 191-208.
Federer, W.T. (1961). Augmented designs with one-way elimination of heterogeneity. Biometrics, 17(3), 447-473. doi:10.2307/2527837
Examples
data(chickpea_augmented)
res <- anova_augmented(chickpea_augmented, response = "seed_yield",
genotype = "entry", block = "block",
check_names = c("C1", "C2", "C3", "C4"))
head(res$test_vs_checks)
res$genetic_parameters
Completely Randomized Design (CRD) ANOVA
Description
Analysis of variance for a completely randomized design with standard errors, critical difference, coefficient of variation, post-hoc letter groupings and assumption checks. Unequal replication is handled exactly.
Usage
anova_crd(
data,
response,
treatment,
posthoc = "lsd",
alpha = 0.05,
verbose = TRUE,
control = NULL
)
Arguments
data |
Data frame containing the experimental data. |
response |
Name of the response variable (character). |
treatment |
Name of the treatment column. |
posthoc |
Post-hoc test(s): |
alpha |
Significance level for the CD and the post-hoc tests (default 0.05). |
verbose |
Logical. If TRUE (default), prints the report. |
control |
Control level for Dunnett's test (default: first level). |
Details
SEm = sqrt(MSE / r), SEd = sqrt(2 MSE / r) and CD = t(alpha/2, error df) x SEd, where r is the number of replications (the harmonic mean when replication is unequal; the letters then use the exact SE of each pair). CV = 100 sqrt(MSE) / grand mean. Rows with a missing response are dropped with a message.
Value
An object of class aridagri_anova with
anova_table, model, grand_mean, cv,
ms_error, df_error, se_mean (SEm),
se_diff (SEd), cd (at alpha), cd_5,
cd_1, treatment_means (mean, SD, N, SE and letters),
posthoc, diagnostics, significance and
balanced.
Author(s)
Lalit Kumar Rolaniya, ICAR-IIPR, Bikaner
References
Gomez, K.A. and Gomez, A.A. (1984). Statistical Procedures for Agricultural Research, 2nd ed. John Wiley and Sons, New York.
Examples
data <- data.frame(
treatment = rep(c("T1", "T2", "T3", "T4"), each = 5),
yield = c(1210, 1185, 1242, 1198, 1225, 1340, 1362, 1318, 1375, 1350,
1105, 1090, 1122, 1131, 1098, 1445, 1462, 1430, 1471, 1452)
)
res <- anova_crd(data, response = "yield", treatment = "treatment",
posthoc = "duncan")
res$treatment_means
Two-Factor Factorial ANOVA
Description
Analysis of variance for a two-factor factorial experiment in a
randomized complete block design (when replication is given) or
a completely randomized design, with SEm, SEd and CD for both main
effects and the interaction, and letter groupings for factor means and
treatment combinations.
Usage
anova_factorial(
data,
response,
factor1,
factor2,
replication = NULL,
posthoc = "lsd",
alpha = 0.05,
verbose = TRUE
)
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). |
replication |
Name of the replication (block) column, or
|
posthoc |
Post-hoc method for the letters (see
|
alpha |
Significance level for CD and letters. Default 0.05. |
verbose |
Logical. If TRUE (default), prints the report. |
Value
An object of class aridagri_factorial with
anova_table, model, grand_mean, cv,
ms_error, df_error, comparisons (SEm, SEd and CD
for A, B and A x B), se_a, cd_a, se_b,
cd_b, se_ab, cd_ab, mean_a,
mean_b (with letters), interaction_means (all
combinations with letters), mean_ab (two-way table) and
posthoc.
Author(s)
Lalit Kumar Rolaniya, ICAR-IIPR, Bikaner
Examples
data <- expand.grid(rep = 1:4, nitrogen = c("N0", "N40", "N80"),
phosphorus = c("P0", "P30"))
set.seed(1)
data$yield <- 900 + 3 * as.numeric(sub("N", "", data$nitrogen)) +
2 * as.numeric(sub("P", "", data$phosphorus)) + rnorm(nrow(data), 0, 40)
res <- anova_factorial(data, response = "yield", factor1 = "nitrogen",
factor2 = "phosphorus", replication = "rep")
res$interaction_means
Three-Factor Factorial ANOVA
Description
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
|
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
|
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.
Author(s)
Lalit Kumar Rolaniya, Ram Lal Jat, Monika Punia, Raja Ram Choudhary, Hemant Poonia
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")
res$comparisons
Latin Square Design ANOVA
Description
Analysis of variance for a Latin square design with row and column blocking, SEm, SEd, CD, CV, the efficiency of the Latin square relative to a CRD and to an RCBD, and post-hoc letter groupings.
Usage
anova_latin(
data,
response,
treatment,
row,
column,
posthoc = "lsd",
alpha = 0.05,
verbose = TRUE,
control = NULL
)
Arguments
data |
Data frame containing the data. |
response |
Name of the response variable. |
treatment |
Name of the treatment column. |
row |
Name of the row column. |
column |
Name of the column column. |
posthoc |
Post-hoc method(s); see |
alpha |
Significance level. Default 0.05. |
verbose |
Logical. If TRUE (default), prints the report. |
control |
Control level for Dunnett's test. |
Details
Relative efficiencies (Cochran and Cox, 1957; Gomez and Gomez, 1984)
use the row (E_r), column (E_c) and error (E_e) mean
squares: versus a CRD, [E_r + E_c + (t-1)E_e] / [(t+1)E_e];
versus an RCBD with rows as blocks, [E_c + (t-1)E_e] / (t E_e);
versus an RCBD with columns as blocks, [E_r + (t-1)E_e] / (t E_e),
each multiplied by the precision adjustment factor when the error
degrees of freedom are below 20.
Value
An object of class aridagri_anova with the components
of anova_crd and relative_efficiency (a named
vector, percent).
Author(s)
Lalit Kumar Rolaniya, ICAR-IIPR, Bikaner
Examples
data <- data.frame(
row = rep(1:5, each = 5),
col = rep(1:5, 5),
treatment = c("A","B","C","D","E", "B","C","D","E","A",
"C","D","E","A","B", "D","E","A","B","C",
"E","A","B","C","D"),
yield = c(1180, 1265, 1342, 1410, 1238, 1270, 1335, 1402, 1251, 1176,
1340, 1415, 1245, 1190, 1258, 1405, 1232, 1178, 1262, 1339,
1236, 1183, 1271, 1348, 1398)
)
anova_latin(data, response = "yield", treatment = "treatment",
row = "row", column = "col")
Randomized Complete Block Design (RCBD) ANOVA
Description
Analysis of variance for a randomized complete block design with standard errors, critical difference, CV, relative efficiency over a CRD, post-hoc letter groupings and assumption checks. Missing plots are handled by least squares: treatments are tested after blocks, means are least-squares (adjusted) means and every pair is compared with its own standard error.
Usage
anova_rbd(
data,
response,
treatment,
block,
posthoc = "lsd",
alpha = 0.05,
verbose = TRUE,
control = NULL
)
Arguments
data |
Data frame containing the experimental data. |
response |
Name of the response variable (character). |
treatment |
Name of the treatment column. |
block |
Name of the block (replication) column. |
posthoc |
Post-hoc test(s): |
alpha |
Significance level for the CD and the post-hoc tests (default 0.05). |
verbose |
Logical. If TRUE (default), prints the report. |
control |
Control level for Dunnett's test (default: first level). |
Details
Relative efficiency of the RCBD over a CRD follows Gomez and Gomez (1984):
RE = \frac{(r - 1) E_b + r (t - 1) E_e}{(r t - 1) E_e}
where E_b and E_e are the block and error mean squares,
multiplied by the precision adjustment factor
k = \frac{[(r-1)(t-1)+1][t(r-1)+3]}{[(r-1)(t-1)+3][t(r-1)+1]}
when the error degrees of freedom are below 20. Values above 100% mean
that blocking reduced the error.
Value
An object of class aridagri_anova. In addition to the
components described in anova_crd it contains
relative_efficiency (percent, adjusted),
relative_efficiency_unadjusted and missing_plots.
Author(s)
Lalit Kumar Rolaniya, ICAR-IIPR, Bikaner
References
Gomez, K.A. and Gomez, A.A. (1984). Statistical Procedures for Agricultural Research, 2nd ed. John Wiley and Sons, New York.
Examples
data(mothbean_rbd)
res <- anova_rbd(mothbean_rbd, response = "seed_yield",
treatment = "treatment", block = "block",
posthoc = "duncan")
res$treatment_means
res$relative_efficiency
Combined (Pooled) Analysis of RCBD Experiments over Environments
Description
Combined analysis of variance for the same set of treatments tested in a randomized complete block design in several environments (years, seasons or locations). Gives the analysis of each environment, Bartlett's test of homogeneity of error variances, the combined ANOVA with the correct error term for every source, SE and CD for treatment, environment and interaction means, and letter groupings for the treatment means.
Usage
anova_rbd_pooled(
data,
response,
treatment,
environment,
block,
posthoc = "lsd",
alpha = 0.05,
verbose = TRUE,
env_effect = c("fixed", "random"),
control = NULL
)
Arguments
data |
Data frame containing the experimental data. |
response |
Name of the response variable (character). |
treatment |
Name of the treatment column. |
environment |
Name of the environment (year, season or location) column. |
block |
Name of the block column (blocks are nested within environments; labels may repeat across environments). |
posthoc |
Post-hoc test(s): |
alpha |
Significance level for the CD and the post-hoc tests (default 0.05). |
verbose |
Logical. If TRUE (default), prints the report. |
env_effect |
Either |
control |
Control level for Dunnett's test (default: first level). |
Details
Sources and their F-tests (McIntosh, 1983; Gomez and Gomez, 1984): environment is tested against blocks within environments; the treatment x environment interaction against the pooled error; the treatment effect against the pooled error when environments are fixed and against the treatment x environment mean square when they are random. With random environments the usual restricted mixed model is assumed, so environment is still tested against blocks within environments. The SE and CD of treatment means use the same denominator as the treatment F-test. Bartlett's chi-square tests whether the error variances of the environments can be pooled; when it is significant, interpret the combined analysis with care.
Value
An object of class aridagri_pooled with
pooled_anova (combined ANOVA with correct F-tests),
individual_anovas, environment_summary (mean, MSE, CV,
F, p and CD of each environment), bartlett_test,
treatment_means (with letters), interaction_means,
se_treatment, cd_treatment, se_environment,
cd_environment, se_interaction, cd_interaction,
posthoc, cv, grand_mean, mse_values and
model.
Author(s)
Lalit Kumar Rolaniya, ICAR-IIPR, Bikaner
References
McIntosh, M.S. (1983). Analysis of combined experiments. Agronomy Journal, 75(1), 153-155. doi:10.2134/agronj1983.00021962007500010041x
Gomez, K.A. and Gomez, A.A. (1984). Statistical Procedures for Agricultural Research, 2nd ed. John Wiley and Sons, New York.
Examples
data(pearlmillet_met)
res <- anova_rbd_pooled(pearlmillet_met, response = "grain_yield",
treatment = "genotype", environment = "environment",
block = "rep", verbose = FALSE)
res$pooled_anova
res$bartlett_test
Repeated Measures ANOVA (Split-Plot in Time)
Description
Analysis of experiments in which the same experimental units (plots, animals, trees) are measured on several occasions: plant height or LAI at successive dates, soil moisture through the season, or body weight, heart rate or blood metabolites over time. Gives the univariate split-plot-in-time ANOVA, Mauchly's test of sphericity with Greenhouse-Geisser and Huynh-Feldt corrected p-values, a comparison of covariance structures by mixed models (compound symmetry, first-order autoregressive and unstructured), SE and CD for every comparison, letter groupings, and a separate analysis at each time.
Usage
anova_repeated(
data,
response,
treatment,
time,
subject = NULL,
block = NULL,
posthoc = "lsd",
alpha = 0.05,
covariance = TRUE,
verbose = TRUE
)
Arguments
data |
Data frame in long format (one row per unit per time). |
response |
Name of the response variable. |
treatment |
Name of the treatment column. |
time |
Name of the time (occasion) column. Times are taken in the order of their levels (numeric times are sorted). |
subject |
Name of the column identifying the experimental unit that
is measured repeatedly. If |
block |
Name of the block column for units laid out in randomized
complete blocks, or |
posthoc |
Method for the letters (default |
alpha |
Significance level. Default 0.05. |
covariance |
Logical. If TRUE (default), fits mixed models with different covariance structures using nlme. |
verbose |
Logical. If TRUE (default), prints the report. |
Details
Univariate analysis. Treatment (and block) are tested against
the between-unit error, Error(a). Time and the treatment x time
interaction are tested against the within-unit error, Error(b). With
blocks, the block x time interaction is fitted as a separate
within-unit term, as in the univariate tests of SAS PROC GLM with a
REPEATED statement, so that the sphericity corrections apply to the
same error term. This is
valid when the covariance of the repeated measurements is spherical.
Mauchly's test checks this, and the Greenhouse-Geisser (1959) and
Huynh-Feldt (1976) epsilons, the latter with the correction of Lecoutre
(1991) as in anova.mlm(), scale the degrees of freedom of the
within-unit tests when it fails. A common rule is to use the
Greenhouse-Geisser p-value when epsilon is below 0.75 and the
Huynh-Feldt p-value otherwise.
Mixed models. Generalized least squares models with the same fixed effects are fitted by REML with compound symmetry (CS), first-order autoregressive (AR1, on the time order) and unstructured (UN, with separate variances per time) covariance, and compared by AIC and BIC. The marginal F-tests of the best structure are reported (with the residual degrees of freedom used by nlme, so tests of between-unit effects are approximate; the univariate test of treatment is exact for balanced data). Structures that fail to converge are skipped.
Comparisons. With r units per treatment, a
treatments and t times, the SEd are as in a split-plot design
with treatments in main plots and times in sub-plots: treatment means
\sqrt{2E_a/(rt)}, time means \sqrt{2E_b/(ra)}, times within
a treatment \sqrt{2E_b/r}, and treatments at the same time
\sqrt{2[(t-1)E_b + E_a]/(rt)} with the weighted t.
Value
An object of class aridagri_repeated with
anova_table (univariate), sphericity (Mauchly's W and
p, GG and HF epsilons), corrected (within-unit tests with GG
and HF p-values), covariance_models (AIC/BIC table),
best_structure, mixed_anova, se_cd,
means (treatment x time table), treatment_means,
time_means, letters, by_time (ANOVA at each time)
and models.
References
Greenhouse, S.W. and Geisser, S. (1959). On methods in the analysis of profile data. Psychometrika, 24(2), 95-112. doi:10.1007/BF02289823
Lecoutre, B. (1991). A correction for the epsilon approximate test in repeated measures designs with two or more independent groups. Journal of Educational Statistics, 16(4), 371-372. doi:10.3102/10769986016004371
Huynh, H. and Feldt, L.S. (1976). Estimation of the Box correction for degrees of freedom from sample data in randomized block and split-plot designs. Journal of Educational Statistics, 1(1), 69-82. doi:10.3102/10769986001001069
Littell, R.C., Henry, P.R. and Ammerman, C.B. (1998). Statistical analysis of repeated measures data using SAS procedures. Journal of Animal Science, 76(4), 1216-1231. doi:10.2527/1998.7641216x
Examples
data(mungbean_repeated)
rm <- anova_repeated(mungbean_repeated, response = "spad",
treatment = "treatment", time = "das", block = "block")
rm$sphericity
rm$covariance_models
Split-Plot Design ANOVA
Description
Analysis of variance for a split-plot design in randomized complete blocks, with the main-plot factor tested against Error(a) and the sub-plot factor and interaction against Error(b). Gives CV(a), CV(b), SEm, SEd and CD for all four standard comparisons and letter groupings for main-plot means, sub-plot means and each factor within the levels of the other.
Usage
anova_spd(
data,
response,
main_plot,
sub_plot,
replication,
posthoc = "lsd",
alpha = 0.05,
verbose = TRUE
)
Arguments
data |
Data frame containing the experimental data. |
response |
Name of the response variable. |
main_plot |
Name of the main-plot factor (A). |
sub_plot |
Name of the sub-plot factor (B). |
replication |
Name of the replication (block) column. |
posthoc |
Method for the letters (see
|
alpha |
Significance level for CD and letters. Default 0.05. |
verbose |
Logical. If TRUE (default), prints the report. |
Details
Standard errors of difference (Gomez and Gomez, 1984, table 3.10):
main-plot means \sqrt{2E_a/(rb)}, sub-plot means
\sqrt{2E_b/(ra)}, sub-plot means at the same main-plot level
\sqrt{2E_b/r}, and main-plot means at the same or different
sub-plot level \sqrt{2[(b-1)E_b + E_a]/(rb)}. For the last
comparison the CD uses the weighted t value
t' = [(b-1)E_b t_b + E_a t_a] / [(b-1)E_b + E_a].
The data must be complete (every combination once in each
replication).
Value
An object of class aridagri_spd with the corrected
anova_table, cv_a, cv_b, error mean squares and
df, se_main, cd_main, se_sub, cd_sub,
se_sub_same, cd_sub_same, se_main_same_sub,
cd_main_same_sub, se_cd (all comparisons),
main_means and sub_means (with letters),
interaction_means, letters (each factor within the
levels of the other) and model.
Author(s)
Lalit Kumar Rolaniya, ICAR-IIPR, Bikaner
References
Gomez, K.A. and Gomez, A.A. (1984). Statistical Procedures for Agricultural Research, 2nd ed. John Wiley and Sons, New York.
Examples
data(clusterbean_spd)
res <- anova_spd(clusterbean_spd, response = "seed_yield",
main_plot = "irrigation", sub_plot = "nitrogen",
replication = "rep")
res$se_cd
Split-Plot Design with Factorial Main and Sub-Plots
Description
Split-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 |
alpha |
Significance level. Default 0.05. |
Value
An object of class aridagri_spd_abcd; see
anova_spd_ab_main for the components.
Author(s)
Lalit Kumar Rolaniya, ICAR-IIPR, Bikaner
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
Split-Plot Design with Two Factors in the Main Plot
Description
Split-plot design where the main plots carry the factorial combination of two factors (A x B) and the sub-plots carry factor C. A, B and A x B are tested against Error(a); C and every interaction with C against Error(b).
Usage
anova_spd_ab_main(
data,
response,
main_factor1,
main_factor2,
sub_plot,
replication,
posthoc = "lsd",
alpha = 0.05,
verbose = TRUE
)
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_plot |
Sub-plot factor (C). |
replication |
Name of the replication column. |
posthoc |
Method for the letters (default |
alpha |
Significance level. Default 0.05. |
verbose |
Logical. If TRUE (default), prints the report. |
Value
An object of class aridagri_spd_ab with the corrected
anova_table, cv, error mean squares and df,
se_cd (SEm, SEd and CD for every main effect and interaction
comparison), factor_means (with letters), letters,
interaction_means and model.
Author(s)
Lalit Kumar Rolaniya, ICAR-IIPR, Bikaner
Examples
data <- expand.grid(rep = 1:3, irrigation = c("I1", "I2"),
variety = c("V1", "V2", "V3"),
nitrogen = c("N0", "N1", "N2", "N3"))
set.seed(3)
data$yield <- rnorm(nrow(data), 1200, 80)
res <- anova_spd_ab_main(data, response = "yield",
main_factor1 = "irrigation",
main_factor2 = "variety",
sub_plot = "nitrogen", replication = "rep",
verbose = FALSE)
res$anova_table
Split-Plot Design with Two Factors in the Sub-Plot
Description
Split-plot design where the main plots carry factor C and the sub-plots carry the factorial combination of two factors (A x B). C is tested against Error(a); A, B, A x B and every interaction with C against Error(b).
Usage
anova_spd_c_main_ab_sub(
data,
response,
main_plot,
sub_factor1,
sub_factor2,
replication,
posthoc = "lsd",
alpha = 0.05,
verbose = TRUE
)
Arguments
data |
Data frame containing the experimental data. |
response |
Name of the response variable. |
main_plot |
Main-plot factor (C). |
sub_factor1 |
First sub-plot factor (A). |
sub_factor2 |
Second sub-plot factor (B). |
replication |
Name of the replication column. |
posthoc |
Method for the letters (default |
alpha |
Significance level. Default 0.05. |
verbose |
Logical. If TRUE (default), prints the report. |
Value
An object of class aridagri_spd_cab; see
anova_spd_ab_main for the components.
Author(s)
Lalit Kumar Rolaniya, ICAR-IIPR, Bikaner
Examples
data <- expand.grid(rep = 1:3, irrigation = c("I1", "I2", "I3"),
variety = c("V1", "V2"),
nitrogen = c("N1", "N2", "N3", "N4"))
set.seed(4)
data$yield <- rnorm(nrow(data), 1200, 80)
res <- anova_spd_c_main_ab_sub(data, response = "yield",
main_plot = "irrigation",
sub_factor1 = "variety",
sub_factor2 = "nitrogen",
replication = "rep", verbose = FALSE)
res$anova_table
Combined Split-Plot Analysis over Environments
Description
Combined (pooled) analysis of a split-plot experiment repeated in several environments (years, seasons or locations). Environments are fixed and replications random within environments: the environment effect is tested against replications within environments, main-plot sources against the pooled Error(a) and sub-plot sources against the pooled Error(b). SEm, SEd and CD are given for every comparison.
Usage
anova_spd_pooled(
data,
response,
main_plot,
sub_plot,
environment,
replication,
verbose = TRUE,
posthoc = "lsd",
alpha = 0.05
)
Arguments
data |
Data frame containing the combined data. |
response |
Name of the response variable. |
main_plot |
Name of the main-plot factor. |
sub_plot |
Name of the sub-plot factor. |
environment |
Name of the environment column. |
replication |
Name of the replication column (nested within environment; labels may repeat across environments). |
verbose |
Logical. If TRUE (default), prints the report. |
posthoc |
Method for the letters (default |
alpha |
Significance level. Default 0.05. |
Value
An object of class aridagri_spd_pooled with
anova_table, cv (by stratum), se_cd,
factor_means (with letters), main_means,
sub_means, env_means and model.
Author(s)
Lalit Kumar Rolaniya, ICAR-IIPR, Bikaner
Examples
data <- expand.grid(year = c("Y1", "Y2", "Y3"), rep = 1:3,
irrigation = c("I1", "I2", "I3"),
variety = c("V1", "V2", "V3", "V4"))
set.seed(7)
data$yield <- rnorm(nrow(data), 1200, 90)
res <- anova_spd_pooled(data, response = "yield", main_plot = "irrigation",
sub_plot = "variety", environment = "year",
replication = "rep", verbose = FALSE)
res$anova_table
Split-Split-Plot Design ANOVA
Description
Analysis of variance for a split-split-plot design with main-plot sources tested against Error(a), sub-plot sources against Error(b) and sub-sub-plot sources against Error(c). Gives CVs for the three strata, SEm, SEd and CD for every type of comparison (including those that mix error terms) and letter groupings.
Usage
anova_sspd(
data,
response,
main_plot,
sub_plot,
sub_sub_plot,
replication,
verbose = TRUE,
posthoc = "lsd",
alpha = 0.05
)
Arguments
data |
Data frame containing the experimental data. |
response |
Name of the response variable. |
main_plot |
Name of the main-plot factor (A). |
sub_plot |
Name of the sub-plot factor (B). |
sub_sub_plot |
Name of the sub-sub-plot factor (C). |
replication |
Name of the replication column. |
verbose |
Logical. If TRUE (default), prints the report. |
posthoc |
Method for the letters (default |
alpha |
Significance level. Default 0.05. |
Value
An object of class aridagri_sspd with the corrected
anova_table, cv, ms_error_a/b/c,
df_error_a/b/c, se_cd, factor_means,
letters, interaction_means and model.
Author(s)
Lalit Kumar Rolaniya, ICAR-IIPR, Bikaner
References
Gomez, K.A. and Gomez, A.A. (1984). Statistical Procedures for Agricultural Research, 2nd ed. John Wiley and Sons, New York.
Examples
data <- expand.grid(rep = 1:3, A = c("A1", "A2"), B = c("B1", "B2"),
C = c("C1", "C2", "C3"))
set.seed(6)
data$yield <- rnorm(nrow(data), 1200, 80)
res <- anova_sspd(data, response = "yield", main_plot = "A",
sub_plot = "B", sub_sub_plot = "C", replication = "rep")
Combined Split-Split-Plot Analysis over Environments
Description
Combined (pooled) analysis of a split-split-plot experiment repeated in
several environments, with environments fixed and replications random
within environments. See anova_spd_pooled.
Usage
anova_sspd_pooled(
data,
response,
main_plot,
sub_plot,
sub_sub_plot,
environment,
replication,
verbose = TRUE,
posthoc = "lsd",
alpha = 0.05
)
Arguments
data |
Data frame containing the combined data. |
response |
Name of the response variable. |
main_plot |
Name of the main-plot factor. |
sub_plot |
Name of the sub-plot factor. |
sub_sub_plot |
Name of the sub-sub-plot factor. |
environment |
Name of the environment column. |
replication |
Name of the replication column. |
verbose |
Logical. If TRUE (default), prints the report. |
posthoc |
Method for the letters (default |
alpha |
Significance level. Default 0.05. |
Value
An object of class aridagri_sspd_pooled; see
anova_spd_pooled. Also contains subsub_means.
Author(s)
Lalit Kumar Rolaniya, Ram Lal Jat, Monika Punia, Raja Ram Choudhary, Hemant Poonia
Examples
data <- expand.grid(env = c("E1", "E2"), rep = 1:3, A = c("A1", "A2"),
B = c("B1", "B2"), C = c("C1", "C2"))
set.seed(8)
data$yield <- rnorm(nrow(data), 1200, 90)
res <- anova_sspd_pooled(data, "yield", "A", "B", "C", "env", "rep",
verbose = FALSE)
res$anova_table
Strip-Plot (Strip-Block) Design ANOVA
Description
Analysis of variance for a strip-plot design, where factor A is applied to horizontal strips and factor B to vertical strips in each replication. A is tested against Error(a) = Rep x A, B against Error(b) = Rep x B, and A x B against Error(c). Gives CV(a), CV(b), CV(c), SEm, SEd and CD for the four standard comparisons, and letter groupings.
Usage
anova_strip(
data,
response,
horizontal_factor,
vertical_factor,
replication,
alpha = 0.05,
verbose = TRUE,
posthoc = "lsd"
)
Arguments
data |
Data frame containing the experimental data. |
response |
Name of the response variable. |
horizontal_factor |
Factor applied in horizontal strips (A). |
vertical_factor |
Factor applied in vertical strips (B). |
replication |
Name of the replication column. |
alpha |
Significance level. Default 0.05. |
verbose |
Logical. If TRUE (default), prints the report. |
posthoc |
Method for the letters (default |
Details
Standard errors of difference (Gomez and Gomez, 1984, table 3.15), with
a and b levels of A and B and r replications:
A means \sqrt{2E_a/(rb)}; B means \sqrt{2E_b/(ra)}; A means
at the same level of B \sqrt{2[(b-1)E_c + E_a]/(rb)}; B means at
the same level of A \sqrt{2[(a-1)E_c + E_b]/(ra)}. The last two
use the weighted t of Cochran and Cox.
Value
An object of class aridagri_strip with the corrected
anova_table, cv (a, b, c), error mean squares and df,
se_cd, horizontal_means and vertical_means (with
letters), interaction_means, letters and model.
Author(s)
Lalit Kumar Rolaniya, Ram Lal Jat, Monika Punia, Raja Ram Choudhary, Hemant Poonia
References
Gomez, K.A. and Gomez, A.A. (1984). Statistical Procedures for Agricultural Research, 2nd ed. John Wiley and Sons, New York.
Examples
data <- expand.grid(rep = 1:4, irrigation = c("I1", "I2", "I3"),
tillage = c("CT", "MT", "ZT"))
set.seed(9)
data$yield <- rnorm(nrow(data), 1200, 70)
anova_strip(data, response = "yield", horizontal_factor = "irrigation",
vertical_factor = "tillage", replication = "rep")
Publication Table of Treatment Means for Many Traits
Description
Runs the analysis of variance for several traits at once and assembles the table that agronomy journals and theses expect: treatment means followed by letters, then SEm, CD and CV for each trait (with "NS" when the F-test is not significant). Works for completely randomized, randomized block, two-factor factorial and split-plot designs.
Usage
anova_traits(
data,
traits,
design = c("rbd", "crd", "factorial", "spd"),
treatment = NULL,
block = NULL,
factor1 = NULL,
factor2 = NULL,
main_plot = NULL,
sub_plot = NULL,
posthoc = "lsd",
alpha = 0.05,
digits = 2,
letters_if_ns = FALSE,
verbose = TRUE
)
Arguments
data |
Data frame with one row per plot. |
traits |
Character vector of response columns. |
design |
One of |
treatment |
Treatment column (CRD and RBD). |
block |
Block (replication) column (RBD, factorial in blocks and split-plot). |
factor1, factor2 |
The two factors of a factorial design. |
main_plot, sub_plot |
Main-plot and sub-plot factors of a split-plot design. |
posthoc |
Method for the letters: |
alpha |
Significance level. Default 0.05. |
digits |
Decimal places for means, SEm and CD. A single number, or one per trait. Default 2. |
letters_if_ns |
Logical. If FALSE (default), letters are omitted when the F-test of that factor is not significant. |
verbose |
Logical. If TRUE (default), prints the table. |
Value
An object of class aridagri_traits with table
(character data frame ready to export), stats (F, p, SEm, SEd,
CD and CV for each trait and factor) and results (the full
analysis for each trait). Export with export_results.
Examples
data(mothbean_rbd)
tab <- anova_traits(mothbean_rbd,
traits = c("plant_height", "pods_per_plant",
"seed_yield", "harvest_index"),
design = "rbd", treatment = "treatment",
block = "block", posthoc = "duncan")
tab$table
data(clusterbean_spd)
anova_traits(clusterbean_spd, traits = c("seed_yield", "wue"),
design = "spd", main_plot = "irrigation",
sub_plot = "nitrogen", block = "rep")
Base-Graphics Plots for aridagri Results
Description
Quick plots with base graphics (no extra packages): bar charts of
treatment or factor means with their letters for ANOVA results, a
heatmap for correlation results and the integrated ranking for stability
results. For publication figures with ggplot2 see
plot_means and the plot() methods.
Usage
arid_plot(x, type = "bar", ...)
Arguments
x |
An object from an aridagri analysis function. |
type |
Kept for compatibility; bar charts are drawn. |
... |
Unused. |
Value
No return value; called for its side effect of drawing a plot.
Author(s)
Lalit Kumar Rolaniya, Ram Lal Jat, Monika Punia, Raja Ram Choudhary, Hemant Poonia
Examples
data(mothbean_rbd)
res <- anova_rbd(mothbean_rbd, "seed_yield", "treatment", "block",
verbose = FALSE)
arid_plot(res)
Check ANOVA Assumptions
Description
Checks the assumptions behind an analysis of variance: normality of residuals (Shapiro-Wilk), homogeneity of variances across treatments (Bartlett and Levene/Brown-Forsythe), additivity of block and treatment effects (Tukey's one-degree-of-freedom test, for two-way models), serial independence (Durbin-Watson, in data order) and outliers (studentized residuals).
Usage
check_assumptions(model, verbose = TRUE, factor = NULL, plot = FALSE)
Arguments
model |
A fitted |
verbose |
Logical. If TRUE (default), prints the results. |
factor |
Name(s) of the factor(s) defining the groups for the
variance tests. Default |
plot |
Logical. If TRUE, draws the four standard residual plots with base graphics. Default FALSE. |
Details
The variance tests use the model residuals, so block effects do not inflate the group variances. Levene's test is the Brown-Forsythe form (absolute deviations from the group median). Tukey's test for non-additivity adds the squared fitted values as a one-degree-of-freedom covariate to a model with two additive factors; a significant result suggests a transformation (Gomez and Gomez, 1984, ch. 7). The Durbin-Watson statistic is only meaningful when the rows are in field or time order.
Value
A list with shapiro, bartlett, levene,
nonadditivity (where applicable), durbin_watson,
outliers (row indices with |studentized residual| > 3) and
groups_factor.
References
Tukey, J.W. (1949). One degree of freedom for non-additivity. Biometrics, 5(3), 232-242. doi:10.2307/3001938
Brown, M.B. and Forsythe, A.B. (1974). Robust tests for the equality of variances. Journal of the American Statistical Association, 69(346), 364-367. doi:10.1080/01621459.1974.10482955
Examples
data(mothbean_rbd)
fit <- aov(seed_yield ~ block + treatment, data = mothbean_rbd)
check_assumptions(fit)
Chickpea Germplasm Evaluation (Augmented RCBD, Simulated)
Description
Simulated augmented randomized complete block design with 48 chickpea accessions (tested once) and four checks replicated in each of six blocks.
Usage
chickpea_augmented
Format
A data frame with 72 rows and 4 variables:
- block
Factor, block (B1-B6).
- entry
Factor, checks C1-C4 and accessions IC-001 to IC-048.
- seed_yield
Seed yield (kg/ha).
- plant_height
Plant height (cm).
Source
Simulated with data-raw/make_datasets.R (seed 2026).
Not real experimental data.
Examples
data(chickpea_augmented)
anova_augmented(chickpea_augmented, "seed_yield", "entry", "block",
check_names = c("C1", "C2", "C3", "C4"))
Cluster Bean Irrigation x Nitrogen Trial (Split Plot, Simulated)
Description
Simulated split-plot experiment on cluster bean (Cyamopsis tetragonoloba) with three irrigation levels in main plots and four nitrogen levels in sub-plots, in three replications.
Usage
clusterbean_spd
Format
A data frame with 36 rows and 7 variables:
- rep
Factor, replication (R1-R3).
- irrigation
Factor, main-plot irrigation level.
- nitrogen
Factor, sub-plot nitrogen level (kg N/ha; foliar = additional 2% urea spray).
- seed_yield
Seed yield (kg/ha).
- water_use
Seasonal water use (mm).
- wue
Water use efficiency (kg/ha per mm).
- stover_yield
Stover yield (kg/ha).
Source
Simulated with data-raw/make_datasets.R (seed 2026).
Not real experimental data.
Examples
data(clusterbean_spd)
anova_spd(clusterbean_spd, "seed_yield", "irrigation", "nitrogen", "rep")
Mean Separation from Summary Statistics
Description
Assigns significance letters to treatment means when only the means,
the error mean square and its degrees of freedom are available (for
example from a published table or from another program). Uses the same
tests as perform_posthoc.
Usage
compare_means(
means,
mse,
df_error,
reps,
method = "lsd",
alpha = 0.05,
verbose = TRUE
)
Arguments
means |
Named numeric vector of treatment means. |
mse |
Error mean square from the ANOVA. |
df_error |
Error degrees of freedom. |
reps |
Number of replications per mean: a single number or a vector with one value per mean. |
method |
One of |
alpha |
Significance level. Default 0.05. |
verbose |
Logical. If TRUE (default), prints the table. |
Value
The comparison object described in
perform_posthoc: groups, table,
comparisons, critical_range and statistics.
Examples
m <- c(T1 = 1180, T2 = 1265, T3 = 1342, T4 = 1410, T5 = 1238)
compare_means(m, mse = 3600, df_error = 12, reps = 4, method = "duncan")
Correlation Analysis with Significance
Description
Computes correlation matrix with significance levels and generates publication-ready correlation table and plot.
Usage
correlation_analysis(
data,
method = "pearson",
plot = TRUE,
digits = 3,
verbose = TRUE
)
Arguments
data |
Data frame with numeric variables |
method |
Correlation method: "pearson", "spearman", or "kendall" |
plot |
Logical, whether to generate correlation plot |
digits |
Number of decimal places |
verbose |
Logical. If TRUE (default), prints formatted output to console. |
Value
List with correlation matrix and significance matrix
Author(s)
Lalit Kumar Rolaniya, ICAR-IIPR, Bikaner
Examples
data <- data.frame(
yield = c(1200, 1350, 1100, 1450, 1280),
wue = c(4.2, 4.8, 3.9, 5.1, 4.5),
protein = c(22.1, 23.5, 21.8, 24.2, 22.9)
)
correlation_analysis(data)
Cowpea Genotype Trial (Alpha Lattice, Simulated)
Description
Simulated alpha lattice trial of 24 cowpea genotypes in three
replications, each with six incomplete blocks of four plots. The layout
was generated with agricolae::design.alpha().
Usage
cowpea_alpha
Format
A data frame with 72 rows and 5 variables:
- rep
Factor, replication (1-3).
- block
Factor, incomplete block within replication (1-6).
- plot
Plot number.
- genotype
Factor, genotype code (CP-01 to CP-24).
- grain_yield
Grain yield (kg/ha).
Source
Simulated with data-raw/make_datasets.R (seed 2026).
Not real experimental data.
Examples
data(cowpea_alpha)
anova_alpha_lattice(cowpea_alpha, "grain_yield", "genotype", "rep",
"block")
Crop Growth Analysis (CGR, RGR, NAR, LAI, LAD)
Description
Classical growth analysis from sequential harvests: crop growth rate, relative growth rate, net assimilation rate, leaf area index and leaf area duration for each interval between samplings.
Usage
crop_growth_analysis(
dry_weight,
leaf_area = NULL,
days,
verbose = TRUE,
ground_area = NULL
)
Arguments
dry_weight |
Dry matter at each sampling (g per sample). |
leaf_area |
Leaf area at each sampling (cm2 per sample), or
|
days |
Days after sowing at each sampling (strictly increasing). |
verbose |
Logical. If TRUE (default), prints the table. |
ground_area |
Land area occupied by each sample (m2). When given,
CGR is expressed in g m-2 day-1 and LAI = leaf area / ground area.
When |
Details
For two samplings at t_1 and t_2 (Watson, 1952;
Radford, 1967):
CGR =
(W_2 - W_1) / [P (t_2 - t_1)], P = ground areaRGR =
(\ln W_2 - \ln W_1) / (t_2 - t_1)(g g-1 day-1)NAR =
\frac{W_2 - W_1}{t_2 - t_1} \times \frac{\ln L_2 - \ln L_1}{L_2 - L_1}, reported in g m-2 (leaf) day-1LAD =
(LAI_1 + LAI_2)(t_2 - t_1) / 2(days)
Value
A data frame of class aridagri_growth with one row per
interval: Period, CGR, RGR and, with leaf area,
NAR, LAI_start, LAI_end and LAD.
Author(s)
Lalit Kumar Rolaniya, Ram Lal Jat, Monika Punia, Raja Ram Choudhary, Hemant Poonia
References
Radford, P.J. (1967). Growth analysis formulae: their use and abuse. Crop Science, 7(3), 171-175. doi:10.2135/cropsci1967.0011183X000700030001x
Watson, D.J. (1952). The physiological basis of variation in yield. Advances in Agronomy, 4, 101-145. doi:10.1016/S0065-2113(08)60307-7
Examples
dry_weight <- c(0.5, 2.1, 8.5, 25, 45, 62, 75)
leaf_area <- c(15, 85, 350, 800, 950, 850, 600)
days <- c(15, 30, 45, 60, 75, 90, 105)
crop_growth_analysis(dry_weight, leaf_area, days, ground_area = 0.09)
Day Length from Latitude and Date
Description
Maximum possible daylight hours (astronomical day length) from latitude and day of year, following FAO Irrigation and Drainage Paper 56 (equations 24, 25 and 34). Useful for photo-thermal units when measured day length is not available.
Usage
day_length(latitude, date)
Arguments
latitude |
Latitude in decimal degrees (north positive). |
date |
A |
Value
Numeric vector of day length in hours.
References
Allen, R.G., Pereira, L.S., Raes, D. and Smith, M. (1998). Crop Evapotranspiration: Guidelines for Computing Crop Water Requirements. FAO Irrigation and Drainage Paper 56. FAO, Rome.
Examples
# Bikaner (28.0 N) on 15 March and 15 June
day_length(28.0, as.Date(c("2026-03-15", "2026-06-15")))
Economic Analysis of a Crop
Description
Cost of cultivation, gross and net returns, benefit-cost ratio and cost of production. Arguments may be vectors (one value per treatment).
Usage
economic_analysis(
yield,
price,
cost_fixed,
cost_variable,
byproduct_yield = 0,
byproduct_price = 0,
verbose = TRUE
)
Arguments
yield |
Crop yield (kg/ha). |
price |
Market price (Rs/kg). |
cost_fixed |
Fixed costs (Rs/ha). |
cost_variable |
Variable costs (Rs/ha). |
byproduct_yield |
By-product yield (kg/ha), default 0. |
byproduct_price |
By-product price (Rs/kg), default 0. |
verbose |
Logical. If TRUE (default), prints the table. |
Value
A data frame of class aridagri_economics.
Author(s)
Lalit Kumar Rolaniya, ICAR-IIPR, Bikaner
Examples
economic_analysis(yield = 1200, price = 65, cost_fixed = 15000,
cost_variable = 12000)
economic_analysis(yield = c(1050, 1200, 1340), price = 65,
cost_fixed = 15000, cost_variable = c(11000, 12000, 13500),
byproduct_yield = c(1600, 1800, 1950), byproduct_price = 5)
Economic Efficiency Indices (B:C Ratio)
Description
Net return, benefit-cost ratio and return per rupee invested from gross return and total cost.
Usage
economic_indices(gross_return, total_cost, verbose = TRUE)
Arguments
gross_return |
Gross return (Rs/ha). |
total_cost |
Total cost of cultivation (Rs/ha). |
verbose |
Logical. If TRUE (default), prints the table. |
Value
A data frame of class aridagri_economics with
Net_Return, BC_Ratio (gross return / cost) and
Return_per_Rupee (net return / cost).
Author(s)
Lalit Kumar Rolaniya, Ram Lal Jat, Monika Punia, Raja Ram Choudhary, Hemant Poonia
Examples
economic_indices(gross_return = c(75000, 82000), total_cost = c(35000, 38000))
Export Results to Excel or CSV
Description
Writes the main tables of an aridagri result to an Excel workbook (one
sheet per table) or a CSV file. Multi-trait tables from
anova_traits are written as they appear in the report.
Usage
export_results(x, file, format = "xlsx", digits = 3, verbose = TRUE)
Arguments
x |
An aridagri result object or a data frame. |
file |
Output file path. |
format |
|
digits |
Number of decimal places for numeric columns. |
verbose |
Logical. If TRUE (default), prints the file name. |
Value
Invisibly returns the file path.
Author(s)
Lalit Kumar Rolaniya, Ram Lal Jat, Monika Punia, Raja Ram Choudhary, Hemant Poonia
Examples
data(mothbean_rbd)
res <- anova_rbd(mothbean_rbd, "seed_yield", "treatment", "block",
verbose = FALSE)
export_results(res, tempfile(fileext = ".csv"), format = "csv")
GGE Biplot Analysis (Which-Won-Where and Mean vs Stability)
Description
Genotype plus genotype-by-environment (GGE) biplot analysis of a multi-environment trial (Yan et al., 2000). Gives the genotype and environment scores on the first two principal components, the winning genotype in each environment and the resulting mega-environments (which-won-where), and the average-environment coordination (AEC) ranking of genotypes for mean performance and stability.
Usage
gge_biplot(
data,
genotype,
environment,
trait,
scaling = c("none", "sd"),
svp = c("symmetric", "genotype", "environment"),
verbose = TRUE
)
Arguments
data |
Data frame with genotype, environment and trait columns (plot data or genotype x environment means). |
genotype |
Name of the genotype column. |
environment |
Name of the environment column. |
trait |
Name of the trait column. |
scaling |
|
svp |
Singular value partitioning: |
verbose |
Logical. If TRUE (default), prints a summary. |
Details
The genotype x environment table of means is centred on the environment
means (and optionally scaled) and decomposed by singular value
decomposition. With singular values d_k, genotype scores are
u_{ik} d_k^f and environment scores v_{jk} d_k^{1-f}, with
f = 0.5, 1, 0 for symmetric, genotype- and environment-focused
partitioning. The winner in an environment is the genotype with the
highest value predicted by the two-component biplot; environments with
the same winner form a mega-environment. On the AEC view the abscissa
(projection on the average-environment axis) ranks mean performance
and the ordinate (distance from that axis) measures instability.
Value
An object of class aridagri_gge with
genotype_scores, environment_scores,
variance_percent, which_won_where (environment and
winner), mega_environments, aec (genotype AEC abscissa,
ordinate and ranks) and the settings used. Plot it with
plot().
References
Yan, W., Hunt, L.A., Sheng, Q. and Szlavnics, Z. (2000). Cultivar evaluation and mega-environment investigation based on the GGE biplot. Crop Science, 40(3), 597-605. doi:10.2135/cropsci2000.403597x
Yan, W. and Kang, M.S. (2003). GGE Biplot Analysis: A Graphical Tool for Breeders, Geneticists, and Agronomists. CRC Press, Boca Raton.
Examples
data(pearlmillet_met)
gg <- gge_biplot(pearlmillet_met, "genotype", "environment", "grain_yield")
gg$which_won_where
if (requireNamespace("ggplot2", quietly = TRUE)) {
plot(gg, type = "which_won_where")
}
Harvest Index
Description
Harvest index and grain-to-straw ratio.
Usage
harvest_index(grain_yield, straw_yield, verbose = TRUE)
Arguments
grain_yield |
Grain (economic) yield. |
straw_yield |
Straw (stover) yield, in the same unit. |
verbose |
Logical. If TRUE (default), prints the table. |
Value
A data frame of class aridagri_hi with grain, straw and
total biomass, HI_percent and Grain_Straw_Ratio.
Author(s)
Lalit Kumar Rolaniya, Ram Lal Jat, Monika Punia, Raja Ram Choudhary, Hemant Poonia
Examples
harvest_index(grain_yield = c(1200, 1350, 1100),
straw_yield = c(2400, 2500, 2300))
Package imports
Description
Package imports
Moth Bean Nutrient Management Trial (RCBD, Simulated)
Description
Simulated randomized complete block experiment on moth bean (Vigna aconitifolia) with eight nutrient management treatments in four blocks and eight traits.
Usage
mothbean_rbd
Format
A data frame with 32 rows and 10 variables:
- block
Factor, block (R1-R4).
- treatment
Factor, eight treatments (control, recommended dose of fertilizer (RDF), and RDF with biofertilizers, FYM, sulphur or zinc).
- seed_yield
Seed yield (kg/ha).
- plant_height
Plant height at harvest (cm).
- branches_per_plant
Branches per plant.
- pods_per_plant
Pods per plant.
- seeds_per_pod
Seeds per pod.
- test_weight
1000-seed weight (g).
- stover_yield
Stover yield (kg/ha).
- harvest_index
Harvest index (%).
Source
Simulated with data-raw/make_datasets.R (seed 2026).
Not real experimental data.
Examples
data(mothbean_rbd)
anova_rbd(mothbean_rbd, "seed_yield", "treatment", "block")
Mung Bean Chlorophyll over Time (Repeated Measures, Simulated)
Description
Simulated repeated measurements of leaf chlorophyll (SPAD) on the same plots at 25, 35, 45 and 55 days after sowing, for four foliar spray treatments in four randomized complete blocks. Errors within a plot follow a first-order autoregressive process.
Usage
mungbean_repeated
Format
A data frame with 64 rows and 5 variables:
- block
Factor, block (R1-R4).
- treatment
Factor, foliar spray treatment.
- das
Days after sowing (25, 35, 45, 55).
- plot
Factor, plot identifier (block-treatment).
- spad
SPAD chlorophyll meter reading.
Source
Simulated with data-raw/make_datasets.R (seed 2026).
Not real experimental data.
Examples
data(mungbean_repeated)
anova_repeated(mungbean_repeated, "spad", "treatment", "das",
block = "block")
Nutrient Use Efficiency Indices
Description
Agronomic efficiency (AE), partial factor productivity (PFP), apparent recovery efficiency (ARE), physiological efficiency (PE), internal utilization efficiency (IE) and, when biomass is given, the biomass-based physiological efficiency and utilization efficiency of Fageria and Baligar (2005). All arguments may be vectors (one value per treatment).
Usage
nue_calculate(
yield_fertilized,
yield_control,
nutrient_applied,
nutrient_uptake_fert = NULL,
nutrient_uptake_ctrl = NULL,
biomass_fert = NULL,
biomass_ctrl = NULL,
verbose = TRUE
)
Arguments
yield_fertilized |
Grain yield with the nutrient (kg/ha). |
yield_control |
Grain yield of the control without the nutrient (kg/ha). |
nutrient_applied |
Nutrient applied (kg/ha), greater than 0. |
nutrient_uptake_fert |
Total nutrient uptake with the nutrient (kg/ha), optional. |
nutrient_uptake_ctrl |
Total nutrient uptake of the control (kg/ha), optional. |
biomass_fert |
Total biomass with the nutrient (kg/ha), optional. |
biomass_ctrl |
Total biomass of the control (kg/ha), optional. |
verbose |
Logical. If TRUE (default), prints the table. |
Details
AE = (Yf - Yc) / N (kg grain per kg nutrient)
PFP = Yf / N
ARE = 100 (Uf - Uc) / N (percent)
PE = (Yf - Yc) / (Uf - Uc) (kg grain per kg nutrient taken up; called agro-physiological efficiency by Fageria and Baligar)
IE = Yf / Uf
PE_biomass = (Bf - Bc) / (Uf - Uc) and UE = PE_biomass x ARE / 100 (Fageria and Baligar, 2005)
AE = PE x ARE / 100 holds by definition. PE is not computed when the uptake difference is zero or negative.
Value
A data frame of class aridagri_nue.
Author(s)
Lalit Kumar Rolaniya, ICAR-IIPR, Bikaner
References
Dobermann, A. (2005). Nitrogen use efficiency - state of the art. IFA International Workshop on Enhanced-Efficiency Fertilizers, Frankfurt.
Fageria, N.K. and Baligar, V.C. (2005). Enhancing nitrogen use efficiency in crop plants. Advances in Agronomy, 88, 97-185. doi:10.1016/S0065-2113(05)88004-6
Examples
nue_calculate(yield_fertilized = 1850, yield_control = 1200,
nutrient_applied = 40)
# Several N doses with uptake and biomass
nue_calculate(yield_fertilized = c(1450, 1720, 1850),
yield_control = 1200, nutrient_applied = c(20, 40, 60),
nutrient_uptake_fert = c(48, 61, 68),
nutrient_uptake_ctrl = 35,
biomass_fert = c(4300, 4950, 5300), biomass_ctrl = 3600)
Nutrient Response Curves and Economic Optimum Dose
Description
Fits nutrient response models and finds the dose for maximum yield and
the economic optimum dose, where the marginal return equals the price
ratio. Quadratic, linear-plateau, quadratic-plateau and Mitscherlich
models are available; model = "all" fits all four and compares
them.
Usage
nutrient_response(
dose,
yield,
model = "quadratic",
price_output = 50,
price_nutrient = 15,
verbose = TRUE
)
Arguments
dose |
Numeric vector of nutrient doses (kg/ha). |
yield |
Numeric vector of yields (kg/ha), one per dose (replicated doses are allowed). |
model |
|
price_output |
Price of the produce (Rs/kg). |
price_nutrient |
Price of the nutrient (Rs/kg of nutrient). |
verbose |
Logical. If TRUE (default), prints the results. |
Details
Quadratic:
Y = a + bX + cX^2; maximum at-b/(2c); economic optimum(P_n/P_y - b)/(2c).Linear-plateau:
Y = a + b \min(X, X_0); economic optimum at the join pointX_0whenb > P_n/P_y.Quadratic-plateau: quadratic up to its vertex
X_0, then flat.Mitscherlich:
Y = A - B e^{-cX}; economic optimum\ln(B c P_y / P_n)/c; also the dose giving 95% of the asymptote.
Plateau models are fitted by profile least squares over the join
point; the Mitscherlich model by nls with a self-starting model.
All four models have three parameters (the join point counts as one), so
they are compared by R-squared, adjusted R-squared, RMSE and AIC on an
equal footing (AIC differences equal those of stats::AIC()). An
optimum beyond the highest dose tested is flagged as an extrapolation.
Value
For a single model, an object of class aridagri_response
with model, coefficients, r_squared,
adj_r_squared, rmse, aic, dose_max_yield,
max_yield, dose_economic, yield_economic and
fit. For model = "all", a list with comparison
(one row per model), models and best (lowest AIC).
Author(s)
Lalit Kumar Rolaniya, ICAR-IIPR, Bikaner
References
Cerrato, M.E. and Blackmer, A.M. (1990). Comparison of models for describing corn yield response to nitrogen fertilizer. Agronomy Journal, 82(1), 138-143. doi:10.2134/agronj1990.00021962008200010030x
Examples
dose <- c(0, 20, 40, 60, 80, 100)
yield <- c(1100, 1350, 1520, 1610, 1650, 1660)
nutrient_response(dose, yield, model = "quadratic",
price_output = 60, price_nutrient = 15)
nutrient_response(dose, yield, model = "all", price_output = 60,
price_nutrient = 15)
Path Coefficient Analysis
Description
Performs path analysis to determine direct and indirect effects of independent variables on a dependent variable. Essential for understanding yield contributing factors.
Usage
path_analysis(data, dependent, independent, digits = 4, verbose = TRUE)
Arguments
data |
Data frame with numeric variables |
dependent |
Name of dependent variable (e.g., "yield") |
independent |
Character vector of independent variable names |
digits |
Number of decimal places |
verbose |
Logical. If TRUE (default), prints formatted output to console. |
Value
List with direct effects, indirect effects, and correlation breakdown
Author(s)
Lalit Kumar Rolaniya, ICAR-IIPR, Bikaner
Examples
data <- data.frame(
yield = c(1200, 1350, 1100, 1450, 1280, 1380, 1220, 1400),
pods = c(45, 52, 42, 58, 48, 54, 46, 56),
seeds = c(8.2, 9.1, 7.8, 9.5, 8.5, 9.0, 8.3, 9.3),
weight = c(32, 35, 30, 38, 33, 36, 31, 37)
)
path_analysis(data, dependent = "yield",
independent = c("pods", "seeds", "weight"))
Principal Component Analysis
Description
Performs PCA with visualization suitable for agricultural research data. Includes scree plot, biplot, and variable contributions.
Usage
pca_analysis(data, scale = TRUE, ncp = 5, plot = TRUE, verbose = TRUE)
Arguments
data |
Data frame with numeric variables |
scale |
Logical, whether to scale variables (default TRUE) |
ncp |
Number of components to retain (default 5) |
plot |
Logical, whether to generate plots |
verbose |
Logical. If TRUE (default), prints formatted output to console. |
Value
PCA results with eigenvalues, loadings, and scores
Author(s)
Lalit Kumar Rolaniya, ICAR-IIPR, Bikaner
Examples
data <- data.frame(
yield = rnorm(30, 1200, 200),
wue = rnorm(30, 4.5, 0.5),
protein = rnorm(30, 22, 2),
biomass = rnorm(30, 3500, 500)
)
pca_analysis(data)
Pearl Millet Multi-Environment Trial (Simulated)
Description
Simulated trial of ten pearl millet genotypes in six environments (three locations x two years) with three replications, for stability and GGE biplot analysis.
Usage
pearlmillet_met
Format
A data frame with 180 rows and 5 variables:
- environment
Factor, location-year (BKN = Bikaner, JDH = Jodhpur, JSM = Jaisalmer).
- rep
Factor, replication within environment.
- genotype
Factor, genotype code (PM-01 to PM-10).
- grain_yield
Grain yield (kg/ha).
- days_to_maturity
Days to maturity.
Source
Simulated with data-raw/make_datasets.R (seed 2026).
Not real experimental data.
Examples
data(pearlmillet_met)
stability_analysis(pearlmillet_met, "genotype", "environment", "rep",
"grain_yield", method = "eberhart")
Post-Hoc Mean Comparisons After ANOVA
Description
Compares treatment means after an analysis of variance and returns compact letter displays (means sharing a letter do not differ). Fisher's LSD, Duncan's multiple range test (DMRT), Tukey's HSD, Student-Newman-Keuls, Scheffe and Bonferroni are computed inside the package, so no extra package is needed. Dunnett's test against a control uses multcomp when it is installed.
Usage
perform_posthoc(
model,
data,
response,
treatment,
mse = NULL,
df_error = NULL,
posthoc = "lsd",
alpha = 0.05,
control = NULL,
verbose = TRUE
)
Arguments
model |
A fitted |
data |
Data frame used to fit the model. Kept for compatibility; the model frame is used for the calculations. |
response |
Name of the response variable (used to label output). |
treatment |
Name of the treatment factor in the model. |
mse |
Error mean square. Default |
df_error |
Error degrees of freedom matching |
posthoc |
Method(s): |
alpha |
Significance level. Default 0.05. |
control |
Control level for Dunnett's test. Default |
verbose |
Logical. If TRUE (default), prints the results. |
Details
Means are least-squares means of the treatment factor averaged over the other factors in the model. With complete, balanced data they equal the arithmetic means. With missing plots or unequal replication every pair is tested with its own standard error of difference, so the letters stay exact (Tukey-Kramer form for the range tests).
Duncan's and the Student-Newman-Keuls tests use the studentized range
for the number of means spanned by each pair, with the protection level
1 - (1 - \alpha)^{p - 1} for Duncan's test, and apply the closure
rule: two means are declared different only if every range of means
containing them is also significant (Duncan, 1955). The p-value reported
for a pair is the largest p-value of the ranges containing it, so it
agrees with the letters.
Least-squares means that cannot be estimated (for example a level whose
cells are all empty in a model with interactions) are left out with a
warning. Dunnett's test averages differences over interacting factors
and uses mse and df_error when they are supplied.
Letters are assigned with the insert-and-absorb algorithm of Piepho (2004), which gives a valid display for any pattern of significant pairs. The group containing the highest mean gets the letter "a".
Value
A list with one element per method. Each element contains
groups (means and letters, ordered from highest to lowest, with
treatments as row names), table (level, mean, SE, letter,
replications), comparisons (all pairwise differences with
their SE, p-value and significance), critical_range and
statistics. The Dunnett element is a data frame of comparisons
with the control.
References
Duncan, D.B. (1955). Multiple range and multiple F tests. Biometrics, 11(1), 1-42. doi:10.2307/3001478
Piepho, H.-P. (2004). An algorithm for a letter-based representation of all-pairwise comparisons. Journal of Computational and Graphical Statistics, 13(2), 456-466. doi:10.1198/1061860043515
Kramer, C.Y. (1956). Extension of multiple range tests to group means with unequal numbers of replications. Biometrics, 12(3), 307-310. doi:10.2307/3001469
See Also
compare_means for summary statistics,
anova_rbd.
Examples
data(mothbean_rbd)
fit <- aov(seed_yield ~ block + treatment, data = mothbean_rbd)
ph <- perform_posthoc(fit, mothbean_rbd, response = "seed_yield",
treatment = "treatment", posthoc = c("lsd", "duncan"))
ph$duncan$groups
Plot Methods for aridagri Results
Description
plot() methods that draw the standard publication figure for each
kind of result with ggplot2: a bar chart of means with letters
(CRD, RCBD, Latin square, pooled RCBD, alpha lattice, augmented), an
interaction plot or bar chart (factorial and split-plot designs), a
time course (repeated measures) or a stability plot. For base graphics
without ggplot2, use arid_plot.
Usage
## S3 method for class 'aridagri_anova'
plot(x, ...)
## S3 method for class 'aridagri_pooled'
plot(x, ...)
## S3 method for class 'aridagri_alpha'
plot(x, ...)
## S3 method for class 'aridagri_augmented'
plot(x, ...)
## S3 method for class 'aridagri_factorial'
plot(x, type = c("interaction", "means"), ...)
## S3 method for class 'aridagri_split'
plot(x, type = c("interaction", "means"), ...)
## S3 method for class 'aridagri_strip'
plot(x, ...)
## S3 method for class 'aridagri_repeated'
plot(x, ...)
## S3 method for class 'aridagri_stability'
plot(x, type = c("eberhart", "ammi1", "ammi2"), ...)
Arguments
x |
A result object. |
... |
Passed to |
type |
For factorial and split-plot results: |
Value
A ggplot2 object.
Examples
if (requireNamespace("ggplot2", quietly = TRUE)) {
data(mothbean_rbd)
res <- anova_rbd(mothbean_rbd, "seed_yield", "treatment", "block",
verbose = FALSE)
plot(res)
}
Plot Method for GGE Biplot Results
Description
Plot Method for GGE Biplot Results
Usage
## S3 method for class 'aridagri_gge'
plot(
x,
type = c("which_won_where", "mean_stability", "basic"),
title = NULL,
...
)
Arguments
x |
An object of class |
type |
|
title |
Plot title. |
... |
Unused. |
Value
A ggplot2 object.
Interaction Plot of Two Factors
Description
Line chart of the means of every combination of two factors, with the
first factor on the x-axis and one line per level of the second factor.
Works with anova_factorial, anova_spd and
the other split-plot functions (first two factors, or the two named in
factors), anova_strip and
anova_repeated (time course).
Usage
plot_interaction(x, factors = NULL, title = NULL, ylab = NULL)
Arguments
x |
A result object. |
factors |
Optional character vector of two factor names (split-plot results with more than two factors). |
title |
Plot title. |
ylab |
Y-axis label. |
Value
A ggplot2 object.
Examples
if (requireNamespace("ggplot2", quietly = TRUE)) {
data(clusterbean_spd)
res <- anova_spd(clusterbean_spd, "seed_yield", "irrigation",
"nitrogen", "rep", verbose = FALSE)
plot_interaction(res, ylab = "Seed yield (kg/ha)")
}
Bar Chart of Treatment Means with Letters
Description
Publication-ready bar chart of treatment means with standard-error bars
and the letter groupings from an aridagri analysis. Works with the
results of anova_crd, anova_rbd,
anova_latin, anova_rbd_pooled,
anova_factorial (one factor or the combinations),
anova_spd and the other split-plot functions (one factor),
anova_alpha_lattice and anova_augmented
(adjusted means).
Usage
plot_means(
x,
which = NULL,
sort = TRUE,
top = 20,
title = NULL,
ylab = NULL,
horizontal = NULL
)
Arguments
x |
A result object from one of the functions above. |
which |
For factorial and split-plot results, the factor to plot
(name), or |
sort |
Logical. Order bars from highest to lowest mean. Default TRUE. |
top |
For alpha lattice and augmented results, the number of entries to show. Default 20. |
title |
Plot title. Default: the response name. |
ylab |
Y-axis label. Default: the response name. |
horizontal |
Logical. Draw horizontal bars. Default |
Value
A ggplot2 object.
Examples
if (requireNamespace("ggplot2", quietly = TRUE)) {
data(mothbean_rbd)
res <- anova_rbd(mothbean_rbd, "seed_yield", "treatment", "block",
posthoc = "duncan", verbose = FALSE)
plot_means(res, ylab = "Seed yield (kg/ha)")
}
Plot a Nutrient Response Curve
Description
Observed yields and the fitted response curve(s) from
nutrient_response, with the economic optimum dose marked.
Usage
plot_response(x, dose, yield, title = NULL)
Arguments
x |
An object of class |
dose, yield |
The data used to fit the model. |
title |
Plot title. |
Value
A ggplot2 object.
Examples
if (requireNamespace("ggplot2", quietly = TRUE)) {
dose <- c(0, 20, 40, 60, 80, 100)
yield <- c(1100, 1350, 1520, 1610, 1650, 1660)
nr <- nutrient_response(dose, yield, model = "all", verbose = FALSE)
plot_response(nr, dose, yield)
}
Stability Plots for Multi-Environment Trials
Description
Figures for stability_analysis results:
-
"eberhart": genotype mean against the regression coefficientb_i, with reference lines at the grand mean andb_i = 1. -
"ammi1": AMMI1 biplot of mean against IPCA1 scores for genotypes and environments. -
"ammi2": AMMI2 biplot of IPCA1 against IPCA2, with environments as vectors.
Usage
plot_stability(x, type = c("eberhart", "ammi1", "ammi2"), title = NULL)
Arguments
x |
An object of class |
type |
|
title |
Plot title. |
Value
A ggplot2 object.
Examples
if (requireNamespace("ggplot2", quietly = TRUE)) {
data(pearlmillet_met)
st <- stability_analysis(pearlmillet_met, "genotype", "environment",
"rep", "grain_yield", verbose = FALSE)
plot_stability(st, "eberhart")
plot_stability(st, "ammi2")
}
Print Method for Alpha Lattice Results
Description
Print Method for Alpha Lattice Results
Usage
## S3 method for class 'aridagri_alpha'
print(x, digits = 2, n = 15, ...)
Arguments
x |
An object of class |
digits |
Number of decimal places for means. Default 2. |
n |
Number of genotypes to show. Default 15. |
... |
Unused. |
Value
Invisibly returns x.
Print Method for CRD and RCBD Results
Description
Print Method for CRD and RCBD Results
Usage
## S3 method for class 'aridagri_anova'
print(x, digits = 2, ...)
## S3 method for class 'aridagri_latin'
print(x, digits = 2, ...)
Arguments
x |
An object of class |
digits |
Number of decimal places for means. Default 2. |
... |
Unused. |
Value
Invisibly returns x. Called for its side effect of
printing the ANOVA report.
Print Method for Augmented Design Results
Description
Print Method for Augmented Design Results
Usage
## S3 method for class 'aridagri_augmented'
print(x, digits = 2, n = 10, ...)
Arguments
x |
An object of class |
digits |
Number of decimal places for means. Default 2. |
n |
Number of top test entries to show. Default 10. |
... |
Unused. |
Value
Invisibly returns x.
Print Methods for Factorial Results
Description
Print Methods for Factorial Results
Usage
## S3 method for class 'aridagri_factorial'
print(x, digits = 2, ...)
## S3 method for class 'aridagri_factorial3'
print(x, digits = 2, ...)
Arguments
x |
An object of class |
digits |
Number of decimal places for means. Default 2. |
... |
Unused. |
Value
Invisibly returns x.
Print Method for GGE Biplot Results
Description
Print Method for GGE Biplot Results
Usage
## S3 method for class 'aridagri_gge'
print(x, ...)
Arguments
x |
An object of class |
... |
Unused. |
Value
Invisibly returns x.
Print Method for PCA Results
Description
Prints the number of components retained and the variance they explain.
Usage
## S3 method for class 'aridagri_pca'
print(x, ...)
Arguments
x |
An object of class |
... |
Additional arguments (unused). |
Value
The input object, invisibly.
Print Method for Combined RCBD Analysis
Description
Print Method for Combined RCBD Analysis
Usage
## S3 method for class 'aridagri_pooled'
print(x, digits = 2, ...)
Arguments
x |
An object of class |
digits |
Number of decimal places for means. Default 2. |
... |
Unused. |
Value
Invisibly returns x.
Print Method for Repeated Measures Results
Description
Print Method for Repeated Measures Results
Usage
## S3 method for class 'aridagri_repeated'
print(x, digits = 2, ...)
Arguments
x |
An object of class |
digits |
Number of decimal places for means. Default 2. |
... |
Unused. |
Value
Invisibly returns x.
Print Methods for Nutrient Response Results
Description
Print Methods for Nutrient Response Results
Usage
## S3 method for class 'aridagri_response'
print(x, ...)
## S3 method for class 'aridagri_response_set'
print(x, ...)
Arguments
x |
An object of class |
... |
Unused. |
Value
Invisibly returns x.
Print Method for Stability Analysis
Description
Print Method for Stability Analysis
Usage
## S3 method for class 'aridagri_stability'
print(x, digits = 3, ...)
Arguments
x |
An object of class |
digits |
Number of decimal places. Default 3. |
... |
Unused. |
Value
Invisibly returns x.
Print Method for Split-Plot Family Results
Description
Print Method for Split-Plot Family Results
Usage
## S3 method for class 'aridagri_strip'
print(x, digits = 2, ...)
## S3 method for class 'aridagri_split'
print(x, digits = 2, ...)
## S3 method for class 'aridagri_split_pooled'
print(x, digits = 2, ...)
Arguments
x |
A result from |
digits |
Number of decimal places for means. Default 2. |
... |
Unused. |
Value
Invisibly returns x.
Print Method for Multi-Trait Tables
Description
Print Method for Multi-Trait Tables
Usage
## S3 method for class 'aridagri_traits'
print(x, ...)
Arguments
x |
An object of class |
... |
Unused. |
Value
Invisibly returns x.
Structural Equation Modeling for Field Experiments
Description
Performs SEM analysis for agricultural field experiments. Allows testing of hypothesized causal relationships among variables.
Usage
sem_analysis(data, model, plot = TRUE, verbose = TRUE)
Arguments
data |
Data frame with variables |
model |
Model specification in lavaan syntax |
plot |
Logical, whether to generate path diagram |
verbose |
Logical. If TRUE (default), prints formatted output to console. |
Value
SEM results including fit indices and parameter estimates
Author(s)
Lalit Kumar Rolaniya, ICAR-IIPR, Bikaner
Examples
if (requireNamespace("lavaan", quietly = TRUE)) {
set.seed(42)
n <- 100
nitrogen <- rnorm(n, 60, 10)
phosphorus <- rnorm(n, 30, 5)
yield <- 0.5 * nitrogen + 0.3 * phosphorus + rnorm(n, 0, 5)
df <- data.frame(yield = yield, nitrogen = nitrogen, phosphorus = phosphorus)
model <- 'yield ~ nitrogen + phosphorus'
result <- sem_analysis(df, model, plot = FALSE)
}
Stability Analysis for Multi-Environment Trials (Seven Methods)
Description
Stability analysis of genotypes (or treatments) tested in several environments, with the combined ANOVA and seven established methods:
Eberhart and Russell (1966) joint regression:
b_i,S^2_{di}, tests ofb_i = 1andS^2_{di} = 0, and the Eberhart-Russell ANOVAAMMI: ANOVA with Gollob's degrees of freedom for each IPCA, IPCA scores, AMMI stability value (ASV) and yield stability index
Finlay and Wilkinson (1963) regression on the environment mean
Shukla (1972) stability variance with its F-test
Wricke (1962) ecovalence
Coefficient of variation (Francis and Kannenberg, 1978)
Cultivar superiority index (Lin and Binns, 1988)
An integrated ranking averages the stability ranks of the seven methods.
Usage
stability_analysis(
data,
genotype,
environment,
replication,
trait,
method = "all",
verbose = TRUE,
alpha = 0.05,
fw_log = FALSE
)
Arguments
data |
Data frame with genotype, environment, replication and trait
columns (one row per plot). Genotype x environment means (one row per
combination) can be used with |
genotype |
Name of the genotype (or treatment) column. |
environment |
Name of the environment (location, year or season) column. |
replication |
Name of the replication column, or |
trait |
Name of the trait (response) column. |
method |
|
verbose |
Logical. If TRUE (default), prints the report. |
alpha |
Significance level for the tests. Default 0.05. |
fw_log |
Logical. If TRUE, the Finlay-Wilkinson regression uses
log10-transformed means as in the original paper. Default FALSE (on
the original scale, where the slope equals the Eberhart-Russell
|
Details
Calculations use the genotype x environment table of means
(g genotypes, e environments, r replications). The
environmental index is I_j = \bar{y}_{.j} - \bar{y}_{..}.
Eberhart-Russell. b_i = \sum_j y_{ij} I_j / \sum_j I_j^2;
S^2_{di} = \sum_j \delta^2_{ij}/(e - 2) - MSE/r, where
\delta_{ij} are deviations from the regression and MSE is the
pooled error. b_i = 1 is tested with
t = (b_i - 1)/SE(b_i) on e - 2 df, and S^2_{di} = 0
with F = [\sum_j \delta^2_{ij}/(e-2)] / (MSE/r).
Shukla. \sigma^2_i = [g(g-1)W_i - \sum W] /
[(e-1)(g-1)(g-2)], where W_i is Wricke's ecovalence
\sum_j (\bar{y}_{ij} - \bar{y}_{i.} - \bar{y}_{.j} + \bar{y}_{..})^2;
tested with F = \sigma^2_i / (MSE/r) on e - 1 and the error
df. Values are on the scale of the means.
AMMI. The interaction matrix is decomposed by singular value
decomposition. IPCA k has sum of squares r \lambda_k^2 and
g + e - 1 - 2k df (Gollob, 1968). Scores are
u_{ik}\sqrt{\lambda_k}. ASV = \sqrt{[(SS_1/SS_2)
IPCA1]^2 + IPCA2^2} (Purchase et al., 2000) and the yield stability
index is the sum of the ranks of mean (high = 1) and ASV.
Lin-Binns. P_i = \sum_j (y_{ij} - M_j)^2 / (2e), with
M_j the highest mean in environment j.
Value
An object of class aridagri_stability containing
anova (combined ANOVA, when replications are given),
genotype_means, environment_means, ge_matrix
and, depending on method, eberhart (with
eberhart_anova), ammi (anova, components,
stability, genotype_scores, environment_scores),
finlay, shukla, wricke, cv_stability,
superiority, integrated and concordance
(Kendall's W among the seven stability rankings).
Author(s)
Lalit Kumar Rolaniya, Ram Lal Jat, Monika Punia, Raja Ram Choudhary, Hemant Poonia
References
Eberhart, S.A. and Russell, W.A. (1966). Stability parameters for comparing varieties. Crop Science, 6(1), 36-40. doi:10.2135/cropsci1966.0011183X000600010011x
Finlay, K.W. and Wilkinson, G.N. (1963). The analysis of adaptation in a plant-breeding programme. Australian Journal of Agricultural Research, 14(6), 742-754. doi:10.1071/AR9630742
Shukla, G.K. (1972). Some statistical aspects of partitioning genotype-environmental components of variability. Heredity, 29(2), 237-245. doi:10.1038/hdy.1972.87
Wricke, G. (1962). Uber eine Methode zur Erfassung der okologischen Streubreite in Feldversuchen. Zeitschrift fur Pflanzenzuchtung, 47, 92-96.
Gollob, H.F. (1968). A statistical model which combines features of factor analytic and analysis of variance techniques. Psychometrika, 33(1), 73-115. doi:10.1007/BF02289676
Purchase, J.L., Hatting, H. and van Deventer, C.S. (2000). Genotype x environment interaction of winter wheat (Triticum aestivum L.) in South Africa: II. Stability analysis of yield performance. South African Journal of Plant and Soil, 17(3), 101-107. doi:10.1080/02571862.2000.10634878
Francis, T.R. and Kannenberg, L.W. (1978). Yield stability studies in short-season maize. I. A descriptive method for grouping genotypes. Canadian Journal of Plant Science, 58(4), 1029-1034. doi:10.4141/cjps78-157
Lin, C.S. and Binns, M.R. (1988). A superiority measure of cultivar performance for cultivar x location data. Canadian Journal of Plant Science, 68(1), 193-198. doi:10.4141/cjps88-018
Examples
data(pearlmillet_met)
st <- stability_analysis(pearlmillet_met, genotype = "genotype",
environment = "environment", replication = "rep",
trait = "grain_yield")
st$eberhart
st$ammi$anova
A Clean ggplot2 Theme for Agricultural Figures
Description
The theme used by the plotting functions of aridagri: white background, light grid, dark text and a bold left-aligned title. Add it to any ggplot2 figure.
Usage
theme_aridagri(base_size = 11)
Arguments
base_size |
Base font size in points. Default 11. |
Value
A ggplot2 theme object.
Examples
if (requireNamespace("ggplot2", quietly = TRUE)) {
ggplot2::ggplot(mtcars, ggplot2::aes(wt, mpg)) +
ggplot2::geom_point() + theme_aridagri()
}
Growing Degree Days and Thermal Indices
Description
Growing degree days (GDD), helio-thermal units (HTU), photo-thermal units (PTU), heat use efficiency (HUE) and helio-thermal use efficiency from daily temperatures.
Usage
thermal_indices(
tmax,
tmin,
base_temp = 10,
sunshine_hours = NULL,
day_length = NULL,
crop_yield = NULL,
biomass = NULL,
verbose = TRUE,
upper_temp = NULL,
method = c("average", "modified")
)
Arguments
tmax |
Daily maximum temperature (degrees C). |
tmin |
Daily minimum temperature (degrees C). |
base_temp |
Base temperature (degrees C). Default 10. |
sunshine_hours |
Daily bright sunshine hours (optional, for HTU). |
day_length |
Daily day length in hours (optional, for PTU); see
|
crop_yield |
Economic yield (kg/ha) for HUE (optional). |
biomass |
Total biomass (kg/ha) for HUE (optional). |
verbose |
Logical. If TRUE (default), prints the results. |
upper_temp |
Optional upper threshold temperature (degrees C) above which development does not increase. |
method |
|
Details
HTU = sum of GDD x bright sunshine hours; PTU = sum of GDD x day length (Rajput, 1980). HUE = yield / GDD (kg/ha per degree-day); HTUE = yield / HTU.
Value
An object of class aridagri_thermal: a list with
summary (index, value, unit), gdd_total and
daily (daily and cumulative GDD, HTU and PTU).
Author(s)
Lalit Kumar Rolaniya, Ram Lal Jat, Monika Punia, Raja Ram Choudhary, Hemant Poonia
References
McMaster, G.S. and Wilhelm, W.W. (1997). Growing degree-days: one equation, two interpretations. Agricultural and Forest Meteorology, 87(4), 291-300. doi:10.1016/S0168-1923(97)00027-0
Rajput, R.P. (1980). Response of soybean crop to climatic and soil environments. PhD thesis, IARI, New Delhi.
Examples
tmax <- c(31, 33, 35, 36, 38, 40, 41, 39, 37, 36)
tmin <- c(16, 17, 19, 20, 22, 24, 25, 24, 22, 21)
thermal_indices(tmax, tmin, base_temp = 10, upper_temp = 40,
sunshine_hours = rep(9.5, 10),
day_length = day_length(28, 70:79), crop_yield = 1250)
Yield Gap and Front-Line Demonstration Indices
Description
Yield gap between actual and potential yields. When an attainable yield (for example the yield of an improved-practice or front-line demonstration plot) is supplied, the gap is split into a technology gap and an extension gap and the technology index is given.
Usage
yield_gap_analysis(
actual_yield,
potential_yield,
attainable_yield = NULL,
verbose = TRUE
)
Arguments
actual_yield |
Actual (farmers' practice) yield. |
potential_yield |
Potential yield of the crop or variety. |
attainable_yield |
Attainable or demonstration yield (optional). |
verbose |
Logical. If TRUE (default), prints the table. |
Details
Total gap = potential - actual; yield efficiency = 100 x actual / potential. With attainable yield (Samui et al., 2000): technology gap = potential - attainable; extension gap = attainable - actual; technology index = 100 x technology gap / potential; yield increase over farmers' practice = 100 x (attainable - actual) / actual.
Value
A data frame of class aridagri_yield_gap.
Author(s)
Lalit Kumar Rolaniya, Ram Lal Jat, Monika Punia, Raja Ram Choudhary, Hemant Poonia
References
Samui, S.K., Maitra, S., Roy, D.K., Mondal, A.K. and Saha, D. (2000). Evaluation of front line demonstration on groundnut (Arachis hypogaea L.). Journal of the Indian Society of Coastal Agricultural Research, 18(2), 180-183.
Examples
yield_gap_analysis(actual_yield = c(800, 950, 720), potential_yield = 1500)
# Front-line demonstrations: farmers' practice vs demonstration plots
yield_gap_analysis(actual_yield = c(820, 760, 905),
potential_yield = 1500,
attainable_yield = c(1080, 1010, 1150))