Practical example with logistic regression

For this example, we will use Approach A to conduct an interaction analysis based on logistic regression. We want to see if sex (z) moderates the association between out-patient care due to cardiovascular disease (x) and early retirement (y).

Dataset
StataData1.dta
Variable nameearlyret
Variable labelEarly retirement (Age 50, Year 2020)
Value labels0=No
1=Yes
Variable namecvd
Variable labelOut-patient care due to CVD (Ages 41-50, Year 2011-2020)
Value labels0=No
1=Yes
Variable namesex
Variable labelSex
Value labels0=Man
1=Woman

Define the analytical sample

We start by defining the analytical sample:

gen pop_interact2=1 if earlyret!=. & cvd!=. & sex!=.

Let us have a quick look at the variables:

sum earlyret cvd sex if pop_interact2==1

Simple regression models

First, we will run the simple models, one for cvd and earlyret, and one for sex and earlyret.

logistic earlyret cvd if pop_interact2==1

logistic earlyret sex if pop_interact2==1

There are statistically significant associations in both simple models. More specifically, the OR for cvd is 5.59 (95% CI: 4.54-6.89) and the OR for sex is 1.51 (95% CI: 1.34-1.71).

Multiple regression model

Next, we run a model with both independent variables included:

logistic earlyret cvd sex if pop_interact2==1

Actually, both ORs increase a bit in this model.

Multiple regression model with interaction effect

In this step, we will include the interaction term using Approach 2 (two hashtags mean that we specify the main effects and the interaction effect at the same time):

logistic earlyret i.cvd##i.sex if pop_interact2==1

In the table above, we can see that the estimate for the interaction term has a p-value above 0.05 (0.704). This suggests that there is no statistically significant interaction effect between out-patient care due to CVD and sex on early retirement.

Note
The reference category for the interaction term is by default combination with the smallest value, in this case No#Man. The reason that some combinations are omitted is because they correlate perfectly with the main effect terms.

Summary
Sex does not seem to moderate the association between out-patient care due to CVD and early retirement.