Hi Orion,
The Mersenne Twister algorithm isn't a sampling algorithm per se, it's a pseudo-random number generating algorithm. It is definitely the preferred algorithm in SPSS Statistics.
The Complex Samples module has sampling design procedures that will allow you to specify different numbers of cases sampled from different strata. Here's an example using the Employee.sav file that comes in the sample data folder. The jobcat variable has cases with values 1, 2, and 3, so it works nicely as an example. You would need to replace the "<path>" specifications with appropriate ones for your system:
CSPLAN SAMPLE
/PLAN FILE='<path>/stratified_sampling.csplan'
/PLANVARS SAMPLEWEIGHT=SampleWeight_Final_
/PRINT PLAN MATRIX
/DESIGN STRATA=jobcat
/METHOD TYPE=SIMPLE_WOR ESTIMATION=DEFAULT
/SIZE MATRIX=jobcat; 1 30;2 25;3 15
/STAGEVARS INCLPROB(InclusionProbability_1_) CUMWEIGHT(SampleWeightCumulative_1_).
DATASET DECLARE stratified_sample.
CSSELECT
/PLAN FILE='<path>/stratified_sampling.csplan'
/CRITERIA STAGES=1 SEED=RANDOM
/CLASSMISSING EXCLUDE
/SAMPLEFILE OUTFILE='stratified_sample'
/PRINT SELECTION.
This will leave you with a new dataset with the desired numbers of cases sampled from the original file. That file will include inclusion probabilities and sample weights for use with Complex Samples analysis procedures. Note that if you want to be able to replicate the results of the sampling you would need to change the RANDOM specification on the SEED keyword on the CRITERIA subcommand of the CSSELECT command to a number.
If you don't want to use the Complex Samples machinery, you can get what you want as follows:
COMPUTE rand=RV.UNIFORM(0,1).
RANK VARIABLES=rand (A) BY jobcat
/RANK
/PRINT=NO.
DO IF jobcat=1.
SELECT IF Rrand<=30.
ELSE IF jobcat=2.
SELECT IF Rrand<=25.
ELSE IF jobcat=3.
SELECT IF Rrand<=15.
END IF.
EXECUTE.
In this case you'll have altered the original file, so be sure to save the results to a new file name before proceeding.
------------------------------
David Nichols
------------------------------
Original Message:
Sent: Thu April 30, 2020 12:22 PM
From: Orion Lawler
Subject: What is the Syntax to Specify Different Number of Units Per Stratum?
In SPSS Statistics, v26, I am using the Mersenne Twister algorithm for statistical sampling and I would like to specify 30 observations for stratum 1, 25 for stratum 2 and 15 for stratum 3. What is the syntax I need for this sort of stratification?
------------------------------
Orion Lawler
------------------------------
#SPSSStatistics