I am trying to estimate odds ratios for interaction terms in a logistic regression using v9.4. I've found this article, http://support.sas.com/kb/24/455.html, but can't find an explanation for how to determine which numbers to enter into the matrix (the 1s, 0s, -1s in the example) in the estimate statement to pull what I want. I am specifcially having difficulty figuring out how to pull for an interaction between a continuous variable (peervicadd) and a categorical one (percschsafe). For good measure, here's my code:
Proc logistic data=secondyp.lgbq;
class race(ref="5" param=ref) sex(ref="1" param=ref) percschsafe(param=ref ref="0");
model SuicideAttemptA(event='1')=peervicadd race age sex grade percschsafe percschsafe*peervicadd/clodds=wald lackfit expb;
estimate "Peer Victimization" peervicadd 1/exp cl;
estimate "Perception of School Safety (No)" percschsafe 0 /exp cl;
estimate "Perception of School Safety (Yes)" percschsafe 1 /exp cl;
Estimate "Peer Victimization x Perceptions of School Safety (No)" percschsafe*peervicadd 0 1 /exp cl;
Estimate "Peer Victimization x Perceptions of School Safety (Yes)" percschsafe*peervicadd 1 1 /exp cl;
Run;
Adding to the mystery, I keep getting this message in the log:
WARNING: More coefficients than levels specified for effect PeerVicAd*PercSchSaf. Some
coefficients will be ignored.
WARNING: More coefficients than levels specified for effect PeerVicAd*PercSchSaf. Some
coefficients will be ignored.
If someone could point me to a reference to see what #'s line up to the various columns in the Estimate statement, I would be very appreciative.
Thanks,
Andrew
Use the ODDSRATIO statement instead, a bit easier to navigate in my opinion.
You're looking for the interaction between a categorical and continuous variable so you may want to specify levels, it chooses the average by default.
proc logistic data=sashelp.heart;
class sex ;
model status = ageatstart height weight sex weight*sex ;
oddsratio sex;
run;
The OR's shouldn't cross 1 if the term is insignificant.
When you have an interaction term, you can only look at a 'conditional' oddsratio of your variable.
Ie Sex at average weight of 158lbs
That makes sense; thank you. I'd like to pull an estimate for the interaction term itself (i.e. in your example, sex*weight). Is that possible with the oddsratio statment?
What are you expecting as output for that?
If they were both categorical you could look at it for all levels, but since one is continuous you need to pick one or several values for weight to consider.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.