# Test effect of variable across sub-groups logistic regression

I have a logit model where I am predicting stunting (a binary indicator of malnutrition), and my two binary independent variables (improved.water and has.insurance) are both statistically significant:

stunting ~ improved.water + has.insurance


I want to ask the question, what is the effect of having insurance for those with improved water compared to those without improved water. One simple way to do this would be to perform the regression separately on the subgroups (with, without improved water), and see what the relationship is between having insurance and being stunted. Is there a more appropriate way to test this? I've looked into interaction effects, but am not sure how to implement them / interpret them in this context. I am using stata to do the analysis, so if the response is "use an interaction term", a more detailed explanation would be really helpful.

• – Macro Aug 25 '12 at 15:50
• It is worth noting that, in logistic regression, stratifying the data set and fitting two separate models vs. including the interaction term as described in the answer below will both give you the exact same fit. – Macro Aug 25 '12 at 16:00

## 1 Answer

I don't know STATA but an interaction term is usually simply the product of the two terms involved. Since both your independent variables are binary, you can code each of them 0 for no and 1 for yes, then the interaction term will be 1 if both of them are "yes" and 0 otherwise.

After you have output, you can interpret it. There will be a parameter for each independent variable and their interaction. The main effect for water is the effect for water when insurance = 0; the main effect for insurance is the effect for insurance when water = 0. To get the effect of each variable when the other = 1, you have to add the interaction term. Since it is a logistic regression, these effects will be on the logit; alternatively, you can find odds ratios, but there will no longer be 1 OR for each independent variable - you will have to specify the level of the other.

• To clarify, my regression should be stunting ~ insurance + water + insurance*water? thanks, – mike Aug 25 '12 at 11:41
• Yes, assuming that that is STATA format – Peter Flom Aug 25 '12 at 12:01