2

I would like to generate a matrix to plan an experiment.

  • I have 6 individuals and 6 treatments delivered in 6 days.
  • I can use 1 individual per week (6 weeks of 6 days in total = 36 days of testings with 6 treatments a day).
  • Every day, I will test 6 treatments on the individual in a random order. An individual should not start with the same treatment any day of the week.

For example:

Monday: A C D B E F
Tuesday: C E A B F D
...
  • If possible, different individuals should not have the same order that the others.
  • I would like to take into account order treatment; that is each pair of treatments following each other should be repeated as equally often as possible to avoid "carryover" (sequence and order) effects. I am working with R at the moment but could also work with MATLAB.

I have tried to work out a design with the package "agricolae" and the package "crossdes" but no success so far. My ideas were to use a balanced incomplete block design. An example of one of my code follows.

> trt <- c("A", "B", "C", "D", "E", "F" )
> k <- 6
> outdesign<- design.bib (trt, k, seed=0)
Error in md[i, bi] : incorrect number of dimensions
4

1 回答 1

2

您使用了错误的功能。您想要一个完整的块设计 (design.rcbd),而不是不完整的。不完整的块设计将创建仅包含一些处理的块。因此,对于 design.bib,k < 长度(trt)。

编辑:这将为您提供 6 天的 6 门科目。强迫每一天开始对每个主题进行不同的治疗比我目前有更多的时间参与,但也许其他人会在我开始之前回答你。

trt <- c("A", "B", "C", "D", "E", "F" )
N <- 6
days <- 6

outdesign<-as.data.frame(matrix(nrow=N*length(trt),ncol=days+1))
names(outdesign)<-c("Subj", "Day1", "Day2", "Day3", "Day4", "Day5", "Day6")
outdesign$Subj<-rep(1:6,each=length(trt))
for (i in 1:days) {
  outdesign[,i+1]<- design.rcbd(trt, N, seed=0,first=TRUE)$book$trt
}

   Subj Day1 Day2 Day3 Day4 Day5 Day6
1     1    E    F    D    C    C    C
2     1    C    E    E    F    F    E
3     1    D    C    B    A    E    D
4     1    B    D    F    D    A    A
5     1    A    B    C    B    D    F
6     1    F    A    A    E    B    B
7     2    D    C    F    A    F    F
8     2    B    E    B    C    E    B
9     2    C    D    E    E    D    A
10    2    A    F    A    F    B    E
11    2    F    A    D    B    C    D
12    2    E    B    C    D    A    C
13    3    B    C    C    A    B    F
14    3    A    A    E    F    E    E
15    3    C    E    F    B    A    B
16    3    E    B    A    C    F    A
17    3    F    F    B    D    C    C
18    3    D    D    D    E    D    D
19    4    F    C    F    D    F    E
20    4    D    B    A    E    B    D
21    4    B    F    D    A    A    F
22    4    C    A    B    B    D    B
23    4    E    E    E    C    C    C
24    4    A    D    C    F    E    A
25    5    D    E    F    A    A    F
26    5    A    D    E    E    E    B
27    5    C    C    C    D    D    E
28    5    E    F    B    C    C    C
29    5    B    A    A    F    B    A
30    5    F    B    D    B    F    D
31    6    F    F    A    F    C    F
32    6    A    D    E    E    D    B
33    6    C    B    C    D    A    A
34    6    B    C    F    C    F    C
35    6    E    E    B    A    E    D
36    6    D    A    D    B    B    E
于 2014-03-11T14:17:31.623 回答