I have the following specific needs for a field trial and would like to generate a design after understanding its treatment and unit structures. There are,
- There are 40 genotypes/varieties. 10 genotypes each form a pre-assigned group, hence there are 4 groups of genotypes
- A group can be either of the two levels/categories -- two line and three line
- Genotypes are replicated in 3 complete replicates
- Each replicate is composed of 2 blocks
- Each block consists of 2 complete (containing all 10 genotypes) sub-block groups, one from both levels/categories
- Group assignment to a sub-block is random.
- Genotypes within each sub-block are randomized
With the details above, I have been able to generate exactly the required design in R using tidyverse
functions and grouping structures.
v_df <- tibble(`Variety name` = paste0("V", 1:40),
`Space allocation` = rep(c("Three line", "Two line", "Two line",
"Three line"), each = 10)) %>%
mutate(`Group` = rep(1:4, each = 10)) %>%
group_by(`Group`) %>%
nest() %>%
expand_grid(replication = 1:3) %>%
arrange(replication) %>%
mutate(block = rep(1:6, each = 2)) %>%
group_by(block) %>%
mutate(`data` = sample(data, 2, replace = FALSE)) %>%
ungroup() %>%
mutate(genotype = purrr::map(data, ~sample_n(.x, size = 10,
replace = FALSE))) %>%
select(-data) %>%
unnest_longer(genotype) %>%
unpack(cols = genotype) %>%
group_by(replication, block) %>%
mutate(x = row_number()) %>%
ungroup() %>%
mutate(y = as.numeric(interaction(replication, block))) %>%
mutate(Group = as.factor(Group))
This produces following layout graph (graphing code is included at bottom of this post):
I can glean that replicates are complete and confined in blocks. So no problem saying it is an RCBD. But, what about sub-blocks ? Allocating them within blocks and replicate with a specific grouping structure eludes my understanding of the design and the theory.
What pokes me is, whether this is a valid design or not, in the first place. And if it is then, what category of design does it fit into ? I hope to know better the usage of this and similar kind of designs.
Since the design imposes constrains in blocking, I would guess certain r
packages/functions already implement the feature more efficiently than my verbose code. It would be helpful to have code pointers in answer.
# Graphing code
ggplot() +
geom_tile(data = v_df, aes(x, y, fill = `Space allocation`),
color = NA, linewidth=1.2, alpha = 0.6) +
scale_fill_discrete() +
geom_tile(data = v_df, aes(x = x, y = y),
color = "black", fill = NA) +
geom_text(data = v_df, aes(x = x, y = y,
label = stringr::str_wrap(`Variety name`, width = 8)),
size = 1.85) +
guides(fill = "none") +
theme_void()