# Thread: How to calculate how often a specific combination occurs in random design?

1. ## How to calculate how often a specific combination occurs in random design?

Hi everybody,

I hope someone can help me out! We designed an experiment in which 24 short clips are shown to particpants. These clips belong to four different categories (so we have 6 clips per categorie). Let's call the categories A, B, C and D. Each participants gets to see all 24 clips in random order without replacement.

Since I am particularly interested in the effects if a C clip is shown after a B clip I would like to know (1) for how many participants we can expect that at least two times a C clip is shown directly after a B clip; and (2) what the expected average times of a C clip being shown after a B clip per person is.

We hope for 3000 participants in total.

I would like to do these kinds of calculations myself so I hope someone can explain to me what the steps are. Thanks!

2. ## Re: How to calculate how often a specific combination occurs in random design?

So you have not conducted the experiment yet? You randomized the order of clips for each person or just once? If you randomized the clips with a randomization algorithm you should be fine? So I am not understanding your question.

3. ## Re: How to calculate how often a specific combination occurs in random design?

Thanks for your reply. We are conducting the experiment right now. We randomized the order of the clips for each person separately and indeed randomized the clips with a randomization algoritm. When the experiment was designed we did not know that the effects of clip C shown after clip B would be most interesting to us and thereofre we did not put restrictions to the randomization method to guarantee sufficient cases of C being shown after B. Right know I would like to make an estimation whether if we go on like this we will end up with a sufficient number or not. That's the background of my questions (1) for how many participants we can expect that at least two times a C clip is shown directly after a B clip; and (2) what the expected average times of a C clip being shown after a B clip per person is.

4. ## Re: How to calculate how often a specific combination occurs in random design?

Is it block design, so it randomizes A, B, C, D, then does it again? So it is not possible for a B then B ordering?

5. ## Re: How to calculate how often a specific combination occurs in random design?

No, B then B is also possible. So no block design.

6. ## Re: How to calculate how often a specific combination occurs in random design?

On average you can expect about 1.5 observations of "C directly follows B" per participant. There is approximately a 48% chance that a participant will have 2 or more cases where C directly follows B. I was too lazy to do the math so I just simulated it.

7. ## The Following User Says Thank You to Dason For This Useful Post:

Funmath (09-11-2015)

8. ## Re: How to calculate how often a specific combination occurs in random design?

Originally Posted by Dason
On average you can expect about 1.5 observations of "C directly follows B" per participant. There is approximately a 48% chance that a participant will have 2 or more cases where C directly follows B. I was too lazy to do the math so I just simulated it.
Thanks! Did you by any chance simulate it in R? In that case, could you send me the code?

I am still interested in knowing how to calculate this by the way, so if anyone is willing to do so I would greatly appreciate it!

9. ## Re: How to calculate how often a specific combination occurs in random design?

I did use R. I used a throwaway script and it wasn't too efficient but it got the job done. Basically I did something like...

Code:
``````vals <- rep(LETTERS[1:4], 6)

cfollowsb <- function(x){
# this should return how many times C follows B in the input vector
# This is off the top of my head but it was something like...
sum(outer(which(x == "B"), which(x == "C"), "-") == -1)
}

sim <- replicate(1000, cfollowsb(sample(vals)))
mean(sim)
mean(sim >= 2)``````

10. ## The Following User Says Thank You to Dason For This Useful Post:

Funmath (09-11-2015)

 Tweet

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts