Hi all,
I might be being silly here - but is there a way of displaying the results of a logistic regression analysis as a graph/image rather than a table in SPSS? I would be interested in showing this within a conference presentation rather than a boring table!
Many thanks, Lindsay
Lindsay H. Dewa l PhD student
in Forensic Psychiatry l Institute of Brain, Behaviour and Mental Health l School of Medicine | 2nd Floor Jean McFarlane Building l The University of Manchester l Oxford Road l Manchester, M13 9PL |
Email: [hidden email]
Twitter:
@Offender_Health and
@DewaLindsay
Student profile: http://www.bbmh.manchester.ac.uk/students/LindsayDewa
Website:
www.ohrn.nhs.uk
The OHRN is looking to actively recruit service user experts to guide our research. Find out more at http://tinyurl.com/q6bkxod
|
Not sure what you had in mind but perhaps something like this might be a start?:
http://www.ats.ucla.edu/stat/spss/code/grlog.htm |
Administrator
|
In reply to this post by Lindsay Dewa
It would help to know more about your model. But assuming you have one or two explanatory variables of primary interest, and just want to control for the others, I would plot the fitted log-odds (with 95% CI) as a function of the key explanatory variables. If an explanatory variable is continuous, select a few values at which to plot the log-odds.
Assuming you are using the LOGISTIC REGRESSION command, you can use OUTFILE to save an XML file containing model information. You can then apply that model to a new dataset containing selected combinations of the explanatory variables for which you want fitted values. IIRC, those fitted values will be predicted probabilities. You can easily convert them to odds, then log-odds using COMPUTE. If you're not familiar with APPLY MODEL, you can see a nice demo here: https://www.youtube.com/watch?v=eboTREc3uSk HTH.
--
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/). |
Administrator
|
Here's another way to get the fitted values of the log-odds at selected combinations of the explanatory variables: Estimate the model via GENLIN (with logit link and binomial error distribution), and use multiple EMMEANS sub-commands to display the fitted values. If you send the EMMEANS output to another data set via OMS, you can get what you need for plotting fairly easily.
Here's an example that uses the old 1991 General Social Survey data file that used to come with SPSS. * Earlier GENLIN syntax not shown here estimated a logistic regression model. * Run that model again, but using OMS to write the * EMMEANS to a file. Also use OMS to suppress all * output to the output window. OMS /DESTINATION VIEWER=NO /TAG='suppressall'. OMS /SELECT TABLES /IF COMMANDS=['Generalized Linear Models'] SUBTYPES=['Estimates'] /DESTINATION FORMAT=SAV NUMBERED=Table OUTFILE= !temp + 'emmeans.sav' . GENLIN collegegrad (REFERENCE=FIRST) WITH age speduc /MODEL age speduc age*speduc INTERCEPT=YES DISTRIBUTION=BINOMIAL LINK=LOGIT /EMMEANS CONTROL=age(20) speduc(8) SCALE=TRANSFORMED /EMMEANS CONTROL=age(20) speduc(12) SCALE=TRANSFORMED /EMMEANS CONTROL=age(20) speduc(16) SCALE=TRANSFORMED /EMMEANS CONTROL=age(20) speduc(20) SCALE=TRANSFORMED /EMMEANS CONTROL=age(40) speduc(8) SCALE=TRANSFORMED /EMMEANS CONTROL=age(40) speduc(12) SCALE=TRANSFORMED /EMMEANS CONTROL=age(40) speduc(16) SCALE=TRANSFORMED /EMMEANS CONTROL=age(40) speduc(20) SCALE=TRANSFORMED /EMMEANS CONTROL=age(60) speduc(8) SCALE=TRANSFORMED /EMMEANS CONTROL=age(60) speduc(12) SCALE=TRANSFORMED /EMMEANS CONTROL=age(60) speduc(16) SCALE=TRANSFORMED /EMMEANS CONTROL=age(60) speduc(20) SCALE=TRANSFORMED /EMMEANS CONTROL=age(80) speduc(8) SCALE=TRANSFORMED /EMMEANS CONTROL=age(80) speduc(12) SCALE=TRANSFORMED /EMMEANS CONTROL=age(80) speduc(16) SCALE=TRANSFORMED /EMMEANS CONTROL=age(80) speduc(20) SCALE=TRANSFORMED /MISSING CLASSMISSING=EXCLUDE /PRINT CPS DESCRIPTIVES MODELINFO FIT SUMMARY SOLUTION (EXPONENTIATED). OMSEND. GET FILE = "C:\temp\emmeans.sav". dataset name em_means window = front. list. * As expected, there are 16 tables, one for each of * the selected combinations of AGE and SPEDUC. * If we create variables AGE and SPEDUC in this file, * and assign the selected values, we can plot the data. numeric age speduc (f5.0). if range($casenum,1,4) age = 20. if range($casenum,5,8) age = 40. if range($casenum,9,12) age = 60. if range($casenum,13,16) age = 80. if any($casenum,1,5,9,13) speduc = 8. if any($casenum,2,6,10,14) speduc = 12. if any($casenum,3,7,11,15) speduc = 16. if any($casenum,4,8,12,16) speduc = 20. variable labels age 'Age (years)' speduc 'Years of education (spouse)' . crosstabs age by speduc. * Make scatter-plots showing the fitted values * of Y at the 16 combinations of AGE and SPEDUC. * Add fitlines for sub-groups in the Chart Editor. DATASET ACTIVATE em_means. variable labels mean 'Fitted Value of Log-Odds'. * Version 1: X = SPEDUC with separate lines for each AGE. GRAPH /SCATTERPLOT(BIVAR)=speduc WITH Mean BY age /MISSING=LISTWISE /TITLE='Log-odds as a function of Age and Spousal Education'. * Version 2: X = AGE with separate lines for each SPEDUC. GRAPH /SCATTERPLOT(BIVAR)=age WITH Mean BY speduc /MISSING=LISTWISE /TITLE='Log-odds as a function of Age and Spousal Education'. * Display fitted values and 95% CIs in a table . sort cases by age speduc. SUMMARIZE /TABLES=speduc Mean Std.Error Lower Upper BY age /FORMAT=VALIDLIST NOCASENUM TOTAL /TITLE='Fitted Values of Log-Odds by Age and Spousal Education' /MISSING=VARIABLE /CELLS=NONE. sort cases by speduc age. SUMMARIZE /TABLES=age Mean Std.Error Lower Upper BY speduc /FORMAT=VALIDLIST NOCASENUM TOTAL /TITLE='Fitted Values of Log-Odds by Spousal Education and Age' /MISSING=VARIABLE /CELLS=NONE. This might give you the general idea.
--
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/). |
Free forum by Nabble | Edit this page |