Skip to contents

Start with randomization constraints

Design selection should follow how treatments can be randomized, not only how many factors appear in a dataset. plan_experiment() records the setting, environmental gradients, and physical restrictions on treatment application. The recommendation is guidance to review with the study team before the experiment begins.

For a homogeneous growth chamber, a completely randomized design (CRD) is a reasonable starting point:

plan_crd <- plan_experiment(
  setting = "growth_chamber",
  treatments = list(fertilizer = c("N0", "N50", "N100", "N150")),
  spatial_gradients = "none"
)
plan_crd$recommended_design
#> [1] "Completely Randomized Design (DCA / CRD, 1 Factor)"
plan_crd$min_replications
#> [1] 4

Greenhouse benches usually introduce a spatial gradient. A randomized complete block design (RCBD) keeps every treatment combination represented within each block:

plan_rcbd <- plan_experiment(
  setting = "greenhouse",
  treatments = list(genotype = paste0("G", 1:5)),
  spatial_gradients = "table_to_table"
)
plan_rcbd$recommended_design
#> [1] "Randomized Complete Block Design (DBCA / RCBD, 1 Factor)"
plan_rcbd$blocking_strategy
#> [1] "Place 1 full replication of all 5 treatment combinations inside each block/table. Never place all replicates of Treatment A on Table 1 and Treatment B on Table 2 (total confounding)."

Use split-plot only when the first factor cannot be randomized to each individual pot or plot. For example, temperature applied to a whole bench is a physical restriction, while genotype can still be randomized within that bench:

plan_split <- plan_experiment(
  setting = "greenhouse",
  treatments = list(
    temperature = c("22C", "36C"),
    genotype = paste0("G", 1:5)
  ),
  whole_plot_factor = "temperature",
  sub_plot_factor = "genotype",
  spatial_gradients = "table_to_table"
)
plan_split$recommended_design
#> [1] "Split-Plot Design (Parcelas Divididas, 2 Factores)"
plan_split$model_formula_preview
#> [1] "response ~ temperature * genotype + (1 | block) + (1 | block:temperature)"

Generate a reproducible planting map

generate_layout() creates plot identifiers, treatment assignments, and block positions. Set seed in a protocol so allocation can be regenerated and audited later. The object keeps the table separately from the plotting method, so the same allocation can feed a field sheet and a map.

layout_a <- generate_layout(
  design = "Split-Plot",
  treatments = list(
    temperature = c("22C", "36C"),
    genotype = paste0("G", 1:5)
  ),
  replications = 4,
  seed = 123
)

utils::head(layout_a$layout_table)
#>   Plot_ID             Block Whole_Plot Position_in_Block temperature genotype
#> 1   P_001 Mesa_1 (Bloque 1)   WP1: 22C                 1         22C       G3
#> 2   P_002 Mesa_1 (Bloque 1)   WP1: 22C                 2         22C       G2
#> 3   P_003 Mesa_1 (Bloque 1)   WP1: 22C                 3         22C       G5
#> 4   P_004 Mesa_1 (Bloque 1)   WP1: 22C                 4         22C       G4
#> 5   P_005 Mesa_1 (Bloque 1)   WP1: 22C                 5         22C       G1
#> 6   P_006 Mesa_1 (Bloque 1)   WP2: 36C                 6         36C       G3
#>   Sub_Plot_Pos response_value
#> 1            1             NA
#> 2            2             NA
#> 3            3             NA
#> 4            4             NA
#> 5            5             NA
#> 6            1             NA
plot(layout_a)

Regenerating with the same seed gives the same treatment allocation:

layout_b <- generate_layout(
  design = "Split-Plot",
  treatments = list(
    temperature = c("22C", "36C"),
    genotype = paste0("G", 1:5)
  ),
  replications = 4,
  seed = 123
)
identical(layout_a$layout_table, layout_b$layout_table)
#> [1] TRUE

Before sowing, inspect the table for complete treatment representation in every block and preserve the generated CSV or R object with the study protocol.