Programming the statistical procedures from SAS

Interaction terms in a Logistic regression model

Reply
Contributor
Posts: 27

Interaction terms in a Logistic regression model

[ Edited ]

Hello,

 

I am attempting  to build a model with 7 predictors and a binary outcome. I can only use stepwise selection for my assignment. Here is what I currently have in SAS university. Now i know i need to account for possible interactions but how would I do this? Do I include all possible interaction terms in THIS model or do I code for additional models, each one containing a different set of variables/interactions of interest? Thanks in advance for any help!

 

proc logistic data=fp;
class race(ref='White') Sex(ref='F')/param=reference;
model mort_10yr(ref='0') = age sex race educ income_pov_indx log_cotinine log_tungsten FP FI
/selection=stepwise slentry=0.2 slstay=0.15 details lackfit;
run; 

 

Super User
Posts: 23,700

Re: How to forward stepwise model selection?

Posted in reply to iressa131

Since this is an assignment there are probably some other things that effect the answer. You have 7 variables and 2 way interactions alone are a lot. 

 

You can specify interaction terms in the model statement as:

 

model mort_10yr(ref='0') = age | sex | race | educ @2 / <list of options>;

The | pipe symbol tells SAS to consider interactions between the variables and then the @2 tells SAS to limit it to interaction level between 2 variables. 

@3 would test 3-way interactions such as age*sex*race. 

 

You can explicitly list interactions such as:

 

age*sex educ*race

 

This is covered in the documentation here:

http://documentation.sas.com/?docsetId=casecon&docsetTarget=viyaets_introcom_sect021.htm&docsetVersi...

 

You can include all variables in the initial model, if you have enough observations to allow for that. You're possibly testing 7 + 21 two way combinations and categorical variables will increase the numbers. A good rule of thumb is 25 obs per predictor so you would need at minimum 28*25 = 700 obs to start off with. 

 

I'm going to move this to the Stats forum so the stats people can comment. 

 


@iressa131 wrote:

Hello,

 

I am attempting  to build a model with 7 predictors and a binary outcome. I can only use stepwise selection for my assignment. Here is what I currently have in SAS university. Now i know i need to account for possible interactions but how would I do this? Do I include all possible interaction terms in THIS model or do I code for additional models, each one containing a different set of variables/interactions of interest? Thanks in advance for any help!

 
proc logistic data=fp;
class race(ref='White') Sex(ref='F')/param=reference;
model mort_10yr(ref='0') = age sex race educ income_pov_indx log_cotinine log_tungsten FP FI
/selection=stepwise slentry=0.2 slstay=0.15 details lackfit;
run; 


 

Contributor
Posts: 27

Re: How to forward stepwise model selection?

Thank you so much for the informative reply! I only have 520 observations so it appears I won't be able to use the method you suggested. I didn't realize there was a board for statistical questions thank you!

Super User
Posts: 23,700

Re: How to forward stepwise model selection?

Posted in reply to iressa131

@iressa131 wrote:

Thank you so much for the informative reply! I only have 520 observations so it appears I won't be able to use the method you suggested. I didn't realize there was a board for statistical questions thank you!


It's not a can't, it's a shouldn't. Hopefully someone has better advice for you Smiley Happy

Ask a Question
Discussion stats
  • 3 replies
  • 77 views
  • 0 likes
  • 2 in conversation