I am trying to calculate the Odds Ratio for EACH level of my categorical variables in a Logistic regression.
Var1: Sex (2 levels) Var2: Age (4 levels) Var3: Medication (7 levels) Pred: Intervention (pre v. post) No interactions sought. When I use the Binary Logistic method, I get all levels except for one because it is using one of those levels to compare to the others. This is not what I want. For example, I want to know the Odds Ratio for Males, and I also want it for Females, not males compared to females. I should then have an estimate for each level. SPSS's Logit Log-linear method seems to also be comparing all levels to one. Is that correct? |
Administrator
|
"For example, I want to know the Odds Ratio for Males, and I also want it for Females, not males compared to females. I should then have an estimate for each level."
This makes no sense. Perhaps you mean that you want to know the fitted or predicted odds (not odds ratio) for both males and females. If you run your model via GENLIN rather than LOGISTIC REGRESSION, you can use EMMEANS to create tables showing the fitted log-odds for each level of a categorical variable. You could use OMS to send those tables to another dataset, and use the EXP function to convert log-odds to odds (assuming that's what you want). For example, here's part of a syntax file I wrote a couple years ago while trying to work out how to do this. (And yes Jon, I know I could have used FILE HANDLE instead of a path macro.) ;-) HTH. *** Excerpt from my syntax file ****. define !SPSSdata () 'C:\SPSSdata\' !enddefine. define !temp () 'C:\temp\' !enddefine. new file. dataset close all. GET FILE = !SPSSdata + '1991 U.S. General Social Survey.sav'. dataset name GSS1991. * Recode some variables to more convenient forms. compute male = (sex EQ 1). compute female = (sex EQ 2). compute white = (race EQ 1). compute HSgrad = (educ GE 12). select if nmiss(male, white, hsgrad) EQ 0. value labels male 1 'Male' 0 'Female' / female 1 'Female' 0 'Male' / white 1 'White' 0 'Other' / HSgrad 1 'Yes' 0 'No'. variable lables male 'Male' female 'Female' white 'Race' HSgrad 'High school grad'. freq male female white hsgrad. * Run the model via LOGISTIC REGRESSION. * Use first level of each variable (i.e., 0) as the referent. LOGISTIC REGRESSION VARIABLES HSgrad /METHOD=ENTER male white male*white /CONTRAST (male)=Indicator(1) /CONTRAST (white)=Indicator(1) /PRINT=CI(95) /CRITERIA=PIN(0.05) POUT(0.10) ITERATE(20) CUT(0.5). GENLIN HSgrad (REFERENCE=FIRST) BY male white (ORDER=DESCENDING) /MODEL male white male*white INTERCEPT=YES DISTRIBUTION=BINOMIAL LINK=LOGIT /EMMEANS TABLES=male SCALE=TRANSFORMED /EMMEANS TABLES=white SCALE=TRANSFORMED /EMMEANS TABLES=male*white SCALE=TRANSFORMED /MISSING CLASSMISSING=EXCLUDE /PRINT CPS DESCRIPTIVES MODELINFO FIT SUMMARY SOLUTION (EXPONENTIATED). * The fitted estimated marginal means in the MALE*WHITE table * give the fitted values of Y (i.e., the log-odds that the * outcome variable = 1) at the 4 combinations of the two * dichotomous predictor variables. **************************************************************** . * BUT NOTE: In order for EMMEANS to give the correct results, * you must change the setting for SCALE (on the EMMEANS line) * from ORIGINAL (which is the default) to TRANSFORMED. **************************************************************** .
--
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/). |
In reply to this post by Diceplaya
Some brushing up is required... Odds(event | males) = probability(event | males) / probablilty(nonevent | males) Odds(event | females) = probability(event | females) / probability(nonevent | females)
Odds Ratio (event | male vs. female) = Odds(event | males) / Odds(event | females) You are confusing "Odds" with "Odds Ratio." Ryan On Fri, Mar 29, 2013 at 3:18 PM, Diceplaya <[hidden email]> wrote: I am trying to calculate the Odds Ratio for EACH level of my categorical |
In reply to this post by Bruce Weaver
Great! You clarified my convoluted question and the syntax definitely is useful.
I was able to produce the interaction table using EMMEANS and I'll work on using the EXP function to convert the log-odds. Is it possible for me to obtain the p-value for each level of the predictor variables? I know the Parameter Estimates table displays the results of hypothesis testing, but from what I can tell, I only get the p-values of the predictor variables in comparison to their reference category instead of one for every level of the predictor. I'm hoping to reproduce a similar table to the following that I found in an article. The author's methods state they used log-linear regression models. |
Administrator
|
"Is it possible for me to obtain the p-value for each level of the predictor variables?"
To test what null hypothesis? That the log-odds = 0 (or equivalently, odds = 1)? That's usually not a terribly interesting null hypothesis, so I'm not sure why you'd want to test it. But maybe you have something else in mind. Re the table you posted to Nabble (http://spssx-discussion.1045642.n5.nabble.com/Separate-Odds-Ratios-in-Log-linear-tp5719181p5719198.html), it's not clear to me what the odds ratios represent (i.e., which two fitted odds are being compared). Does the table caption or surrounding text clarify this? 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/). |
Here is what I was able to glean from the article's text:
"The demographic, psychotropic medication use, mental health service use, and mental disorder diagnosis characteristics were first compared for young children from the 1999–2001 (annualized) and 2007 populations. Log-linear models were then fit to evaluate the effect of year (1999–2001 versus 2007) on the rate of any psychotropic drug use, any treated mental disorder, and each disorder group. Rates of antipsychotic drug use per 1,000 young children were then determined for the two time periods overall and stratified by patient sex, age in years, and treated disorder group. Log-linear models were also used to evaluate the year effect on rate of antipsychotic drug use. A graph was constructed to display year-to year change in the rate per 1,000 of antipsychotic drug use for the entire 9-year study period overall and was stratified by patient sex and age (2–3 years versus 4–5 years)." The caption under the graph reads "Bold font denotes that the odds ratio is significantly different from the reference group." Would this suggest that the reference group is the combination of the drugs and each level is compared to that? |
In reply to this post by Bruce Weaver
Testing whether the odds(event) is significantly different from 1.00 is equivalent to asking if the probability(event) is significantly different from .50. The question is whether such a test is meaningful for the OP.
Ryan On Mar 30, 2013, at 3:22 PM, Bruce Weaver <[hidden email]> wrote: > "Is it possible for me to obtain the p-value for each level of the predictor > variables?" > > To test what null hypothesis? That the log-odds = 0 (or equivalently, odds > = 1)? That's usually not a terribly interesting null hypothesis, so I'm not > sure why you'd want to test it. But maybe you have something else in mind. > > Re the table you posted to Nabble > (http://spssx-discussion.1045642.n5.nabble.com/Separate-Odds-Ratios-in-Log-linear-tp5719181p5719198.html), > it's not clear to me what the odds ratios represent (i.e., which two fitted > odds are being compared). Does the table caption or surrounding text > clarify this? > > HTH. > > > > Diceplaya wrote >> Great! You clarified my convoluted question and the syntax definitely is >> useful. >> >> I was able to produce the interaction table using EMMEANS and I'll work on >> using the EXP function to convert the log-odds. >> >> Is it possible for me to obtain the p-value for each level of the >> predictor variables? I know the Parameter Estimates table displays the >> results of hypothesis testing, but from what I can tell, I only get the >> p-values of the predictor variables in comparison to their reference >> category instead of one for every level of the predictor. >> >> I'm hoping to reproduce a similar table to the following that I found in >> an article. The author's methods state they used log-linear regression >> models. > <http://spssx-discussion.1045642.n5.nabble.com/file/n5719198/Example_Table.jpg> > > > > > ----- > -- > Bruce Weaver > [hidden email] > http://sites.google.com/a/lakeheadu.ca/bweaver/ > > "When all else fails, RTFM." > > NOTE: My Hotmail account is not monitored regularly. > To send me an e-mail, please use the address shown above. > > -- > View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Separate-Odds-Ratios-in-Log-linear-tp5719181p5719199.html > Sent from the SPSSX Discussion mailing list archive at Nabble.com. > > ===================== > 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 ===================== 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 |