| Type: | Package |
| Title: | Analysis of Experimental Data using ANOVA and Mean Comparison |
| Version: | 0.1.0 |
| Description: | Provides tools for designing and analyzing agricultural experiments. It includes functions for generating randomized treatment layouts for standard experimental designs such as Completely Randomized Design (CRD), Randomized Block Design (RBD), Latin Square Design (LSD), Factorial Randomized Block Design (FRBD), split-plot design, and strip-plot design. The package implements one-factor and two-factor analysis of variance (ANOVA) and offers multiple comparison procedures, including Least Significant Difference (LSD), Tukey, and Duncan tests, to compare treatment means in single-factor and factorial experiments. The methods follow classical experimental design principles described in Gomez and Gomez (1984, Statistical Procedures for Agricultural Research, John Wiley & Sons, New York). |
| License: | GPL (≥ 3) |
| Encoding: | UTF-8 |
| LazyData: | true |
| Imports: | ggplot2, grid, multcompView, stats, utils |
| RoxygenNote: | 7.3.3 |
| Depends: | R (≥ 3.5) |
| NeedsCompilation: | no |
| Packaged: | 2026-04-24 11:26:49 UTC; HPC |
| Author: | Santosh Patil |
| Maintainer: | Santosh Patil <patil.sgstat@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-04-28 19:00:43 UTC |
Groundnut Dataset
Description
Hypothetical dataset for single-factor groundnut experiment.
Usage
Gnutdataset
Format
A data frame with 24 observations and 10 variables:
- Trt
Treatment levels
- Rep
Replication
- Germ
Germination percentage
- Plntht
Plant height (cm)
- Noflwr
Number of flowers per plant
- Spread
Plant spread (cm)
- Leaflnth
Leaf length (cm)
- Nopodplnt
Number of pods per plant
- Wt
Pod weight per plant (g)
- Disease
Disease incidence
Details
Used for demonstration of one-factor ANOVA.
Source
Simulated data
Rice Dataset
Description
Hypothetical dataset for two-factor experiment (treatment and spacing).
Usage
Ricedataset
Format
A data frame with 96 observations and 11 variables:
- TRT
Treatment
- SPACE
Spacing
- BLOCK
Block
- DFF
Days to flowering
- PH
Plant height
- TTP
Tillers per plant
- PL
Panicle length
- GPP
Grains per panicle
- HSW
Hundred seed weight
- GYP
Grain yield
- Disease
Disease incidence
Details
Used for two-factor ANOVA demonstration.
Source
Simulated data
Soil Dataset
Description
Hypothetical dataset for single-factor soil experiment.
Usage
Soildataset
Format
A data frame with 33 observations and 15 variables:
- TRT
Treatment
- REP
Replication
- BD
Bulk density
- PD
Particle density
- POR
Porosity
- HC
Hydraulic conductivity
- pH
Soil pH
- CEC
Cation exchange capacity
- N
Nitrogen
- P
Phosphorus
- K
Potassium
- S
Sulfur
- OC
Organic carbon
- MBN
Microbial biomass nitrogen
- MBC
Microbial biomass carbon
Details
Used for soil analysis demonstration.
Source
Simulated data
One-Factor ANOVA for Agricultural Designs
Description
Performs analysis of variance for one-factor experiments under Completely Randomized Design (CRD), Randomized Block Design (RBD), and Latin Square Design (LSD). Supports multiple response variables, data transformation, and mean comparison tests.
Usage
aov_of(
data,
design = c("CRD", "RBD", "LSD"),
treatment,
replication = NULL,
row = NULL,
column = NULL,
responsevar = "all",
test = c("lsd", "tukey", "duncan"),
transform = NULL,
narc = 1,
alpha = 0.05
)
Arguments
data |
A data frame containing experimental data. |
design |
Type of design. One of "CRD", "RBD", or "LSD". |
treatment |
Name of treatment column in the dataset. |
replication |
Name of replication/block column (required for RBD). |
row |
Name of row factor (required for LSD). |
column |
Name of column factor (required for LSD). |
responsevar |
Specific variables c("v1" ,"v2", "v3") or "all". |
test |
Mean comparison test. Options include "lsd", "tukey", or "duncan". |
transform |
List specifying transformations for variables. Options include "log", "sqrt", and "arcsine". |
narc |
Numeric or list specifying denominator for arcsine transformation. |
alpha |
Significance level (e.g., 0.05). |
Details
This function supports:
Analysis for CRD, RBD, and LSD designs
Multiple response variables
Data transformations (log, square root, arcsine)
Mean separation tests (LSD, Tukey, Duncan)
Combined summary table output
Value
A list containing:
- Individual outputs
-
Analysis results for each response variable separately.
- Summary statistics
-
Arithmetic mean, standard deviation, minimum, and maximum values for each variable.
- Shapiro-Wilk test
-
Results of the Shapiro-Wilk test for normality.
- ANOVA and mean comparison
-
ANOVA table along with mean comparison based on the selected test for each response variable.
- Combined table
-
A summary table including mean ± SD, grouping letters, SEm, SEd, CD, and CV values for all variables.
Examples
# Example
data(Gnutdataset)
head(Gnutdataset)
Out_rbd <- aov_of(
Gnutdataset,
design = "RBD",
treatment = "Trt",
replication = "Rep",
responsevar = "all",
transform = list(Noflwr="sqrt", Germ="arcsine", Disease="arcsine"),
narc = list(Germ=10, Disease=5),
alpha = 0.05 )
# Single variable result
Out_rbd$Germ
# Combined table for all varaibles
Out_rbd$Combined_table
# Entire output
Out_rbd
#Example without transformation
Out_rbd2 <- aov_of(
Soildataset,
design = "RBD",
treatment = "TRT",
replication = "REP",
responsevar = "all",
test = "lsd",
alpha = 0.05
)
Out_rbd2$Combined_table
Two-Factor ANOVA for Agricultural Experimental Designs
Description
Performs analysis of variance for two-factor experiments Factorial CRD (FCRD), Factorial RBD (FRBD), Split-Plot, and Strip-Plot designs.
Usage
aov_tf(
data,
design = c("FCRD", "FRBD", "SPLIT", "STRIP"),
factor_A,
factor_B,
replication = NULL,
responsevar = "all",
test = c("lsd", "tukey", "duncan"),
transform = NULL,
narc = 1,
alpha = 0.05
)
Arguments
data |
A data frame containing experimental data. |
design |
Type of design "FCRD", "FRBD", "SPLIT" or "STRIP". |
factor_A |
Name of Factor A column in the dataset. |
factor_B |
Name of Factor B column in the dataset. |
replication |
Name of replication/block column (required for FRBD, SPLIT, STRIP). |
responsevar |
Specific variables c("v1" ,"v2", "v3") or "all". |
test |
Mean comparison test. Options include"lsd", "tukey", or "duncan". |
transform |
List or character specifying transformations ("log", "sqrt", "arcsine"). |
narc |
Numeric or list specifying denominator for arcsine transformation. |
alpha |
Significance level (default 0.05). |
Value
A list containing:
- Individual outputs
-
Analysis results for each response variable separately.
- Summary statistics
-
Arithmetic mean, standard deviation, minimum, and maximum values for each variable.
- Shapiro-Wilk test
-
Results of the Shapiro-Wilk test for normality.
- ANOVA and mean comparison
-
ANOVA table along with mean comparison based on the selected test for each response variable.
- Combined table
-
A summary table -two way including mean ± SD, grouping letters, SEm, SEd, CD, and CV values for all variables.
#'
Examples
#Rice dataset with Factor A as TRT and Factor B as SPACE and replications in "BLOCK" column
data("Gnutdataset")
"head(Ricedataset)"
#Example: Factorial CRD
out <- aov_tf(
Ricedataset,
design = "FCRD",
factor_A = "TRT",
factor_B = "SPACE",
replication = "BLOCK",
responsevar = "all",
test = "lsd",
transform = NULL,
narc = 1,
alpha = 0.05
)
#Example: Split-plot with transformation
out2 <- aov_tf(
Ricedataset,
design = "SPLIT",
factor_A = "TRT",
factor_B = "SPACE",
replication = "BLOCK",
responsevar = "all",
test = "lsd",
transform = list(GPP = "log", Disease = "arcsine"),
narc = list(Disease = 5),
alpha = 0.05
)
out2$PH
out2$GPP
Field Design Layout Plot for Agricultural Experiments
Description
Generates randomized field layouts for agricultural experimental designs including Completely Randomized Design (CRD), Randomized Block Design (RBD), and Latin Square Design (LSD), factorial designs, split-plot, and strip-plot.
Usage
fld_layout(
design = "RBD",
treatments = paste0("T", 1:5),
A = c("A1", "A2"),
B = c("B1", "B2", "B3"),
blocks = 3,
replications = 3,
plot_length = 2,
plot_width = 1,
alley = 0.3,
block_gap = 0.6,
border = NULL,
treatment_label_size = NULL,
block_label_size = NULL,
show_field_dimensions = TRUE,
show_plot_dimensions = TRUE,
seed = NULL
)
Arguments
design |
Type of design. Options include" "CRD", "RBD", "LSD", "FCRD","FRBD", "SPLIT", or "STRIP". |
treatments |
Vector of treatment labels (used in CRD, RBD, LSD). |
A |
Vector of Factor A levels (for factorial, split, strip designs). |
B |
Vector of Factor B levels (for factorial, split, strip designs). |
blocks |
Number of blocks (required for RBD, SPLIT, STRIP). |
replications |
Number of replications. Can be a single number (equal replication) or a vector (unequal replication, e.g., c(2,3,4,2)). |
plot_length |
Length of each plot |
plot_width |
Width of each plot |
alley |
Spacing between adjacent plots. |
block_gap |
Gap between blocks. |
border |
Border area around the field layout. |
treatment_label_size |
Size of treatment labels in the layout |
block_label_size |
Size of block labels |
show_field_dimensions |
Logical; display field dimensions |
show_plot_dimensions |
Logical; display plot dimensions |
seed |
Random seed for reproducibility. Optional random seed to ensure reproducibility of randomization; same seed gives the same layout/results across runs. |
Details
This function supports:
Completely Randomized Design (CRD)
Randomized Block Design (RBD)
Latin Square Design (LSD)
Factorial CRD and RBD (FCRD, FRBD)
Split-plot and strip-plot designs
Unequal and equal replication structures in CRD
Custom plot dimensions and spacing
Value
A list containing:
- plot
A ggplot object showing field layout
- layout
Data frame containing plot arrangement
Examples
layout_crd <- fld_layout(
design = "CRD",
treatments = paste0("T", 1:7),
replications = c(2,3,4,2,1,5,4),
plot_length = 2.5,
plot_width = 1.8,
alley = 0.3,
border = 1.5,
seed = 123
)
layout_crd$plot
# RBD example
layout_rbd <- fld_layout(
design = "RBD",
treatments = paste0("T",1:7),
blocks = 4,
seed = 123
)
layout_rbd$plot
layout_rbd <- fld_layout(
design = "RBD",
treatments = paste0("T",1:7),
blocks = 4,
treatment_label_size = 4,
block_label_size = 3,
show_field_dimensions = FALSE,
show_plot_dimensions = FALSE,
seed = 123
)
layout_rbd$plot
# Latin Square Design
layout_lsd <- fld_layout(
design = "LSD",
treatments = paste0("T", 1:6),
seed = 123
)
layout_lsd$plot
# Factorial CRD
result <- fld_layout(
design = "FCRD",
A = c("A1", "A2", "A3"),
B = c("B1", "B2", "B3", "B4"),
replications = 3,
seed = 101
)
result$plot
# Split plot
result2 <- fld_layout(
design = "SPLIT",
A = c("A1", "A2", "A3"),
B = c("B1", "B2", "B3", "B4"),
blocks = 3,
seed = 101 )
result2$plot