Systematic random sampling selection

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
Yana
Posts: 51
Joined: October 6th, 2016, 6:57 am

Systematic random sampling selection

Post by Yana »

Dear Josh and cspro user forum
***********************************
Here am asking about how to select sample by using systematic random sampling selection method?
The formula is nth= k(n-1)+r
nth= nth selection 1,2,3..... samples from the total listing.
k= N/n example total listing 180 and number of sample to be studied is 30 so k= 180/30= 6
r= random start which is randomly picked between [1,k]
based on the above example the first sample will be 2, 6(1-1)+2=2; second sample unit 8; 6(2-1)+2=8. Number 2 is picked randomly between 1 and 6. I have 180 agricultural households and we want to conduct the survey only for 30 households. Random start is given in the listing questionnaire for each enumerate in the EA " Enter the random start?" Is asked.
So how to select only them from listing dict to the main questionnaire?
Thanks in advance
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Systematic random sampling selection

Post by josh »

I would add a variable to the listing file "selected" which is set to zero (not-selected) by default and when the enumerator picks the random start I would set it to 1 for the ones that are selected. Then when the enumerator picks a household from the listing program to interview you can display a dynamic value set of only the households where selected is set to one.

If I understand the formula you are using then k is your sampling interval and r is the start. So you are you going to select cases: r, r + k, r + 2k, r + 3k, etc... So you can loop through all the cases in the listing file and check if each case is the next selection.
// Number of next household in sample
numeric nextSelected = r;

numeric currentHouseholdNumber = 0;

// Loop through all cases in listing and mark sampled
// households
forcase LISTING_DICT do
    
    
// Check if current household is the next one in the sample
    if nextSelected = currentHouseholdNumber then
        SELECTED =
1;
        
writecase(LISTING_DICT);
        nextSelected = nextSelected + k;
    
endif;
    
    
inc(currentHouseholdNumber);

enddo;
Note that if the number of households is not evenly divisible by the household size (e.g. N = 181) then you need to handle the case where the the sampling interval is not a whole number. In that case you need to round the next sample number up or down to the nearest whole number.

This code also doesn't handle the case where the total number of households is too small to give the desired number of samples.

By the way you can use the random function (http://www.csprousers.org/help/CSPro/ra ... ction.html) to determine the random start instead of asking the enumerator for it.
Yana
Posts: 51
Joined: October 6th, 2016, 6:57 am

Re: Systematic random sampling selection

Post by Yana »

Thanks Josh
Yana
Posts: 51
Joined: October 6th, 2016, 6:57 am

Re: Systematic random sampling selection

Post by Yana »

Dear Joshua
I am trying the systematic random sample selection by the above code by adding another logics . But it doesn't work specially in the "forecase " and "stats = getlabel(.....) " aren't compatible each other. I want to write in the menu under CHOOSE_HOUSEHOLD is after selecting all 30 households and display them in their I'd as label and get interview status for each corresponding selecting household. I have attached the app below.
__________________
Thanks Josh
Attachments
Agr.rar
(42.22 KiB) Downloaded 429 times
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Systematic random sampling selection

Post by josh »

Look at the help for forcase. You don't use parenthesis around the dictionary name:

forcase LISTING_DICT do

Also forcase replaces locate/while loadcase so you don't need both.
chess1
Posts: 2
Joined: May 23rd, 2022, 5:27 am

Re: Systematic random sampling selection

Post by chess1 »

Good Day Josh and Yana

Did you get this code to work.

I am also trying to sample. The above code works but does not pick out the household case to mark it with a status of sampled. It is simply just incrementing the count and checking the next sample count.

Please help, urgent
chess1
Posts: 2
Joined: May 23rd, 2022, 5:27 am

Re: Systematic random sampling selection

Post by chess1 »

do ctr = 1 while ctr <= cntEligibleHouseholds and nextSample <= SampleSize

if ctr = nextSampleHouseholdNumber then

// In this code it is working, but not sure if has to be like that. Works because my households are also captured incrimenting
// within the PSU. So ctr 1 is household 1 and if the nextSampleHousehold is equal ctr then i write a status to that household.
Forcase LISTING_DICT Where HH_HH = nextSampleHouseholdNumber do
HH_HOUSEHOLD_STATUS = 1;
writecase(LISTING_DICT);
endfor;

inc(cntSampledHouseholds);
nextSampleHouseholdNumber = ceiling(startingPoint + nextSample * samplingInterval);
inc(nextSample);

endif;

enddo;
Post Reply