Regression Models at a Glance: Linear, Logistic, Poisson and Cox by Outcome Type

On this page
อ่านฉบับภาษาไทย (Thai version)
Abstract
Four regression models cover the most common outcome types in clinical research; the outcome (Y) and the effect measure you want decide which one to use. A number on a continuous scale goes to linear regression, a yes or no outcome to logistic regression, a count or a rate to Poisson regression, and the time until an event to Cox regression. One table puts the four side by side: the Stata command, the shape each model draws, what it assumes and the number it reports. One figure shows that all four share one straight line in the predictors; they differ in the scale on which that line is drawn (the mean of Y, the log-odds, the log rate or the log hazard) and in what they assume about Y. A second figure turns the outcome type into a command. Three deep posts then choose, fit and check each model on one pneumonia cohort.
Start from the outcome (Y)
This series follows one simulated cohort of 1,200 adults admitted with pneumonia, 327 of them with diabetes. Their outcomes come in four kinds: length of stay, ICU admission (yes or no), the number of readmissions, and time to death within 365 days.
The log-odds is the log of the odds, the chance of the event over the chance of no event. Person-time is all follow-up time added up, so a count per person-time is a rate. Counts such as readmissions are overdispersed when they spread out more than a Poisson model allows, often because a few patients are readmitted again and again.
A time is censored when follow-up ends before the event. Censoring is non-informative when follow-up ends for a reason unrelated to the patient's chance of the event, such as the study closing, not the patient getting worse. The hazard is the event rate at a moment among those still event-free. Cox assumes proportional hazards: if patients with diabetes have a different hazard of death from those without, that ratio stays the same from the first day to day 365.
Four models at a glance
| Model and Stata command | Outcome (Y) | Shape the model draws | Assumed distribution | What you report |
|---|---|---|---|---|
Linear, regress | Continuous, e.g. length of stay | A straight line for the mean of Y | Normal errors (the scatter of Y around the line; Y itself need not be Normal), constant variance | Mean difference (the coefficient) |
Logistic, logistic (or logit, or) | Binary, e.g. ICU admission yes or no | An S-curve for the probability; straight on the log-odds scale | Binomial | Odds ratio = exp(coefficient) |
Poisson, poisson, irr (exposure() for person-time; nbreg, irr or vce(robust) if overdispersed) | A count, or events per person-time | An exponential curve for the count or rate; straight on the log scale | Poisson: variance equals mean | Incidence rate ratio = exp(coefficient) |
Cox, stset then stcox | Time to an event, with censoring | Hazards in a constant ratio over time (the survival curve is drawn in steps) | None for the baseline hazard (semi-parametric); assumes proportional hazards | Hazard ratio = exp(coefficient) |
One straight line, four scales
All four models put X into the same straight line, b0 + b1X; what changes is the scale the line is drawn on and the distribution each model assumes. On a log scale exp(b1) is a ratio, any positive number; on the mean scale b1 is a difference. Cox has no b0: its place is taken by the baseline hazard, the hazard of death over time for a reference patient, for example one without diabetes. Cox leaves the shape of that baseline hazard unspecified, so it is semi-parametric.
From the outcome to the command
Ask one question about Y and follow its branch. For a yes or no Y, logistic gives an odds ratio; a risk ratio or a risk difference needs another model, shown in Choose the model, the first link below.
Where to go next
The three deep posts use the same 1,200 patients. Open the one that matches where you are:
- Choose the model: start here if you are not sure which model fits your Y or your effect measure
- Fit it and read the output: you know the model and want the Stata syntax and what each number means
- Check it before you report it: your model runs and you want to test its assumptions before you write it up
Ordered or unordered categories: Multinomial vs Ordinal Logistic Regression [mlogit & ologit]: Choosing the Right Model for Categorical Outcomes. Matched sets: Why Do Logistic and Conditional Logistic Regression Give Different Odds Ratios?.
References
- Nelder JA, Wedderburn RWM. Generalized linear models. Journal of the Royal Statistical Society, Series A 1972;135(3):370-384. https://doi.org/10.2307/2344614
- Cox DR. Regression models and life-tables. Journal of the Royal Statistical Society, Series B 1972;34(2):187-220. https://doi.org/10.1111/j.2517-6161.1972.tb00899.x
Key takeaways
- Start from Y: continuous to regress, yes or no to logistic, count or rate to poisson (nbreg or vce(robust) when overdispersed), time to event to stset and stcox.
- One straight line in X, drawn on four scales: b is a mean difference; exp(b) is an odds, rate or hazard ratio.
- Assumptions: linear, Normal errors (not a Normal Y); logistic, Binomial; Poisson, variance equal to the mean; Cox, proportional hazards and non-informative censoring. All four assume a continuous X is straight on their scale.
Related in the wiki: Which Regression Model? A Decision Flow from Study Design and Outcome (Y) to the Stata Command · Fitting Regression Models in Stata by Outcome Type: Syntax and What Each Coefficient Means · Checking a Regression Model: Assumptions, Diagnostics and What to Do When They Fail