Randomly select 4 persons from a roster
Randomly select 4 persons from a roster
I would like to randomly select 4 household members from a household roster. Any example in this regard will be deeply appreciated
Re: Randomly select 4 persons from a roster
Have you looked at the CSPro-provided random functions? Specifically,
https://www.csprousers.org/help/CSPro/r ... ction.html
https://www.csprousers.org/help/CSPro/r ... ction.html
https://www.csprousers.org/help/CSPro/v ... ction.html
The last one might be closest to what you want. You would create a valueset with the names of the HH members, and invoke the function.
Sherrell
https://www.csprousers.org/help/CSPro/r ... ction.html
https://www.csprousers.org/help/CSPro/r ... ction.html
https://www.csprousers.org/help/CSPro/v ... ction.html
The last one might be closest to what you want. You would create a valueset with the names of the HH members, and invoke the function.
Sherrell
Re: Randomly select 4 persons from a roster
Thanks so much Sherrell. The code I am using is provided below
preproc
seed(1009);
valueset respondent_valueset;
do j = 1 while j <= totocc(MODULE_2000)
if S2_2I(j) = j then
respondent_valueset.add(S2_1I(j), j);
respondent_valueset.randomize(exclude(0));
endif;
enddo;
setvalueset($, respondent_valueset);
Assuming I have more than 4 household members, the randomization works fine which is okay with me. My challenge right now is how to restrict enumerators to select only the first 4 randomized household members.
preproc
seed(1009);
valueset respondent_valueset;
do j = 1 while j <= totocc(MODULE_2000)
if S2_2I(j) = j then
respondent_valueset.add(S2_1I(j), j);
respondent_valueset.randomize(exclude(0));
endif;
enddo;
setvalueset($, respondent_valueset);
Assuming I have more than 4 household members, the randomization works fine which is okay with me. My challenge right now is how to restrict enumerators to select only the first 4 randomized household members.
Re: Randomly select 4 persons from a roster
Hi Pina,
You can generate 4 random number between 1 to N and then the one selected are the one at the different four positions. But you should memorize the selection such that it should not change when they re-open the application.
To randomly select household members, we use a Kish table. You can look for some online. Based on the size of the household and a second criteria (like the last digit of the identification number of the household) you will always get the same list of selected members if their orders remain the same
You can generate 4 random number between 1 to N and then the one selected are the one at the different four positions. But you should memorize the selection such that it should not change when they re-open the application.
To randomly select household members, we use a Kish table. You can look for some online. Based on the size of the household and a second criteria (like the last digit of the identification number of the household) you will always get the same list of selected members if their orders remain the same
Re: Randomly select 4 persons from a roster
Yes, a Kish grid is a very popular option, tho it will take a bit more programming to accomplish. There have been prior conversations on this on the forum, here is one from a few years ago:
viewtopic.php?f=1&t=2417
>My challenge right now is how to restrict enumerators to select only the first 4 randomized household members.
If you create a valueset using the first four persons randomly selected from the HH, the enumerator can only choose those persons. And as Ares pointed out, you only want to do this once--so you may want to store the values selected and ensure those values don't change (if using one of CSPro's random functions rather than a static Kish grid). On the other hand, If you allow persons to be dropped or added from the HH during the interview or on a later revisit, then that can cause things to change. You'll have to discuss with the survey directors/implementors if that situation is allowed and if so, how it should be handled.
Sherrell
viewtopic.php?f=1&t=2417
>My challenge right now is how to restrict enumerators to select only the first 4 randomized household members.
If you create a valueset using the first four persons randomly selected from the HH, the enumerator can only choose those persons. And as Ares pointed out, you only want to do this once--so you may want to store the values selected and ensure those values don't change (if using one of CSPro's random functions rather than a static Kish grid). On the other hand, If you allow persons to be dropped or added from the HH during the interview or on a later revisit, then that can cause things to change. You'll have to discuss with the survey directors/implementors if that situation is allowed and if so, how it should be handled.
Sherrell
Re: Randomly select 4 persons from a roster
Thanks Sherrell and Ares for your support