Statistics Lab · step 05

Choose regression.

Use the outcome type to choose the model, then check design, assumptions and the scale of the reported effect.

Outcome: five fitted models whose coefficients answer different questions on clearly named scales.

Seven-step investigationNow: 05 · Choose regression

Analysis checkpoint

Choose the model from the outcome, not from the software menu.

Work through these six prompts in order. Each one supplies what the next one needs.

1 · Before you start

Choose one later outcome and the quantity you want to estimate. Start with six-month disability if this is your first regression; the other outcome routes then reuse the same decision pattern.

Words used on this page

Dependent variable
another name for the outcome being modelled.
Model
a mathematical description linking an outcome to an exposure and other variables.
Estimand
the exact quantity the analysis aims to estimate, such as an adjusted odds ratio.
Covariate
an additional recorded variable included in a model.
Adjusted association
the exposure–outcome comparison after accounting for named covariates; it is not automatically causal.
2 · Why this comes now

Outcome types encode different questions and distributions. Regression comes after unadjusted measures so you can see what adjustment changes and keep the cohort design—not the command—at the centre.

3 · Do this now
  1. Classify the outcome as continuous, binary, ordered, count or time-to-event.
  2. Choose the matching model and select baseline covariates before seeing which result you prefer, using clinical knowledge about likely causes.
  3. Fit the model, check its assumptions and interpret the medication-review coefficient on the correct scale.
Same step in Stata and SPSS

Run Section 05 in Stata or SPSS. Stata and SPSS use different procedures, but the outcome, reference group, covariates and target interpretation must remain identical.

4 · Read this

Find the medication-review estimate, 95% confidence interval and analysis n, then read the model-specific diagnostic. Exp(B) in SPSS and an exponentiated Stata coefficient are ratios; an unexponentiated linear coefficient is a mean difference.

5 · Ready to continue when

You can justify the model from the outcome, explain every adjustment variable, name the effect scale and report an adjusted association without claiming an effect.

6 · Next step 06 · Understand confounding Compare crude and adjusted estimates using the cohort timeline.

Design before model

Define what the cohort can answer.

Every model compares participants who did and did not receive medication review at baseline, then relates that exposure to a later six-month outcome. The target is an adjusted association under the assumptions that the model is correctly specified and that the recorded baseline variables adequately address confounding. It is not automatically a causal effect.

Continuous

Linear

Adjusted mean difference. Check linearity, residual pattern, influential cases and dependence.

Binary

Logistic

Adjusted odds ratio. Add predicted probabilities when absolute interpretation matters.

Ordered

Ordered logistic

Cumulative odds across ordered thresholds. Check proportional odds.

Count

Poisson

Incidence-rate ratio. Check exposure time, overdispersion and excess zeros.

Time to event

Cox

Hazard ratio with censoring. Check the proportional-hazards assumption.

Model choice does not end at “continuous or binary”. Repeated measures, clustering, competing risks, non-linearity and survey design can all require a different model or variance estimator.

Adjustment rationale

Why are these baseline variables in the models?

The teaching adjustment set is chosen before fitting the outcome models. Each variable was measured before medication review and is a plausible cause, or marker of causes, of both review allocation and later health. The same set makes the five worked models comparable; a real protocol should justify the set separately for its precise estimand and outcome.

Baseline variableWhy it may affect reviewWhy it may affect outcomes
AgeOlder adults may trigger closer medicines review.Age predicts frailty, disability, falls and admission.
SexPrescribing and care pathways may differ.Outcome risks and health trajectories may differ.
Living aloneMedication support needs may prompt review.Social support can affect disability and hospital use.
DeprivationAccess, prescribing burden and clinical need may differ.Deprivation is associated with later health.
Medication countIt is a direct reason to consider a review.Treatment burden and multimorbidity predict adverse outcomes.
Baseline frailtyFrailer participants are more likely to be reviewed.It strongly predicts every later outcome considered here.
Baseline disabilityExisting functional problems can prompt review.It predicts later disability and wider health outcomes.

Not included twice: polypharmacy is derived from medication count, so including both would encode the same information twice. Variables recorded after review would not belong in a total-effect adjustment set if they could be mediators.

Five outcome routes

