Book contents

REGRESSION MODELLING FOR HEALTH PRACTITIONERS · CHAPTER 18

Comprehensive Exercises

This chapter provides a collection of exercises that integrate concepts from throughout the book. These problems encourage you to practise data analysis, interpretation and critical thinking using regression modelling techniques.

Exercises

  1. Simulate a dataset with 300 observations, one continuous predictor and one binary predictor. Generate the outcome using a linear regression model with known coefficients and add random error. Fit a linear regression model to the simulated data in R, Python or Julia. Compare the estimated coefficients to the true values. Examine residual plots and discuss whether model assumptions appear satisfied.

  2. Using a publicly available dataset (e.g., the PimaIndiansDiabetes dataset), fit a logistic regression model to predict diabetes status from BMI, age and number of pregnancies. Compute the odds ratios, their confidence intervals and AUC. Plot a calibration curve. Discuss the model’s discrimination and calibration.

  3. Generate count data using a Poisson process with exposure times varying across observations. Fit Poisson and negative binomial regression models with an offset. Compare rate ratios and use information criteria to decide which model is more appropriate.

  4. Simulate survival times following an exponential distribution with a hazard ratio of 1.5 for a binary treatment variable. Apply the Kaplan–Meier estimator and Cox proportional hazards model. Estimate the hazard ratio and plot survival curves. Assess proportional hazards assumptions.

  5. Create a dataset with missing values in one predictor. Use listwise deletion, mean imputation and multiple imputation to fit the same regression model. Compare estimates and discuss the impact of missing data handling.

  6. Develop a prediction model for a continuous health outcome using both linear regression and a random forest (or other machine learning method). Use cross‑validation to compare root mean square error (RMSE). Assess calibration of the linear regression model and discuss whether the more flexible model offers meaningful improvement.

  7. Evaluate fairness in a logistic regression model by comparing predicted probabilities across demographic groups (e.g., sex, race). Compute the difference between predicted and observed event rates for each group. Discuss potential sources of bias and propose mitigation strategies.

  8. Select a published health study that reports regression results. Critically assess the reporting: Are model assumptions checked? Are effect sizes and confidence intervals emphasised over p‑values? Is the handling of missing data described? Summarise your findings in a brief report.