# Interaction term vs subgroup analysis

I have a question regarding the choice between interaction term and subgroup analysis.

Suppose that I want to study the association between education and income by sex. I can fit a model with an interaction term as: income = education*sex

Or, fit a simpler model among males and females separately: income = education

In both analyses, I am interested in the point estimate (odds ratio) and 95% confidence interval. Below is an hypothetical example. In this example, statistical testing about whether the association differs by sex is not the outcome of interest. Both analyses generated the same results.

However, I got a vague impression that it is generally recommended to add interaction term rather than conducting subgroup analyses.

• If this is TRUE, it is unclear about the reasons underlying this recommendation, since both methods have the same results.
• If this is FALSE, does it mean that the two approaches are equal in terms of obtaining the point estimate and confidence interval?

Any comments would be much appreciated!

library(dplyr)
set.seed(42)

n <- 1000
sex <- sample(c("Male", "Female"), n, replace = TRUE)
education <- sample(c("Low", "High"), n, replace = TRUE, prob = c(0.5, 0.5))

income <- ifelse(education == "Low",
sample(c("Low", "High"), n, replace = TRUE, prob = c(0.75, 0.25)),
sample(c("Low", "High"), n, replace = TRUE, prob = c(0.25, 0.75)))

data <- data.frame(sex = as.factor(sex), education = factor(education, levels = c("Low", "High")), income = factor(income, levels = c("Low", "High")))
summary(data)

### Logistic regression: Overall ###
# among females
model_overall <- glm(income ~ education*sex, data = data, family = "binomial")
round( exp( coef(model_overall)["educationHigh"] ), 2 ) # 8.69
round( exp( confint(model_overall)["educationHigh", ] ), 2 ) # 5.84-13.09

# among males
data$$sex <- relevel( data$$sex, ref = "Male" )
model_overall <- glm(income ~ education*sex, data = data, family = "binomial")
round( exp( coef(model_overall)["educationHigh"] ), 2 ) # 6.97
round( exp( confint(model_overall)["educationHigh", ] ), 2 ) # 4.73-10.40

### subgroup analyses ###
# Logistic regression: female subgroup
model_female <- glm(income ~ education, data = filter(data, sex == "Female"), family = "binomial")
round( exp( coef(model_female)["educationHigh"] ), 2 ) # 8.69
round( exp( confint(model_female)["educationHigh", ] ), 2 ) # 5.84-13.09

# Logistic regression: Male subgroup
model_male <- glm(income ~ education, data = filter(data, sex == "Male"), family = "binomial")
round( exp( coef(model_male)["educationHigh"] ), 2 ) # 6.97
round( exp( confint(model_male)["educationHigh", ] ), 2 ) # 4.73-10.40

• For many models, such as linear regression, subgrouping creates inefficient estimates of auxiliary parameters such as $$\sigma^2$$