Work from the outcome to the interpretation.

Continuous outcome

Quality of life at six months

What are we interested in?

The adjusted difference in mean EQ-5D-style score between reviewed and unreviewed participants.

  1. Model: linear regression because the outcome is a bounded but approximately continuous score.
  2. Reference: no medication review.
  3. Check: residual pattern, linearity of continuous covariates, influential observations and whether the bounded scale causes serious misfit.
medication review coefficient = +0.047
95% CI                         = +0.034 to +0.059
analysis n                     = 704
Interpret exactly

After adjustment for the pre-specified baseline variables, reviewed participants had a mean six-month quality-of-life score 0.047 points higher than unreviewed participants (95% CI 0.034 to 0.059). This is an adjusted cohort association, not proof that review caused the difference.

Binary outcome

Disability by six months

What are we interested in?

The adjusted relative odds of disability for reviewed versus unreviewed participants.

  1. Model: logistic regression because disability is recorded yes/no.
  2. Reference: no medication review; an odds ratio of 1 means equal adjusted odds.
  3. Check: outcome coding, linearity on the logit for continuous covariates, influential observations and sparse cells.
adjusted odds ratio            = 0.64
95% CI                         = 0.41 to 1.01
analysis n                     = 712
Interpret exactly

After adjustment, the reviewed group had an estimated 36% lower odds of six-month disability than the unreviewed group (OR 0.64, 95% CI 0.41 to 1.01). The interval includes 1 and is compatible with substantially lower odds through to almost no difference. Odds are not risks.

Ordered outcome

Robust, pre-frail or frail

What are we interested in?

The adjusted odds of being in a worse frailty category rather than a better category.

  1. Model: ordered logistic regression because the three categories have a meaningful order.
  2. Reference: no medication review; categories remain ordered from robust to frail.
  3. Check: the proportional-odds assumption, which requires one exposure odds ratio to describe every cumulative cut-point.
adjusted common odds ratio     = 0.43
95% CI                         = 0.28 to 0.66
analysis n                     = 705
Interpret exactly

Assuming proportional odds, reviewed participants had 57% lower adjusted odds of being at or above a worse frailty category than unreviewed participants (common OR 0.43, 95% CI 0.28 to 0.66). The interpretation applies across both category thresholds.

Count outcome

Number of falls during follow-up

What are we interested in?

The adjusted rate of recorded falls in the reviewed group relative to the unreviewed group.

  1. Model: Poisson regression because participants can experience zero, one or several falls.
  2. Follow-up: all participants share the same six-month window here; unequal time would require an exposure offset.
  3. Check: overdispersion, excess zeros and whether a negative-binomial or other count model is more credible.
adjusted incidence-rate ratio  = 0.79
95% CI                         = 0.63 to 0.98
analysis n                     = 710
Interpret exactly

The adjusted fall rate in reviewed participants was 0.79 times that in unreviewed participants—about 21% lower (IRR 0.79, 95% CI 0.63 to 0.98). This concerns the event rate, not the proportion of people who fell.

Time-to-event outcome

Time to first emergency admission

What are we interested in?

The adjusted admission hazard at each observed time among participants still admission-free.

  1. Model: Cox regression because the timing of admission and right-censoring both matter.
  2. Data: follow-up days plus an indicator of first admission; 134 admissions occurred among 720 participants.
  3. Check: proportional hazards, influential observations, censoring assumptions and competing events.
adjusted hazard ratio          = 0.70
95% CI                         = 0.47 to 1.07
participants / events         = 720 / 134
Interpret exactly

At any observed time, reviewed participants had an estimated 30% lower admission hazard than unreviewed participants after adjustment (HR 0.70, 95% CI 0.47 to 1.07). The interval includes 1. This does not mean that 30% fewer people were admitted.

Run the models

Equivalent syntax, one epidemiological interpretation.

Stata, SPSS and R arrange their output differently. The coefficient, reference group, adjustment set and interpretation should nevertheless answer the same cohort question.

Stata

The Stata command changes with the outcome. Factor-variable prefixes keep binary and categorical predictors explicit.

regress eq5d_6m i.med_review c.age_years i.sex i.lives_alone ///
    c.deprivation_score c.medication_count c.baseline_frailty ///
    i.baseline_disability

