I have a panel data set with roughly 700 observations. Participants were required to work on a real effort task. Each participant needed to count 5 items (variables Trans1-Trans5) for each single exercise (Variable Exercise). There were 5 exercises. There are 2 different groups, a control and a treatment group (Variable Treatment).
Participant | Exercise | Trans1 | Trans2 | Trans3 | Trans4 | Trans5 | Treatment |
1 | 1 | 0 | |||||
1 | 2 | 0 | |||||
1 | 3 | 0 | |||||
1 | 4 | 0 | |||||
1 | 5 | 0 | |||||
2 | 1 | 1 | |||||
2 | 2 | 1 | |||||
2 | 3 | 1 | |||||
2 | 4 | 1 | |||||
2 | 5 | 1 | |||||
3 | 1 | 0 |
I want to evaluate, for each Exercise and by each treatment group separately, how many participants I would have needed to recruit to have 10 participants agreeing on one single identical answer, that is, all 10 participants would agree on all values provided in Trans1 to Trans5.
Since I would like to do inference, I would need to draw such a sample repeatedly.
In essence, I imagine an algorithm like this , but I don't know exactly how to code it (especially step 4 and onwards) or, if there is a better solution:
(example below for treatment group and exercise 1)
1) Drop all obs with exercise!=1 and Treatment!=1
2) Assign random values to observations, gen variable "randomobs" and sort
3) Begin with randomobs=1
4) Draw randomobs=2 and so forth UNTIL there are 10 observations that were drawn that agree on variables Trans1-Trans5
5) Repeat this exercise say 1000 times to get a distribution (for inference)
I finally would like a data set with say 1000 draws each, for each exercise and treatment group, to do inference and to compare control and the treatment:
Draw | Number of Participants required to have 10 agreement | Treatment group | Exercise |
1 | 20 | 0 | 1 |
1 | 24 | 1 | 1 |
2 | 100 | 0 | 1 |
2 | 78 | 1 | 1 |
5000 | 200 | 0 | 5 |
5000 | 201 | 1 | 5 |
I hope someone can help me out or give me advice, I am very grateful for your time!
Thank you very much.
0 Response to Draw Random Sample Based on Iterative Algorithm
Post a Comment