Logistic Regression Tool

New

Fit and interpret logistic regression models for marketing data with a binary outcome and a mix of continuous and categorical predictors. Upload raw rows, pick your success outcome, and compare the marginal effects of each predictor on conversion probabilities with confidence intervals and diagnostics.

👨‍🏫 Professor Mode: Guided Learning Experience

New to logistic regression? Enable Professor Mode for step-by-step guidance through building and interpreting your first model!

QUICK START: Choose Your Path

TEST OVERVIEW & EQUATIONS

Logistic regression estimates how the probability of a binary outcome (such as convert vs. not convert) changes with several predictors \(X_1, X_2, \dots, X_p\). Each coefficient shows the unique association of a predictor with the log-odds of success, holding the others constant.

Model: $$ \log\left(\frac{p_i}{1 - p_i}\right) = \beta_0 + \beta_1 X_{1i} + \beta_2 X_{2i} + \dots + \beta_p X_{pi} $$ where \(p_i = \Pr(Y_i = 1 \mid X_{1i}, \dots, X_{pi})\).

Coefficient tests: $$ z_j = \frac{\hat{\beta}_j}{\mathrm{SE}(\hat{\beta}_j)} $$ with p-values based on the standard normal distribution.

Model comparison: $$ \Delta D = D_{\text{null}} - D_{\text{model}} $$ can be compared using a chi-square test to see whether the predictors, as a set, improve fit vs. an intercept-only model.

Binary Outcome & Predictor Types

The outcome must be coded as a binary variable (for example, 0/1 or success/failure). Continuous predictors use their numeric scale. Categorical predictors are dummy-coded with a reference level, so each coefficient compares a category to its reference while holding other predictors constant.

DATA SOURCE

📚

Use a Case Study

Use presets to explore realistic use cases, such as ad spend vs. revenue or control vs. treatment on order value. Each scenario can expose either a summary CSV of aggregated statistics or a raw data file that you can download, edit in Excel, and re-upload.

📂

Upload Your Data

Upload a CSV file with raw case-level data. Include one binary outcome column (0/1 or two categories) and multiple predictors (numeric or categorical). Headers are required.

Drag & Drop raw data file (.csv, .tsv, .txt, .xls, .xlsx)

Include headers; at least one binary outcome column and predictors (numeric or text for categorical).

No file uploaded.

INPUTS & SETTINGS

Confidence Level & Reporting

Set the significance level for hypothesis tests and confidence intervals.

Standardization affects model fitting and effect plots only. Summary statistics always report predictors on their original scale.

VISUAL OUTPUT

Confusion Matrix

Advanced Options
(Pr ≥ threshold → predict 1)

Interpretation Aid

Reading the confusion matrix:

  • Rows = actual outcomes, columns = predicted outcomes
  • Diagonal cells (TN, TP) = correct predictions
  • Off-diagonal cells (FP, FN) = errors

Classification metrics:

  • Accuracy = overall % correct
  • Sensitivity = % of actual 1s correctly identified
  • Specificity = % of actual 0s correctly identified
  • Precision = % of predicted 1s that are actually 1
  • F1 Score = harmonic mean of precision and recall

Threshold adjustment:

Adjust the classification threshold to balance sensitivity vs. specificity based on your business priorities. A lower threshold catches more positives but increases false alarms.

Classification Performance (at threshold = 0.5)

Accuracy:
Sensitivity (Recall):
Specificity:
Precision (PPV):
F1 Score:
Negative Predictive Value:

ROC Curve

AUC (Area Under Curve):
Interpretation Aid

Reading the ROC curve:

  • Closer to top-left corner = better discrimination
  • AUC > 0.7 acceptable, > 0.8 good, > 0.9 excellent
  • AUC = 0.5 means no better than random guessing

Interactive features:

Hover over any point to see its threshold, TPR, and FPR. Key thresholds (0.3, 0.5, 0.7) are marked with red dots. Moving right means lowering the threshold—catching more positives but also more false alarms.

Predicted Probability Distribution

Interpretation Aid

These overlapping histograms show the distribution of predicted probabilities for cases where the outcome was actually 0 (blue) versus actually 1 (red). Good model discrimination means the distributions are well-separated—cases with outcome = 1 should cluster at higher predicted probabilities. Heavy overlap suggests the model has difficulty distinguishing the two groups. This complements the confusion matrix by showing the full probability spectrum before thresholding.

Predicted probabilities vs. focal predictor

Focal range (continuous):

Hold other predictors constant

Choose levels/values for the non-focal predictors used when plotting the focal curve.

Interpretation Aid

The line (or bars for categorical focals) shows the predicted probability that the focal outcome (coded as 1) occurs while holding other predictors constant at chosen values. Steeper slopes or larger gaps between bars imply stronger effects. Confidence bands/bars reflect the statistical uncertainty for those probabilities; wider bands mean less certainty. If bands for different settings overlap heavily, the model may not distinguish them well at those values.

Variable Importance (Odds Ratios)

Interpretation Aid

Reading odds ratios:

  • OR > 1 = increases odds of the outcome
  • OR < 1 = decreases odds of the outcome
  • OR = 1 (dashed line) = no effect
  • Example: OR = 2.0 means doubling the odds (100% increase)

