Celina Steffani
Celina Steffani

Reputation: 31

Randomized complete block design

I am trying to do a "randomized complete block design" with 3 re-arrangements in R. I am doing a pot experiment with 9 treatments (3 fertilizer and 3 pesticide treatments are combined) and 6 replicates each, therefore I have chosen 6 blocks. Within the block a treatment is allowed to occur once per arrangement and each individual pot is only allowed to occur once within a block over all arrangements. For example: C_p+Min_1 can be in block 1 the first time, but afterwards can not return in block 1 again. At the same time no other replicate of this treatment (C_p+Min_2 - C_p+Min_6) can be in the same block as C_p+Min_1. My block design is a 6 x 9 raster, where a block is 3x3 raster in a square:

picture of 3x3 x 2 x 3 experimental design

What I did:

library(agricolae)
pesticide <- factor(rep(c("C_p", "Bio", "Syn"), each = 3))
fertilizer <- factor(rep(c("C_f", "Org", "Min"), times = 3))

treatments <- data.frame(fertilizer, pesticide)
treatments_combined <- paste(treatments$fertilizer, "+", treatments$pesticide)

design.rcbd(trt=treatments_combined, r=6, randomization = TRUE, first=TRUE)$sketch

This results in:

      [,1]        [,2]        [,3]        [,4]        [,5]        [,6]        [,7]        [,8]        [,9]       
[1,] "Org + C_p" "Org + Syn" "C_f + Syn" "Min + Syn" "C_f + Bio" "Min + C_p" "Org + Bio" "Min + Bio" "C_f + C_p"
[2,] "Min + Bio" "Min + Syn" "Min + C_p" "C_f + Bio" "Org + Syn" "C_f + C_p" "Org + C_p" "C_f + Syn" "Org + Bio"
[3,] "Org + Syn" "C_f + Bio" "C_f + Syn" "Org + Bio" "Org + C_p" "Min + C_p" "C_f + C_p" "Min + Syn" "Min + Bio"
[4,] "C_f + Bio" "Min + Bio" "Org + C_p" "C_f + C_p" "C_f + Syn" "Min + Syn" "Min + C_p" "Org + Bio" "Org + Syn"
[5,] "Org + C_p" "Org + Bio" "C_f + C_p" "C_f + Syn" "C_f + Bio" "Min + Bio" "Min + C_p" "Min + Syn" "Org + Syn"
[6,] "C_f + Syn" "C_f + C_p" "Min + Bio" "Org + Syn" "Org + Bio" "Min + C_p" "Org + C_p" "C_f + Bio" "Min + Syn"

So I get what I wanted once. Now I want to rearrange them 3 times. How can I do that, so that my specifications from above are met?

Upvotes: 2

Views: 680

Answers (1)

Ben Bolker
Ben Bolker

Reputation: 226182

I believe that if you simply re-run the design.rcbd() function you will get a new randomization. (The function has a seed argument if for some reason you want to fix the randomization to get the same result repeatedly.)

set.seed(101)  ## for replicability in the future
designs <- replicate(4, simplify=FALSE,
     design.rcbd(trt=treatments_combined, r=6, 
                 randomization = TRUE, first=TRUE)$sketch)

This will give you a list of four "sketches" which you can retrieve as designs[[1]], designs[[2]], etc.

Alternatively you could save the entire design by leaving out $sketch:

designs <- replicate(4, simplify=FALSE,
     design.rcbd(trt=treatments_combined, r=6, 
                 randomization = TRUE, first=TRUE))

Now use designs[[1]]$sketch to get the the design sketch for design 1 and designs[[1]]$book to get the "fieldbook", which I think is what you want for the detailed information on individual pots ...

  plots block treatments_combined
1    101     1           C_f + C_p
2    102     1           Org + C_p
3    103     1           Min + C_p
...

One way to extract information on a particular treatment combination:

b <- designs[[1]]$book
dplyr::filter(b, treatments_combined == "Min + C_p")
  plots block treatments_combined
1   103     1           Min + C_p
2   207     2           Min + C_p
3   303     3           Min + C_p
4   404     4           Min + C_p
5   503     5           Min + C_p
6   608     6           Min + C_p
> 

Upvotes: 1

Related Questions