BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
analyst_work
Obsidian | Level 7
Hello,
I am using a logistic regression model for my categorical data. I have a dichotomous outcome variable and gender and depression as the independent variables. I am interested in looking at the outcome for a combined category of depressed female. Should I create a new categorical variable where female=1 and depression = 1 or will the interaction term give me the odds ratio for a depressed female?
1 ACCEPTED SOLUTION

Accepted Solutions
StatDave
SAS Super FREQ

Include the interaction, but you'll need to use the LSMEANS statement to get the odds ratios comparing combinations of the predictor levels. For example, these statements give all of the odds ratios comparing the combinations of the predictor levels.

proc logistic;
class a b/param=glm;
model y(event="1")=a|b;
lsmeans a*b/ ilink diff oddsratio cl;
run;

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

Fit the interaction term. Then use the ODDSRATIO command in PROC LOGISTIC to look at the effect at specific values of your x-variables.

--
Paige Miller
StatDave
SAS Super FREQ

Include the interaction, but you'll need to use the LSMEANS statement to get the odds ratios comparing combinations of the predictor levels. For example, these statements give all of the odds ratios comparing the combinations of the predictor levels.

proc logistic;
class a b/param=glm;
model y(event="1")=a|b;
lsmeans a*b/ ilink diff oddsratio cl;
run;
analyst_work
Obsidian | Level 7
Thank you so much! It looks like there is quasi complete separation due to one of the categories, so I might need to combine a few categories.
One follow-up question:
If I need to also look at females with migraine in addition to females w depression, would that then be a three way interaction term?
StatDave
SAS Super FREQ

Assuming that migraine is another categorical predictor, then yes, you can try to add it in the model interacting with the other variables:  model y(event="1")=a|b|c; Note that the a|b|c syntax is shorthand for all three main effects, all three two-way interactions, and the three-way interaction. But if you already have separation problems, then adding another categorical predictor will make it worse. Separation is caused when one or more combinations of levels of the predictors does not have any of one level of the response making the data sparse. This causes some of the model parameters to be infinite, making proper convergence of the iterative fitting algorithm impossible. Adding another predictor creates more combinations for the same amount response information to be spread over - increasing the sparseness. In some cases, you can use the FIRTH option in the MODEL statement to produce results in spite of the separation problem. The Firth method is a modification of the fitting algorithm to use a penalized likelihood function. 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 596 views
  • 5 likes
  • 3 in conversation