logistic disability_6m i.med_review c.age_years i.sex ///
    i.lives_alone c.deprivation_score c.medication_count ///
    c.baseline_frailty i.baseline_disability

ologit frailty_cat_6m i.med_review c.age_years i.sex ///
    i.lives_alone c.deprivation_score c.medication_count ///
    c.baseline_frailty i.baseline_disability, or

poisson falls_count_6m i.med_review c.age_years i.sex ///
    i.lives_alone c.deprivation_score c.medication_count ///
    c.baseline_frailty i.baseline_disability, irr

stset followup_days, failure(hospital_admission_6m == 1)
stcox i.med_review c.age_years i.sex i.lives_alone ///
    c.deprivation_score c.medication_count c.baseline_frailty ///
    i.baseline_disability
Download the complete commented Stata do-file
IBM SPSS Statistics

REGRESSION, LOGISTIC REGRESSION, PLUM, GENLIN and COXREG are distinct procedures with distinct assumptions.

REGRESSION
  /DEPENDENT eq5d_6m
  /METHOD=ENTER med_review age_years sex lives_alone
    deprivation_score medication_count baseline_frailty
    baseline_disability.

LOGISTIC REGRESSION VARIABLES disability_6m
  /METHOD=ENTER med_review age_years sex lives_alone
    deprivation_score medication_count baseline_frailty
    baseline_disability
  /CATEGORICAL=med_review sex lives_alone baseline_disability
  /CONTRAST (med_review)=Indicator(1)
  /PRINT=CI(95).

PLUM frailty_cat_6m
  WITH med_review sex lives_alone baseline_disability age_years
    deprivation_score medication_count baseline_frailty
  /LINK=LOGIT
  /PRINT=FIT PARAMETER TPARALLEL.

GENLIN falls_count_6m
  WITH med_review sex lives_alone baseline_disability age_years
    deprivation_score medication_count baseline_frailty
  /MODEL med_review sex lives_alone baseline_disability age_years
    deprivation_score medication_count baseline_frailty
    DISTRIBUTION=POISSON LINK=LOG.

COXREG followup_days
  /STATUS=hospital_admission_6m(1)
  /METHOD=ENTER med_review age_years sex lives_alone
    deprivation_score medication_count baseline_frailty
    baseline_disability
  /CONTRAST (med_review)=Indicator(1).
Download the complete commented SPSS syntax file
R and RStudio

The R function and family encode the outcome distribution; MASS and survival provide ordered and Cox models.

linear_model <- lm(
  eq5d_6m ~ med_review + age_years + factor(sex) +
    factor(lives_alone) + deprivation_score + medication_count +
    baseline_frailty + factor(baseline_disability),
  data = cohort
)

logistic_model <- glm(
  disability_6m ~ med_review + age_years + factor(sex) +
    factor(lives_alone) + deprivation_score + medication_count +
    baseline_frailty + factor(baseline_disability),
  family = binomial(link = "logit"),
  data = cohort
)

ordinal_model <- MASS::polr(
  frailty_cat_f ~ med_review + age_years + factor(sex) +
    factor(lives_alone) + deprivation_score + medication_count +
    baseline_frailty + factor(baseline_disability),
  data = cohort,
  Hess = TRUE
)

poisson_model <- glm(
  falls_count_6m ~ med_review + age_years + factor(sex) +
    factor(lives_alone) + deprivation_score + medication_count +
    baseline_frailty + factor(baseline_disability),
  family = poisson(link = "log"),
  data = cohort
)

cox_model <- survival::coxph(
  survival::Surv(followup_days, hospital_admission_6m) ~
    med_review + age_years + factor(sex) +
    factor(lives_alone) + deprivation_score + medication_count +
    baseline_frailty + factor(baseline_disability),
  data = cohort
)
Download the complete commented R script

Official documentation

Model details and diagnostics.

Stata linear regression

Official command reference, estimators and robust variance details.

Open manual

Stata ordered logistic

Syntax, interpretation and worked proportional-odds examples.

Open manual

IBM ordinal regression

Why an ordered outcome needs a model that preserves category order.

Open IBM documentation