What Is Logistic Regression?
The word "logistic" refers to the logistic function (sometimes called the sigmoid function), which takes any real number and maps it to the interval (0, 1). That property is what makes logistic regression suitable for binary outcomes: no matter how large or small the linear predictor is, the fitted probability stays between zero and one.
Logistic regression is part of the generalized linear model family. The underlying theory connects to inferential statistics and probability. For related background, see the main logistic regression page, or contrast it with simple linear regression and multiple linear regression.
Healthcare
Predict disease presence or absence from clinical measurements and patient history.
Finance
Model loan default, credit card fraud, or stock market direction (up/down).
Marketing
Estimate purchase probability, email click-through, or churn from customer data.
Education
Predict pass/fail, dropout risk, or program completion from student characteristics.
The Logistic Function and Logistic Regression Equation
The logistic function converts any real number into a probability. If the linear predictor is called η (eta), then:
p = predicted probability (between 0 and 1)
η = β₀ + β₁X₁ + ... + βₖXₖ (linear predictor)
e = Euler's number ≈ 2.71828
The S-Shaped Logistic Curve
The full logistic regression equation is written two ways. The log-odds form is the standard model equation; the probability form shows what the model actually predicts:
log(p/1−p) = log-odds (logit of p)
β₀ = intercept
β₁...βₖ = predictor coefficients
X₁...Xₖ = predictor values
Probability, Odds, and Log-Odds
One of the most important things to get right in logistic regression is understanding three related but distinct concepts. Many interpretation mistakes come from treating odds as if they were probabilities, or treating odds ratios as if they were probability ratios.
From Probability to Odds to Log-Odds
Start with probability p = 0.80
The event occurs 80% of the time under the model.
Calculate odds: Odds = p / (1 − p) = 0.80 / 0.20 = 4.00
The event is 4 times more likely to occur than not occur.
Calculate log-odds: logit(0.80) = ln(4.00) ≈ 1.386
This is what the linear predictor η equals when p = 0.80.
Reverse: log-odds back to probability
p = 1 / (1 + e−1.386) = 1 / (1 + 0.25) = 1 / 1.25 = 0.80 ✓
| Probability (p) | Odds (p / 1−p) | Log-Odds (logit) |
|---|---|---|
| 0.10 | 0.111 | −2.197 |
| 0.20 | 0.250 | −1.386 |
| 0.30 | 0.429 | −0.847 |
| 0.50 | 1.000 | 0.000 |
| 0.70 | 2.333 | 0.847 |
| 0.80 | 4.000 | 1.386 |
| 0.90 | 9.000 | 2.197 |
When p = 0.50, the odds equal 1.00 and the log-odds equal 0. The logistic curve always passes through the point where η = 0 and p = 0.5.
What Is an Odds Ratio in Logistic Regression?
Each coefficient in a logistic regression model represents the change in log-odds for a one-unit increase in that predictor, holding all other predictors constant. Exponentiating the coefficient gives the odds ratio (OR):
OR = odds ratio
β = logistic regression coefficient
e = Euler's number ≈ 2.71828
An OR of 2 does NOT mean the probability doubles. It means the odds are twice as high. At p = 0.50 (odds = 1), doubling the odds gives odds = 2, which corresponds to p ≈ 0.67, not p = 1.0.
Odds Ratio Calculation Example
Interpreting Two Coefficients
Coefficient β₁ = 0.693 (study hours)
OR = e0.693 ≈ 2.00
Interpretation: Each additional study hour is associated with approximately twice the odds of passing the exam, holding other model variables constant.
Coefficient β₂ = −0.693 (absences)
OR = e−0.693 ≈ 0.50
Interpretation: Each additional absence is associated with approximately half the odds of passing, holding other model variables constant. This is a 50% reduction in the odds, not a 50% reduction in probability.
Example 1: Predicting Whether a Student Passes an Exam
This example uses a small dataset to walk through every step: from raw data to fitted equation to predicted probability to classification. The outcome is binary (Pass = 1, Fail = 0). The two predictors are study hours per week and attendance percentage.
| Student | Study Hours (X₁) | Attendance % (X₂) | Pass (Y) |
|---|---|---|---|
| 1 | 2 | 60 | 0 |
| 2 | 3 | 65 | 0 |
| 3 | 4 | 70 | 0 |
| 4 | 5 | 72 | 1 |
| 5 | 6 | 75 | 1 |
| 6 | 7 | 78 | 1 |
| 7 | 8 | 80 | 1 |
| 8 | 5 | 68 | 0 |
| 9 | 9 | 85 | 1 |
| 10 | 10 | 90 | 1 |
| 11 | 3 | 62 | 0 |
| 12 | 7 | 82 | 1 |
12 students: 8 passed (Y=1), 4 failed (Y=0).
Fitted Model
Applying maximum likelihood estimation to the dataset above yields (illustrative of a model fitted to this data):
β₀ = −12.4
Study Hours β₁ = 0.75 → OR = e⁰·⁷⁵ ≈ 2.12
Attendance β₂ = 0.10 → OR = e⁰·¹⁰ ≈ 1.11
Step-by-Step: Predicting a New Student's Probability
Study Hours = 7, Attendance = 78%
Calculate the linear predictor η:
η = −12.4 + (0.75 × 7) + (0.10 × 78) = −12.4 + 5.25 + 7.8 = 0.65
Convert log-odds to probability:
p = 1 / (1 + e−0.65) = 1 / (1 + 0.522) = 1 / 1.522 ≈ 0.657
Apply the classification threshold (0.50):
0.657 > 0.50, so predicted class = Pass (Y = 1)
Interpret the coefficient for study hours:
OR = e0.75 ≈ 2.12. Each additional study hour is associated with approximately 2.12 times the odds of passing, holding attendance constant.
✓ The fitted model estimates a 65.7% probability of passing for a student with 7 study hours and 78% attendance. At a 0.50 threshold, this student is classified as likely to pass.
Study Hours = 3, Attendance = 62%
η = −12.4 + (0.75 × 3) + (0.10 × 62)
= −12.4 + 2.25 + 6.20 = −3.95
p = 1 / (1 + e−(−3.95)) = 1 / (1 + e3.95)
= 1 / (1 + 52.46) ≈ 0.019
0.019 < 0.50, so predicted class = Fail (Y = 0)
✓ Estimated probability of passing is only 1.9%. At a 0.50 threshold, this student is classified as likely to fail.
Example 2: Medical Diagnosis (Disease Present or Absent)
A clinical researcher models whether a patient tests positive for a metabolic condition, using three predictors: age, blood pressure, and smoking status. Smoking is a binary predictor (0 = non-smoker, 1 = smoker).
Patient: Age = 55, BP = 140 mmHg, Smoker = 1
η = −9.2 + (0.04 × 55) + (0.03 × 140) + (1.12 × 1)
= −9.2 + 2.2 + 4.2 + 1.12 = −1.68
p = 1 / (1 + e1.68) = 1 / (1 + 5.366) ≈ 0.157
Interpret the smoking coefficient:
OR = e1.12 ≈ 3.06. Smokers in this model have approximately 3.06 times the odds of testing positive compared to non-smokers of the same age and blood pressure. This association does not prove that smoking causes the condition.
✓ The fitted model estimates a 15.7% probability of testing positive for a 55-year-old smoker with BP of 140. Note that "associated with" language is appropriate here; the study design determines whether causal conclusions are warranted.
Example 3: Customer Purchase Prediction
An e-commerce company fits a logistic regression model to predict whether a website visitor will complete a purchase. The three predictors are: number of website visits in the past 30 days, number of previous purchases, and whether a discount was offered (0 = no, 1 = yes).
Customer A: 8 visits, 3 prior purchases, discount offered
η = −4.8 + (0.15 × 8) + (0.55 × 3) + (1.30 × 1)
= −4.8 + 1.2 + 1.65 + 1.30 = −0.65
p = 1 / (1 + e0.65) = 1 / (1 + 1.916) ≈ 0.343
Interpret discount coefficient:
OR = e1.30 ≈ 3.67. Customers who received a discount have approximately 3.67 times the odds of purchasing compared to those who did not, holding visits and prior purchases constant.
✓ Estimated purchase probability: 34.3%. At a 0.50 threshold, this customer is predicted not to purchase. The business might lower the threshold to catch more potential buyers at the cost of more false positives.
Example 4: Loan Approval Probability
A financial institution uses logistic regression to estimate whether a loan applicant will be approved (Y = 1) or declined (Y = 0). The three predictors are: annual income (thousands), debt-to-income ratio, and credit score.
Applicant: Income = $75k, Debt Ratio = 28%, Credit Score = 720
η = −15.0 + (0.06 × 75) + (−0.30 × 28) + (0.018 × 720)
= −15.0 + 4.5 − 8.4 + 12.96 = 4.06
p = 1 / (1 + e−4.06) = 1 / (1 + 0.017) ≈ 0.983
Interpret debt ratio coefficient:
OR = e−0.30 ≈ 0.741. A one-unit increase in the debt-to-income ratio is associated with approximately 26% lower odds of approval, holding income and credit score constant. (1 − 0.741 = 0.259, so about 26% lower.)
✓ Estimated approval probability: 98.3%. This applicant is classified as approved at any reasonable threshold. This page uses an educational model; real lending decisions require validation, fairness assessment, and domain expertise.
Interactive Logistic Regression Calculator
The calculator below lets you convert log-odds to probability, compute odds from probability, or estimate fitted probability using a simple single-predictor logistic equation. For full multi-predictor MLE on your own data, software such as R, Python, or SPSS is recommended.
Logistic Regression Calculator
Classification Thresholds and the Confusion Matrix
Logistic regression produces a probability for each observation. To classify observations as outcome = 1 or outcome = 0, you apply a threshold. The standard default is 0.50, but this is not always the best choice. The right threshold depends on how costly false positives are compared to false negatives.
Classification Threshold Explorer
Move the slider to see how changing the threshold affects confusion matrix metrics. Uses the fitted probabilities from Example 1 (12 students).
Confusion Matrix Structure
| Actual Positive (Y=1) | Actual Negative (Y=0) | |
|---|---|---|
| Predicted Positive | TP True Positive |
FP False Positive |
| Predicted Negative | FN False Negative |
TN True Negative |
Classification Metrics
If 95% of observations have Y=0, a model that always predicts 0 would achieve 95% accuracy while correctly identifying zero positive cases. Sensitivity, specificity, and ROC-AUC are more informative when the outcome is rare.
ROC Curve and AUC
The ROC (Receiver Operating Characteristic) curve plots sensitivity (true positive rate) against 1 − specificity (false positive rate) at every possible threshold. The area under the ROC curve (AUC) summarizes the model's ability to rank higher-risk observations above lower-risk ones.
ROC Curve (Conceptual)
A model with high AUC can still have poorly calibrated probabilities. A model with AUC = 0.85 could predict 0.40 for an observation that actually has a 0.80 true probability. Use calibration plots to check whether predicted probabilities match observed event rates.
Logistic Regression Assumptions
Logistic regression has different assumptions from linear regression. The most important ones to check:
Binary (or Categorical) Outcome
Standard binary logistic regression requires the outcome to have exactly two categories, coded 0 and 1. Make sure the coding is clear and documented: which value is the "event" (Y=1)?
Independent Observations
Each observation must be independent of the others. Clustered or repeated-measures data requires different methods, such as mixed models or GEE.
Linearity in the Logit
The relationship between continuous predictors and the log-odds should be approximately linear. This does not mean the relationship between predictors and probability must be linear. Check with plots or by adding polynomial terms.
No Perfect Multicollinearity
Predictors should not be exact linear combinations of one another. High (but not perfect) correlation inflates standard errors and produces wide confidence intervals but does not automatically invalidate the model.
Sufficient Events
The number of events (the less common outcome) should be adequate relative to the number of predictors. Traditional rules of thumb (e.g., 10 events per predictor) are rough heuristics with known limitations. Simulation-based power analysis is more reliable when the dataset is small.
Logistic regression does not assume normally distributed predictors, normally distributed residuals, or homoscedasticity. These are linear regression assumptions and do not apply here.
Logistic vs Linear Regression
| Feature | Linear Regression | Logistic Regression |
|---|---|---|
| Typical outcome | Continuous numeric | Binary (or categorical) |
| Prediction | Expected value of Y | Probability (0 to 1) |
| Model scale | Outcome directly | Log-odds (logit) |
| Estimation method | Ordinary least squares | Maximum likelihood |
| Coefficient meaning | Change in expected Y | Change in log-odds |
| Exponentiated coefficient | Not typically an odds ratio | Odds ratio |
| Residual assumptions | Normality, homoscedasticity | Not required |
| Model fit measure | R² (variance explained) | Pseudo-R², AUC, deviance |
| Example use case | Predict salary from experience | Predict hired (yes/no) from experience |
For more detail on the linear side, see simple linear regression and multiple linear regression. Correlation between predictors and outcomes is discussed in the Pearson correlation section.
Logistic Regression in R, Python, SPSS, and Stata
R
Use glm() with family = binomial(link = "logit"). The link = "logit" is the default for binary outcomes and does not need to be written explicitly in most versions, but specifying it is good practice for clarity.
# Fit the model
model <- glm(
pass ~ study_hours + attendance,
data = student_data,
family = binomial(link = "logit")
)
# View coefficient table
summary(model)
# Odds ratios
exp(coef(model))
# Confidence intervals for odds ratios (profile likelihood)
exp(confint(model))
# Predicted probabilities for the original data
fitted_probs <- fitted(model)
# Predict for new data
new_student <- data.frame(study_hours = 7, attendance = 78)
predict(model, newdata = new_student, type = "response")
Python (statsmodels)
For inferential output (p-values, confidence intervals, standard errors), use statsmodels. For purely predictive pipelines, scikit-learn is common but uses regularization by default and does not produce standard inferential output.
import statsmodels.formula.api as smf
import numpy as np
import pandas as pd
# Fit the model
model = smf.logit(
"pass ~ study_hours + attendance",
data=student_data
).fit()
# View summary table
print(model.summary())
# Odds ratios
print(np.exp(model.params))
# Confidence intervals (odds ratio scale)
print(np.exp(model.conf_int()))
# Predict probability for new observation
new_obs = pd.DataFrame({"study_hours": [7], "attendance": [78]})
print(model.predict(new_obs))
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import classification_report, roc_auc_score
# Note: scikit-learn uses L2 regularization by default (C=1.0)
# Set penalty='none' for unpenalized estimation (requires solver='lbfgs')
model = LogisticRegression(penalty=None, solver='lbfgs')
model.fit(X_train, y_train)
# Predicted probabilities (column 1 = probability of Y=1)
probs = model.predict_proba(X_test)[:, 1]
# Classification report: precision, recall, F1
print(classification_report(y_test, model.predict(X_test)))
# AUC
print("AUC:", roc_auc_score(y_test, probs))
SPSS
In SPSS, go to Analyze → Regression → Binary Logistic. Place your binary outcome in the Dependent box and your predictors in the Covariates box. For categorical predictors, use the Categorical button to set the reference category.
Key output to interpret:
- B: The coefficient on the log-odds scale.
- S.E.: Standard error of B.
- Wald: Test statistic (B / S.E.) squared; tests whether the coefficient differs from zero.
- Sig.: p-value for the Wald test.
- Exp(B): The odds ratio.
- 95% CI for Exp(B): Confidence interval for the odds ratio.
Stata
* Fit logistic regression: outputs log-odds coefficients
logit pass study_hours attendance
* Fit and display odds ratios directly
logistic pass study_hours attendance
* Predicted probabilities
predict fitted_prob, pr
* ROC curve and AUC
lroc
* Classification table at threshold 0.5
estat classification
Excel
Excel's standard Regression tool (Data Analysis Toolpak) performs linear regression and is not appropriate for logistic regression. To fit logistic regression in Excel, users typically use Excel's Solver add-in to maximize the log-likelihood numerically, which requires careful setup. For most purposes, R, Python, SPSS, or Stata will produce more reliable and better-validated results. If you must stay in Excel, consider exporting data to a dedicated statistical package.
How to Read Logistic Regression Output
A typical logistic regression coefficient table (shown here in the format most software produces) includes the following columns. This example uses the exam pass model from Example 1:
| Predictor | B (Coef.) | S.E. | z / Wald | p-value | Exp(B) / OR | 95% CI (OR) |
|---|---|---|---|---|---|---|
| Intercept | −12.40 | 4.20 | −2.95 | 0.003 | <0.001 | - |
| Study Hours | 0.75 | 0.31 | 2.42 | 0.016 | 2.12 | [1.15, 3.90] |
| Attendance | 0.10 | 0.06 | 1.67 | 0.095 | 1.11 | [0.98, 1.24] |
What each column tells you:
- B: Study hours has a coefficient of 0.75. This is the estimated change in log-odds for each additional study hour, holding attendance constant.
- Exp(B) = 2.12: Each additional study hour is associated with 2.12 times the odds of passing, holding attendance constant.
- 95% CI [1.15, 3.90]: The confidence interval does not cross 1.00, so the association is statistically distinguishable from no association at the 5% level.
- Attendance CI [0.98, 1.24]: This interval crosses 1.00, meaning the evidence for an attendance effect is weaker (p = 0.095 with this sample size).
When a 95% confidence interval for an odds ratio includes 1.00, the association is not statistically significant at the 5% level. This does not mean there is no association; it means the data are insufficient to rule out OR = 1 at the chosen significance threshold.
Assessing Logistic Regression Model Fit
Several measures describe how well a logistic regression model fits the data. None of them is a direct equivalent to R² from linear regression.
| Measure | What It Captures | Typical Range |
|---|---|---|
| Log-likelihood | Fit of the model under maximum likelihood; more negative = worse fit | Negative values |
| Deviance | −2 × log-likelihood; lower = better fit | Positive values |
| AIC | Deviance penalized for number of parameters; for model comparison | Lower = better |
| McFadden pseudo-R² | Proportional improvement in log-likelihood over the null model; 0.2-0.4 is considered good for many contexts | 0 to 1 |
| AUC (ROC) | Discrimination: how well the model ranks positive cases above negative cases | 0.5 to 1.0 |
| Calibration plot | Whether predicted probabilities match observed event frequencies | Visual; Hosmer-Lemeshow test |
McFadden's pseudo-R² of 0.20 does not mean the model explains 20% of the variance. The values are generally lower than ordinary R², and comparing them across different datasets or outcome types is misleading. Use pseudo-R² only for comparing models on the same data.
Common Logistic Regression Mistakes
| Mistake | Incorrect | Correct |
|---|---|---|
| Interpreting OR | OR = 2 means probability doubles | OR = 2 means odds are twice as high |
| Coefficient scale | B = 0.75 means a 75% higher probability | B = 0.75 means a 0.75 increase in log-odds |
| Statistical significance | p < 0.05 proves the effect is important | p < 0.05 means evidence against H₀; look at CI width and OR magnitude |
| Accuracy | 95% accuracy means the model is excellent | Accuracy can be high if the majority class dominates; check sensitivity and specificity |
| AUC and calibration | AUC = 0.85 means probabilities are well-calibrated | AUC measures discrimination; calibration requires separate checks |
| Normality | Predictors must be normally distributed | No normality requirement for predictors in logistic regression |
| Causation | A significant coefficient proves X causes the outcome | Logistic regression estimates associations; causation requires appropriate study design |
| Threshold | 0.50 is always the correct classification cutoff | Optimal threshold depends on the relative costs of false positives and false negatives |
| Pseudo-R² | McFadden R² = 0.15 means 15% of variance explained | Pseudo-R² measures are not directly comparable to ordinary R² |
| Reference category | Forgetting which category was treated as the reference | Always specify which category is the reference when interpreting odds ratios for categorical predictors |
Practice Problems
Log-odds = ln(1.50) ≈ 0.405
So the odds are 1.5 to 1 in favor of the event, and the log-odds (logit) are approximately 0.405.
The predicted probability is approximately 30%.
Each additional hour of exercise per week is associated with approximately 1.50 times the odds of the modeled outcome (50% higher odds), holding other predictors in the model constant. This is a 50% increase in the odds, not a 50% increase in probability.
p = 1 / (1 + e0) = 1 / (1 + 1) = 1 / 2 = 0.50
When the linear predictor equals zero, the predicted probability is exactly 0.50. This makes sense because logit(0.5) = 0.
Sensitivity = TP / (TP + FN) = 30 / (30 + 15) = 30 / 45 ≈ 66.7%
Specificity = TN / (TN + FP) = 45 / (45 + 10) = 45 / 55 ≈ 81.8%
The model identifies about two-thirds of actual positives correctly and correctly identifies about 82% of actual negatives.
Related Topics and Further Reading
Logistic Regression
The main logistic regression page covering theory, assumptions, and extensions to multinomial and ordinal outcomes.
Hypothesis Testing
Wald tests, likelihood-ratio tests, and p-value interpretation that apply directly to logistic regression coefficients.
Confidence Intervals
How confidence intervals are constructed and interpreted, including for odds ratios from logistic regression.
Pearson Correlation
Assessing linear relationships between predictors, which matters when checking multicollinearity.
Simple Linear Regression
The regression model for continuous outcomes, which helps clarify why logistic regression is needed for binary outcomes.
Multiple Linear Regression
Multi-predictor regression with continuous outcomes; contrast with multiple logistic regression.
Probability Rules
The probability foundations underlying logistic regression, including conditional probability and odds.
Statistical Assumptions
Overview of regression assumptions and diagnostic methods including normality and multicollinearity testing.
Frequently Asked Questions
Logistic regression is a statistical model for estimating the probability of a binary outcome. It models the log-odds of the outcome as a linear combination of predictors, then transforms the result into a probability between 0 and 1 using the logistic function. It is used when the outcome has two categories, such as pass/fail, purchase/no purchase, or disease present/absent.
The model equation is: logit(p) = log(p / 1−p) = β₀ + β₁X₁ + ... + βₖXₖ. The probability is obtained by applying the logistic function: p = 1 / (1 + e−η), where η is the linear predictor. The coefficients are estimated by maximum likelihood.
An odds ratio is the exponentiated coefficient: OR = eβ. An OR greater than 1 means higher predictor values are associated with higher odds of the outcome. An OR less than 1 means lower odds. An OR of exactly 1 corresponds to no linear association. The odds ratio does not equal a probability ratio: OR = 2 does not mean the probability doubles.
Linear regression applied to a binary outcome can produce predicted values below 0 or above 1, which are not valid probabilities. The constant variance assumption also fails with binary data. Logistic regression solves this by modeling the log-odds, which can range over all real numbers, and converting it to a probability that stays between 0 and 1.
No. Logistic regression does not require normally distributed predictors, normally distributed errors, or equal variance across groups. These are linear regression assumptions. Logistic regression does assume that continuous predictors have an approximately linear relationship with the log-odds of the outcome, but not that the predictors themselves are normal.
A classification threshold converts a predicted probability into a predicted class. For example, with a threshold of 0.50, observations with p ≥ 0.50 are predicted as Y = 1 and those with p < 0.50 as Y = 0. The threshold of 0.50 is the default but is not always optimal. When false negatives are more costly than false positives (such as in medical screening), a lower threshold raises sensitivity at the cost of specificity.
Relative risk (risk ratio) is the ratio of two probabilities: P(outcome | exposed) / P(outcome | unexposed). Odds ratio is the ratio of two odds. When the outcome is rare, the OR approximates the relative risk. When the outcome is common, they can differ substantially. Logistic regression directly produces odds ratios, not relative risks. To estimate relative risks from a logistic model, alternative methods such as Poisson regression with robust standard errors or modified Poisson regression are sometimes used.
Use the glm() function with family = binomial(link = "logit"). For example: model <- glm(outcome ~ x1 + x2, data = df, family = binomial()). View results with summary(model) and get odds ratios with exp(coef(model)). Confidence intervals for odds ratios: exp(confint(model)).
Sample size needs depend on the number of predictors, the prevalence of the outcome, the effect sizes of interest, and how much precision you need in coefficient estimates. Traditional heuristics such as "10 events per predictor" are rough guides with known limitations. For small or imbalanced samples, simulation-based power analysis provides better guidance. Penalized methods such as Firth logistic regression can help when samples are small relative to the number of predictors.
Complete separation occurs when a predictor or combination of predictors perfectly distinguishes all positive from all negative cases. When this happens, the maximum likelihood coefficient estimate tends toward infinity and standard errors become very large or the algorithm fails to converge. Quasi-complete separation occurs when separation is near-perfect. Solutions include collecting more data, combining sparse categories, using penalized methods such as Firth logistic regression, or Bayesian methods with informative priors.
Key Takeaways
- Logistic regression models the probability of a binary outcome through the log-odds transformation, keeping fitted values between 0 and 1.
- Coefficients are on the log-odds scale. Exponentiating them gives odds ratios.
- OR > 1 means higher odds; OR < 1 means lower odds. An OR of 2 does not mean probability doubles.
- To get a predicted probability: calculate the linear predictor η, then apply p = 1 / (1 + e−η).
- Classification requires choosing a threshold. The default of 0.50 is not always optimal.
- Accuracy alone is misleading with imbalanced outcomes. Use sensitivity, specificity, and AUC as well.
- AUC measures discrimination (ranking), not calibration (probability accuracy). Check both.
- Logistic regression does not assume normally distributed predictors or residuals.
- A statistically significant coefficient does not establish that the predictor causes the outcome.
- In R, use
glm(family = binomial()). In Python, usestatsmodels.formula.api.logitfor inference.