* SPSS code for exemplar 4 First set up the survey design in a plan file You will probably find it easier to do this in a window, go to >>analyse >>complex samples. * AT first screen give your plan file a name and a place to be saved. * At the second put STRATA for strata abd GROSSWT for weight (to get design effects right need a grossing up weight) You don't need to fill in cluster as this sample is not clustered. * At next stage tick WR (with replacement) and you are all set - code below was pasted from this. * Analysis Preparation Wizard. CSPLAN ANALYSIS /PLAN FILE='C:\Documents and Settings\gillian raab\My Documents\aprojects\peas\ex4datafiles\data\ex4plan.csaplan' /PLANVARS ANALYSISWEIGHT=grosswt /PRINT PLAN /DESIGN STRATA= strata CLUSTER= serno /ESTIMATOR TYPE=WR. *------------------------table 4.3-----------. * You can analyse as complex samples from windows by going to the complex samples and submenus, (this next one is descriptives) or by pasting the code below into SPSS. * Complex Samples Descriptives. CSDESCRIPTIVES /PLAN FILE = 'C:\Documents and Settings\gillian raab\My Documents\aprojects\peas\ex4datafiles\data\ex4plan.csaplan' /SUMMARY VARIABLES =eo /MEAN /STATISTICS SE COUNT DEFF DEFFSQRT /MISSING SCOPE = ANALYSIS CLASSMISSING = EXCLUDE. *-------------------------------------------------------------------------------------- same thing unweighted, make an unweighted plan file setting all weights to the average weight (471) so they add to the population size -----------------------------------------------------------------------------------------------------. compute constwt=471. * Analysis Preparation Wizard. CSPLAN ANALYSIS /PLAN FILE='C:\Documents and Settings\gillian raab\My Documents\aprojects\peas\ex4datafiles\data\ex4CONplan.csaplan' /PLANVARS ANALYSISWEIGHT=constwt /PRINT PLAN /DESIGN STRATA= strata CLUSTER= serno /ESTIMATOR TYPE=WR. * Complex Samples Descriptives. CSDESCRIPTIVES /PLAN FILE = 'C:\Documents and Settings\gillian raab\My Documents\aprojects\peas\ex4datafiles\data\ex4CONplan.csaplan' /SUMMARY VARIABLES =eo /MEAN /STATISTICS SE COUNT DEFF DEFFSQRT /MISSING SCOPE = ANALYSIS CLASSMISSING = EXCLUDE. * -------------Table 4.4--------------- by NEMPSIZE-------------. * Complex Samples Descriptives. CSDESCRIPTIVES /PLAN FILE = 'C:\Documents and Settings\gillian raab\My Documents\aprojects\peas\ex4datafiles\data\ex4plan.csaplan' /SUMMARY VARIABLES =eo /SUBPOP TABLE = nempsize DISPLAY=LAYERED /MEAN /STATISTICS SE COUNT DEFF DEFFSQRT /MISSING SCOPE = ANALYSIS CLASSMISSING = EXCLUDE. *-----------note design effect for subgroups is not defined wrt a simple random sample within subgroups, so it is a bit odd - see exemplar 2 for more discussion of this-------------------------------------------------------------. *---------- Table 4.5-------------other factors by EO. * Complex Samples Frequencies. csdescriptives /PLAN FILE = 'C:\Documents and Settings\gillian raab\My Documents\aprojects\peas\ex4datafiles\data\ex4plan.csaplan' /summary VARIABLES = female ethnic . /SUBPOP TABLE = eo DISPLAY=LAYERED /mean /STATISTICS SE COUNT DEFF /MISSING SCOPE = analysis CLASSMISSING = EXCLUDE. * Complex Samples Frequencies. CSTABULATE /PLAN FILE = 'C:\Documents and Settings\gillian raab\My Documents\aprojects\peas\ex4datafiles\data\ex4plan.csaplan' /TABLES VARIABLES = disabgrp /SUBPOP TABLE = eo DISPLAY=LAYERED /CELLS TABLEPCT /STATISTICS SE COUNT /MISSING SCOPE = TABLE CLASSMISSING = EXCLUDE. * And the same thing unweighted by changing plan file. csdescriptives /PLAN FILE = 'C:\Documents and Settings\gillian raab\My Documents\aprojects\peas\ex4datafiles\data\ex4CONplan.csaplan' /summary VARIABLES = female ethnic /SUBPOP TABLE = eo DISPLAY=LAYERED /mean /STATISTICS SE COUNT /MISSING SCOPE = analysis CLASSMISSING = EXCLUDE. * Complex Samples Frequencies. CSTABULATE /PLAN FILE = 'C:\Documents and Settings\gillian raab\My Documents\aprojects\peas\ex4datafiles\data\ex4CONplan.csaplan' /TABLES VARIABLES = disabgrp /SUBPOP TABLE = eo DISPLAY=LAYERED /CELLS TABLEPCT /STATISTICS SE COUNT /MISSING SCOPE = TABLE CLASSMISSING = EXCLUDE. *----------------Table 4.8-----------Finite population correction---------------------------------. * There seems to be a bug in our version ov SPSS 12 it will be fixed in 13 cand we will upgrade and update site.