GET FILE='C:\Documents and Settings\gillian raab\My Documents\aprojects\peas\web\exemp5\data\ex5wt.sav'. * Line above reads in the data. If you have opened ex5wt.sav interactively you won't need to include it. *---------------------------------------------------------------------------------------------------------------------------------------. *logistic regression with grouped data in SPSS can only be done using PROBIT. *Only the final model is shown here, although otehrs could have been tried. *first compute interaction terms. *---------------------------------------------------------------------------------------------------------------------------------------------. compute agegrp2=agegrp*agegrp. compute agesinc=agegrp*sinc. compute sex=0. if gender="F" sex=1. compute agesex=agegrp*sex. compute age2sex=agegrp2*sex. execute. *------------------------------------------------------------------------------------------------------------------------. * Now the logistic regression. * needed extra iterations to converge. * this model is not quite the same as SAS since the agegp quadratic interaction with sinc. * has been missed out. * ------------------------------------------------------------------------------------------------------------------------.. PROBIT AyrA_num OF npop WITH sinc sacc agegrp sex agegrp2 agesex age2sex agesinc /LOG NONE /MODEL LOGIT /CRITERIA ITERATE(50) STEPLIMIT(.1) . *------------------------------------------------------------------------------------- *The PROBIT command doesn't give predicted values in a file. *although it has an option to print them out. *so it is necessary to compute them from the output. *--------------------------------------------------------------------------------------------------------- . compute lp= -4.47972-0.02489*sinc+sacc*0.04634+agegrp*(-0.00248) + sex*.47620 + agegrp2 *(.00721) +agesex*(-.00720) +age2sex*(-.00508)+agesinc*(.00152). compute phat=1/(1+exp(-lp)). compute gweight=1/phat. execute. compute weighta=gweight/75.60964.