Logistic regression
Shown in the app as logistic_regression. Part of the method reference, under Regression.
When to use
Model a binary outcome from predictors, adjusting for covariates.
What you provide
- Outcome: one two-level column.
- Predictors: one or more columns.
Options
Missing data
- Complete case (listwise deletion)
- Mean imputation (single)
- Median imputation (single)
- Multiple imputation
Multiple comparisons
- Not adjustable for this method. Where it makes post-hoc comparisons, the procedure applies its own correction.
Related methods
Other methods under Regression:
- Linear regression
- Firth penalised logistic regression
- Poisson regression
- Negative-binomial regression
- Ordinal logistic regression
- Multinomial logistic regression
- Factors associated with outcome (continuous outcome)
- Factors associated with outcome (binary outcome)
Guides that discuss this method
- How to choose a statistical test for your data
- Logistic regression: odds ratios and separation
- Odds ratio or relative risk: which to report?
How to read the output
Logistic regression models a yes/no outcome, for example whether a student passes an exam or whether a seedling survives a season, from one or more predictors.
Coefficients and odds ratios. Each coefficient is on the log-odds scale. Exponentiated, it is an odds ratio: for a numeric predictor, the multiplicative change in the odds of the outcome per one-unit increase; for a categorical predictor, the odds in that category relative to the reference category. Each is adjusted for the other predictors in the model. An odds ratio above 1 means higher odds and below 1 lower odds; read it with its 95% confidence interval. The headline result is the odds ratio for the first predictor.
An odds ratio is not a risk ratio. When the outcome is common, the odds ratio is further from 1 than the corresponding risk ratio, so avoid reading it as “times as likely”.
Checks to read alongside. With few events per estimated parameter, coefficients are unstable; a common rule of thumb asks for about 10 events of the rarer outcome per parameter (Peduzzi and colleagues, 1996). The calibration check asks whether predicted probabilities match the observed outcome rates (Hosmer and Lemeshow). If a predictor separates the outcomes perfectly, ordinary estimates do not exist; Celeus flags this and offers penalised (Firth) logistic regression instead.
Sources: Hosmer DW, Lemeshow S, Sturdivant RX (2013), Applied Logistic Regression, 3rd ed., Wiley, doi:10.1002/9781118548387. Peduzzi P et al. (1996), Journal of Clinical Epidemiology 49(12):1373-1379, doi:10.1016/S0895-4356(96)00236-3.
Worked examples
Celeus's result on a published or illustrative dataset, next to an independent computation and, where one exists, a published value. The data themselves are not reproduced here.
datasets::mtcars
- Source: Published dataset distributed with an R package
- Licence: base R (GPL)
- Reference: Henderson & Velleman (1981)
| Quantity | Celeus | Independent computation | Published value | Agrees |
|---|---|---|---|---|
| Estimate | -8.08348 | -8.08348 | - | Yes |
| p-value | 0.00843381 | 0.00843381 | - | Yes |
logistf::sex2
- Source: Published dataset distributed with an R package
- Licence: logistf (GPL)
- Reference: Heinze G, Schemper M (2002), Statistics in Medicine 21:2409-2419 (the worked example); data from Cytel Inc., LogXact 9 user manual
| Quantity | Celeus | Independent computation | Published value | Agrees |
|---|---|---|---|---|
| Estimate | 16.7342 | 16.7342 | - | Yes |
| p-value | 0.983299 | 0.983299 | - | Yes |
MASS::birthwt
- Source: Published dataset distributed with an R package
- Licence: MASS (GPL)
- Reference: Hosmer & Lemeshow (1989), Applied Logistic Regression
| Quantity | Celeus | Independent computation | Published value | Agrees |
|---|---|---|---|---|
| Estimate | -0.0389946 | -0.0389946 | - | Yes |
| p-value | 0.23344 | 0.23344 | - | Yes |
References
- Nelder, J. A., Wedderburn, R. W. M. (1972). Generalized linear models. Journal of the Royal Statistical Society, Series A 135: 370-384. doi:10.2307/2344614 doi:10.2307/2344614