Equal number of participants in random groups

161 views
Skip to first unread message

Katerina M.

unread,
Mar 30, 2019, 9:36:31 PM3/30/19
to formr
Hi everyone!

My apologies if this has been asked before, but I'm trying to find a way to assign the same number of participants to each random group in my run. I have three different between-subjects conditions as different survey sheets, and I have used shuffle to randomise assignment to each one. However, I would like to have a balanced number of responses across all conditions. I think that the block.random function from the psych package would be useful for that, but I'm not sure how to add it as a calculate-type item to my survey sheets. 

Any help would be greatly appreciated! :) 

Thanks a lot,
Katerina

Ruben Arslan

unread,
Apr 1, 2019, 2:27:22 AM4/1/19
to Katerina M., formr
Hi Katerina,

you can put the following in a calculate field's value column:

set.seed(100)
planned_sample_size <- 300
groups <- 3
psych::block.random(planned_sample_size, groups)[.formr$nr_of_participants, 2]

Put in some random seed and choose the number of participants that you
plan to recruit. 
You will have to manually end the study when you have reached your planned
sample size, or put something in your run that deals with the case when you run
out of numbers.

Best,

Ruben


--
You received this message because you are subscribed to the Google Groups "formr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to formr+un...@googlegroups.com.
To post to this group, send email to fo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/formr/5fddcddf-9df4-4761-b6e3-a08755dac118%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Katerina M.

unread,
Apr 1, 2019, 2:02:44 PM4/1/19
to formr
Hi Ruben,

Thank you for your answer! Just to make sure, do I add this code to a separate sheet which I would put before my conditions, or to each of my condition sheets? Also, in [.formr$nr_of_participants, 2], what is 2 referring to?

Many thanks again for your help!

Best wishes,
Katerina



On Monday, April 1, 2019 at 7:27:22 AM UTC+1, Ruben Arslan wrote:
Hi Katerina,

you can put the following in a calculate field's value column:

set.seed(100)
planned_sample_size <- 300
groups <- 3
psych::block.random(planned_sample_size, groups)[.formr$nr_of_participants, 2]

Put in some random seed and choose the number of participants that you
plan to recruit. 
You will have to manually end the study when you have reached your planned
sample size, or put something in your run that deals with the case when you run
out of numbers.

Best,

Ruben


On Sun, Mar 31, 2019 at 3:36 AM Katerina M. <epi...@gmail.com> wrote:
Hi everyone!

My apologies if this has been asked before, but I'm trying to find a way to assign the same number of participants to each random group in my run. I have three different between-subjects conditions as different survey sheets, and I have used shuffle to randomise assignment to each one. However, I would like to have a balanced number of responses across all conditions. I think that the block.random function from the psych package would be useful for that, but I'm not sure how to add it as a calculate-type item to my survey sheets. 

Any help would be greatly appreciated! :) 

Thanks a lot,
Katerina

--
You received this message because you are subscribed to the Google Groups "formr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fo...@googlegroups.com.

Katerina M.

unread,
Apr 12, 2019, 8:50:19 AM4/12/19
to formr
Hi, 

Sorry for the repost but I'd really appreciate an answer here (I'm really new to this!). 

Thanks!

Katerina

Ruben Arslan

unread,
Apr 12, 2019, 8:54:17 AM4/12/19
to Katerina M., formr
Hi Katerina,

while testing, you cannot break anything—when in doubt, try it out. 
I don't know anything about your study except what you told me, so I don't know what's best. Probably separate sheet from the way you asked.
The 2 refers to the second column from the output of block random. You can run the code in your local R to understand the parts better.

Best,
Ruben

To unsubscribe from this group and stop receiving emails from it, send an email to formr+un...@googlegroups.com.

To post to this group, send email to fo...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages