Is it possible to perform Poisson regression of survival data in SPSS (using the Generalized Linear Models option) and if so does anyone know of a guide they could refer me to?
Many thanks Ron ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
El 25/07/2012 16:35, Ronald McDowell escribió:
> Is it possible to perform Poisson regression of survival data in SPSS (using the Generalized Linear Models option) and if so does anyone know of a guide they could refer me to? Hi Ron: Maybe this example can help you. Best regards, Marta GG * Example dataset (from MJ Campbell "Statistics at Square Two", BMJ books) *. DATA LIST list / id(f2.0) agegroup(f8.0) smoker(f1.0) pyears(f8.0) deaths(f4.0). BEGIN DATA 1 0 0 18790 2 2 1 0 10673 12 3 2 0 5712 28 4 3 0 2585 28 5 4 0 1462 31 6 0 1 52407 32 7 1 1 43248 104 8 2 1 28612 206 9 3 1 12663 186 10 4 1 5317 102 END DATA. DOCUMENT 'Coronary deaths from British male doctors. Doll & Hill (Nat Cancer Inst Monog 1996; 19:205-68)'. VARIABLE LABELS agegroup "Age group". VALUE LABELS agegroup 0 "35-44 years" 1 "45-54 years" 2 "55-64 years" 3 "65-74 years" 4 "75-84 years". VARIABLE LABELS smoker "Smoking status". VALUE LABELS smoker 0 "No" 1 "Yes". * Using SPSS 15 *. COMPUTE logpyears=LN(pyears). GENLIN deaths BY agegroup smoker (ORDER=DESCENDING) /MODEL agegroup smoker agegroup*smoker INTERCEPT=YES OFFSET=logpyears DISTRIBUTION=POISSON LINK=LOG. * Older SPSS: use GENLOG *. * GENLOG uses the last group as reference group: agegroup needs recoding *. RECODE agegroup (0=5) . ADD VALUE LABELS agegroup 0 "" 5 "35-44 years". RECODE smoker (0=2) . ADD VALUE LABELS smoker 0 "" 2 "No". EXECUTE. * Statistical analysis *. FREQUENCIES VARIABLES=agegroup smoker /ORDER VARIABLES . GENLOG agegroup smoker /CSTRUCTURE=pyears /MODEL=POISSON GENLOG agegroup smoker /CSTRUCTURE=pyears /MODEL=POISSON /PRINT FREQ RESID ESTIM /PLOT NONE /CRITERIA =DELTA(0) /DESIGN agegroup smoker . * Model with quantitative variable age instead of agegroup * * To avoid cell-collapsing, an extra variable, id, has to be created and used, but not included in DESIGN *. COMPUTE id=$casenum. EXEC. GENLOG id smoker WITH age /CSTRUCTURE=pyears /MODEL=POISSON /PRINT ESTIM /PLOT NONE /DESIGN age smoker age*smoker . ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
Administrator
|
Hi Marta. How's life in the world of Stata?
Your first GENLOG command below had the hiccups--the first 3 lines appear twice. ;-) And regarding your last model, the file already had an ID variable that was equal to $casenum, so that COMPUTE is not needed. However, there is no AGE variable, so it won't run. ;-) Cheers, Bruce
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
Hi Bruce
El 26/07/2012 16:10, Bruce Weaver escribió: > Hi Marta. How's life in the world of Stata? The University gave one more year of SPSS (for me and my students, and for some teachers that resented abandoning SPSS too), because this is the last year I will teach Experimental Design. The so called "Bologna new study plans" have obliterated Experimental Design (:'( ) from Biology. I thought that having to transform every single piece of SPSS code into Stata was not worth the effort (for just one last year,). Therefore, I have postponed (procrastinated?) the Stata-gate to January 2013, when I will start to prepare, from scratch, a collection of master courses: ANOVA designs, multiple regression models... with Stata. Something very wrong happened to my file. I must have done something I tell my students not to do: use the keyboard to place a sheet of paper and take notes (it is amazing what a fast hitting of many keys at random due to pressure can do to syntax files...). Maybe it's just plain corruption, that file has traveled through many computers and pendrives/external HDD. > > Your first GENLOG command below had the hiccups--the first 3 lines appear > twice. ;-) Erased from the file > > And regarding your last model, the file already had an ID variable that was > equal to $casenum, so that COMPUTE is not needed. However, there is no AGE > variable, so it won't run. ;-) Mystified, the compute command used to be something like: * Restore original coding before computing Age *. RECODE agegroup (5=0) . COMPUTE age = 40 + agegroup*10. * Back to the one correct for GENLOG *. RECODE agegroup (0=5) . Here's the quantitative "age" variable. Thanks for pointing out the errors. Best regards, Marta The correct, tested and working, syntax is, therefore: * Example dataset (from MJ Campbell "Statistics at Square Two", BMJ books) *. DATA LIST list / id(f2.0) agegroup(f8.0) smoker(f1.0) pyears(f8.0) deaths(f4.0). BEGIN DATA 1 0 0 18790 2 2 1 0 10673 12 3 2 0 5712 28 4 3 0 2585 28 5 4 0 1462 31 6 0 1 52407 32 7 1 1 43248 104 8 2 1 28612 206 9 3 1 12663 186 10 4 1 5317 102 END DATA. DOCUMENT 'Coronary deaths from British male doctors. Doll & Hill (Nat Cancer Inst Monog 1996; 19:205-68)'. VARIABLE LABELS agegroup "Age group". VALUE LABELS agegroup 0 "35-44 years" 1 "45-54 years" 2 "55-64 years" 3 "65-74 years" 4 "75-84 years". VARIABLE LABELS smoker "Smoking status". VALUE LABELS smoker 0 "No" 1 "Yes". * Using SPSS 15 *. COMPUTE logpyears=LN(pyears). GENLIN deaths BY agegroup smoker (ORDER=DESCENDING) /MODEL agegroup smoker agegroup*smoker INTERCEPT=YES OFFSET=logpyears DISTRIBUTION=POISSON LINK=LOG. * Older SPSS: use GENLOG *. * GENLOG uses the last group as reference group: agegroup needs recoding *. RECODE agegroup (0=5) . ADD VALUE LABELS agegroup 0"" 5 "35-44 years". RECODE smoker (0=2) . ADD VALUE LABELS smoker 0 "" 2 "No". EXECUTE. * Statistical analysis *. FREQUENCIES VARIABLES=agegroup smoker /ORDER VARIABLES . GENLOG agegroup smoker /CSTRUCTURE=pyears /MODEL=POISSON /PRINT FREQ RESID ESTIM /PLOT NONE /CRITERIA =DELTA(0) /DESIGN agegroup smoker . * Model with quantitative variable age instead of agegroup * * To avoid cell-collapsing, an extra variable, id, has to be used, but not included in DESIGN *. * Restore original coding before computing Age *. RECODE agegroup (5=0) . COMPUTE age = 40 + agegroup*10. * Back to the one correct for GENLOG *. RECODE agegroup (0=5) . GENLOG id smoker WITH age /CSTRUCTURE=pyears /MODEL=POISSON /PRINT ESTIM /PLOT NONE /DESIGN age smoker age*smoker . ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
Free forum by Nabble | Edit this page |