*** This bit reads in the data and looks at the relationships in the 'real' and 'hypothetical' *** populations GET FILE= 'd:\chisq.sav'. EXECUTE . CROSSTABS /TABLES=class BY teeth /FORMAT= AVALUE NOINDEX BOX LABELS TABLES /CELLS= COUNT ROW . CROSSTABS /TABLES=class BY teethhyp /FORMAT= AVALUE NOINDEX BOX LABELS TABLES /CELLS= COUNT ROW . *** This bit draws 10 samples of 250 people from the 'hypothetical' population, and produces a *** crosstabulation and (Pearson) chi-square statistic for each of the 10 samples. COMPUTE rjlrand = UNIFORM(1) . EXECUTE . sample 2500 from 10000. RANK VARIABLES=rjlrand (A) /RANK /PRINT=YES /TIES=MEAN . COMPUTE rjlsamp = RND((rrjlrand+124.5)/250) . EXECUTE . CROSSTABS /TABLES=class BY teethhyp BY rjlsamp /FORMAT= AVALUE NOINDEX BOX LABELS TABLES /STATISTIC=CHISQ /CELLS= COUNT ROW . *** This bit draws 10 samples of 250 people from the 'real' population, and produces a *** crosstabulation and (Pearson) chi-square statistic for each of the 10 samples. GET FILE= 'd:\chisq.sav'. EXECUTE . COMPUTE rjlrand = UNIFORM(1) . EXECUTE . sample 2500 from 10000. RANK VARIABLES=rjlrand (A) /RANK /PRINT=YES /TIES=MEAN . COMPUTE rjlsamp = RND((rrjlrand+124.5)/250) . EXECUTE . CROSSTABS /TABLES=class BY teeth BY rjlsamp /FORMAT= AVALUE NOINDEX BOX LABELS TABLES /STATISTIC=CHISQ /CELLS= COUNT ROW .