REGRESSION MODELLING FOR HEALTH PRACTITIONERS · CHAPTER 17
Case Studies
Real‑world applications help solidify the concepts introduced throughout this book. In this chapter we analyse two datasets using regression models and illustrate interpretation for health practitioners.
Case Study 1: Smoking and Coronary Heart Disease
The first case study investigates the association between smoking and
coronary heart disease (CHD). The dataset contains 1000 observations
with binary outcome CHD and predictors Smoking
(yes/no), Age, BMI and
Blood_pressure.
Analysis
We fit a logistic regression model adjusting for age, BMI and blood pressure. We report odds ratios and evaluate model performance.
Worked example
R:
data <- read.csv("chd_case.csv")
fit <- glm(CHD ~ Smoking + Age + BMI + Blood_pressure,
family = binomial(), data = data)
summary(fit)
exp(cbind(OR = coef(fit), confint(fit)))
Python:
import pandas as pd
import numpy as np
import statsmodels.api as sm
df = pd.read_csv("chd_case.csv")
X = sm.add_constant(df[["Smoking", "Age", "BMI", "Blood_pressure"]])
y = df["CHD"]
model = sm.Logit(y, X).fit()
print(model.summary())
or_table = pd.DataFrame({"OR": np.exp(model.params),
"CI_low": np.exp(model.conf_int()[0]),
"CI_high": np.exp(model.conf_int()[1])})
print(or_table)
Julia:
using CSV, DataFrames, GLM
data = CSV.read("chd_case.csv", DataFrame)
model = glm(@formula(CHD ~ Smoking + Age + BMI + Blood_pressure),
data, Binomial(), LogitLink())
coeftable(model)
The results show that smoking is associated with higher odds of CHD after adjusting for age, BMI and blood pressure. The confidence interval around the odds ratio should be examined to assess precision.
Case Study 2: Asthma Hospital Visits
Our second case study analyses count data on the number of asthma
hospital visits for 800 children over one year. Predictors include
Air_pollution (continuous),
Socioeconomic_status (SES; low/mid/high) and
Previous_visits. The outcome variable Visits
is the count of visits.
Analysis
We fit both Poisson and negative binomial regression models to account for overdispersion. We include the log of person‑time as an offset (set to 1 year for all children) and compare the fit.
Worked example
R:
library(MASS)
data <- read.csv("asthma_case.csv")
fit_pois <- glm(Visits ~ Air_pollution + SES + Previous_visits,
family = poisson(), offset = log(Person_time), data = data)
fit_nb <- glm.nb(Visits ~ Air_pollution + SES + Previous_visits + offset(log(Person_time)),
data = data)
summary(fit_pois)
summary(fit_nb)
Python:
import pandas as pd
import numpy as np
import statsmodels.api as sm
import statsmodels.formula.api as smf
df = pd.read_csv("asthma_case.csv")
fit_pois = smf.glm(formula="Visits ~ Air_pollution + SES + Previous_visits",
data=df, family=sm.families.Poisson(),
offset=np.log(df["Person_time"]))
res_pois = fit_pois.fit()
print(res_pois.summary())
fit_nb = smf.glm(formula="Visits ~ Air_pollution + SES + Previous_visits",
data=df,
family=sm.families.NegativeBinomial(),
offset=np.log(df["Person_time"]))
res_nb = fit_nb.fit()
print(res_nb.summary())
Julia:
using CSV, DataFrames, GLM, StatsModels
df = CSV.read("asthma_case.csv", DataFrame)
form = @formula(Visits ~ Air_pollution + SES + Previous_visits + offset(log(Person_time)))
fit_pois = glm(form, df, Poisson(), LogLink())
fit_nb = glm(form, df, NegativeBinomial(), LogLink())
println(coeftable(fit_pois))
println(coeftable(fit_nb))
Compare the estimated rate ratios and goodness‑of‑fit measures. If the negative binomial model has a substantially lower Akaike Information Criterion (AIC) than the Poisson model, overdispersion is present and the negative binomial model should be preferred.
Exercises
Perform a Wald test on the smoking coefficient in Case Study 1. Is smoking significantly associated with CHD after adjustment?
For the asthma data, calculate predicted visit rates for low and high pollution scenarios in both the Poisson and negative binomial models. Interpret the differences.
Identify potential confounding variables not included in Case Study 1 or 2 and discuss how they might affect the estimates.
Design a third case study relevant to your field. Describe the outcome, predictors and appropriate regression model. Outline how you would analyse and interpret the data.
Code examples use illustrative datasets. Supply data with the named columns to run them.