Confidence intervals:

The horizontal bars show 95% CIs. If a bar crosses the 1.0 line, the effect is not statistically significant. Variables are sorted by effect strength. The x-axis is log-scaled so equal distances represent equal multiplicative effects.

SUMMARY STATISTICS

Summary Statistics

Outcome Variable

Variable % Focal Outcome Count Focal Count Non-Focal Total n
Provide data to see outcome summary.

Continuous Predictors

Variable Mean Median Std. Dev. Min Max
Provide data to see summary statistics.

Categorical Predictors (% by level)

Predictor Level Percent
Provide data to see level percentages.

TEST RESULTS

Upload data to see your result

We'll assess whether your predictors significantly explain the binary outcome

Regression Equation

Provide data to see the fitted regression equation.

The downloaded file includes your original raw data plus two columns: p_hat (the model’s predicted probability of the focal outcome for each observation) and neg_loglik_contribution, the individual contribution to the negative log-likelihood penalty used to fit the model.

Log-likelihood:
Null deviance:
Residual deviance:
Model chi-square:
Model p-value:
Pseudo R-squared:
Sample size (n):
Alpha:
Interpretation Aid

Model fit metrics:

  • Log-likelihood / Deviance: Lower deviance = better fit
  • Model χ² & p-value: Tests if predictors improve fit vs. intercept-only model. p < α = significant improvement
  • Pseudo R²: Proportion of deviance explained (not directly comparable to linear R²)

Important caveats:

  • Pseudo R² values are typically lower than linear R² — values of 0.2–0.4 often represent good fit
  • Very small n can produce unstable estimates or separation issues
  • p-values below α are treated as statistically reliable

Managerial Interpretation

APA-Style Report

Coefficient Estimates (Log-odds and Odds Ratios)

Predictor Level / Term Estimate (log-odds) Standard Error z p-value Odds Ratio Lower Bound Upper Bound
Provide data to see coefficient estimates.
Interpretation Aid

DIAGNOSTICS & ASSUMPTIONS

Diagnostics & Assumption Checks

Run the analysis to see checks on multicollinearity, variance patterns, and normality of residuals. Use these as prompts for plots and follow-up modeling, not as strict pass/fail gates.

Hosmer-Lemeshow Goodness-of-Fit Test

Run the analysis to see calibration test.

What does this test?

The Hosmer-Lemeshow test checks if predicted probabilities are well-calibrated—i.e., do cases with predicted probability ≈ 70% actually have the outcome 70% of the time? The test groups observations by predicted probability and compares observed vs. expected frequencies. A large p-value (> 0.05) suggests good calibration (no evidence of poor fit). A small p-value (< 0.05) suggests the model's probability estimates may be systematically biased, even if classification accuracy is high.

Actual vs. Fitted

Interpretation Aid

Each point plots a fitted probability on the horizontal axis and the observed 0/1 outcome (with a small amount of vertical jitter for visibility) on the vertical axis. Points clustered near 0 or 1 on the x-axis indicate confident predictions; a mix of 0s and 1s at similar fitted probabilities indicates uncertainty. Strong patterns or obvious outliers can signal model misspecification or influential cases to review.

Residuals vs. Fitted

LEARNING RESOURCES

📚 When to use logistic regression

Use logistic regression when:

  • Your outcome is binary (e.g., converted/not, churned/retained, clicked/ignored)
  • You have one or more continuous or categorical predictors
  • You want to quantify how each predictor affects the probability of the outcome
  • Observations are independent of each other
  • You need interpretable odds ratios for business decisions

Why logistic instead of linear regression?

Linear regression can predict values outside 0–1 for a binary outcome, which is nonsensical. Logistic regression constrains predictions to valid probabilities and uses maximum likelihood estimation. It also handles the inherent non-constant variance of binary data.

⚠️ Common mistakes to avoid
  • Ignoring class imbalance: If 95% of cases are "no," accuracy is misleading—check sensitivity, specificity, and AUC instead
  • Interpreting coefficients as probabilities: Log-odds coefficients are not percentage-point changes. Use the predicted probability chart to communicate effects
  • Too many predictors for your sample: A common rule of thumb is at least 10 events per predictor term (EPV ≥ 10). Fewer leads to unstable estimates
  • Perfect separation: If a predictor perfectly predicts the outcome, the model cannot converge. Watch for the separation warning
  • Multicollinearity: Highly correlated predictors inflate standard errors and make individual effects unreliable
  • Confusing odds ratios with risk ratios: OR ≈ RR only when the outcome is rare. For common outcomes, odds ratios exaggerate the effect on probability
📐 Key equations

Logit link function:

$$ \log\left(\frac{p}{1 - p}\right) = \beta_0 + \beta_1 X_1 + \dots + \beta_p X_p $$

Predicted probability:

$$ p = \frac{1}{1 + e^{-(\beta_0 + \beta_1 X_1 + \dots + \beta_p X_p)}} $$

Odds ratio for predictor \(j\):

$$ \text{OR}_j = e^{\beta_j} $$

Interpretation: A one-unit increase in \(X_j\) multiplies the odds of the outcome by \(e^{\beta_j}\). For categorical predictors, each dummy coefficient compares that level's odds to the reference level.

🔗 Related tools