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-odds form

\[\log\left(\frac{p_i}{1-p_i}\right) = \eta_i = \beta_0 + \beta_1 X_{1i} + \cdots + \beta_p X_{pi}\]

The same model: probability form

\[p_i = \frac{1}{1+e^{-\eta_i}} = \frac{1}{1+e^{-(\beta_0 + \beta_1 X_{1i} + \cdots + \beta_p X_{pi})}}\]

Here \(p_i = \Pr(Y_i=1 \mid X_{1i},\dots,X_{pi})\): the probability of the focal outcome for row \(i\). The score \(\eta_i\) combines that row's predictor values; the probability form converts it to a value between 0 and 1.

Coefficient tests

\[z_j = \frac{\hat{\beta}_j}{\mathrm{SE}(\hat{\beta}_j)}\]

Each coefficient is tested against zero using the standard normal distribution.

What are we trying to beat? The null model

Without using any predictors, we could give everyone the same probability: the overall rate of the focal outcome in the rows used to fit the model. If 30% converted, everyone gets a 30% conversion probability. That is the null model (also called the intercept-only model).

The model test asks whether using customer characteristics improves fit over that starting point. For classification accuracy, we also compare against always choosing the most common outcome: with 30% conversions, always saying “did not convert” is 70% correct. These are related baselines for different questions.

Model comparison

\[\Delta D = D_{\text{null}} - D_{\text{model}}\]

A chi-square test asks whether the predictors, as a set, improve fit over an intercept-only model on the same rows.

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.

Before fitting: what can this data support?

Use two outcome categories and one independent case per row. Several records for the same customer are not independent cases. Repeated customers or time-ordered outcomes need a model and validation split that account for that structure.

Use information available before the outcome. To predict conversion, exclude purchase confirmation, final order value, or other columns only known after conversion. Those would reveal the answer rather than help predict it (data leakage).

Choose predictors for a reason. IDs and arbitrary numeric category codes are not meaningful continuous predictors. Missing rows, rare categories, and too many predictor terms can leave estimates unstable.

Associations are not intervention effects. An observed relationship can reflect omitted factors. Moving a simulator slider compares fitted profiles; it does not prove what changing that customer's behavior would cause.

Upload a CSV or load a scenario to begin.

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: explore the catch-versus-false-alarm trade-offOptional · open to explore

ROC (Receiver Operating Characteristic) Curve

Imagine using this model to decide which customers to contact. A lenient cutoff catches more customers who will respond, but also contacts more who will not. A strict cutoff reduces false alarms, but misses more real responders. The curve lets you compare these choices.

  1. Start with a score, then make a decision. A customer scored 0.60 is flagged when the cutoff is 0.50, but not when it is 0.70. Changing the cutoff changes who is flagged; it does not refit the model.
  2. One cutoff gives one dot. Compare the flags with the outcomes you actually observed. Read across for false alarms among actual negatives; read up for catches among actual positives. These percentages use different groups as their denominators.
  3. Sweep the cutoff to build the curve. Lowering it flags more rows: the dot moves toward the top-right, sometimes in steps or along one axis. Raising it moves toward the bottom-left. Flag nobody and you are at (0%, 0%); flag everybody and you are at (100%, 100%). The top-left would catch every actual positive without any false alarms.
A concrete example (illustrative): Suppose 100 customers really respond and another 100 do not. A dot at (20%, 80%) means you caught 80 of the 100 responders and flagged 20 of the 100 non-responders. You missed 20 responders. The horizontal 20% is not “20% of everyone contacted was wrong.”
Lenient: flag moreStrict: flag fewer

Move the slider and watch the highlighted dot. This also updates the confusion matrix above. The curve and AUC stay the same.

Run an analysis to try this with your own fitted data.

Horizontal axis: false alarms (FPR)
Among rows that actually had the non-focal outcome, how many did we incorrectly flag? Prefer farther left.

Vertical axis: catches (TPR / sensitivity)
Among rows that actually had the focal outcome, how many did we correctly flag? Prefer higher up.

Read the diagonal before judging the curve

The dashed diagonal is the no-ranking benchmark. Flagging 20% of each actual group lands at (20%, 20%). A point above it catches a larger share of the positives than of the negatives. Curves bowing toward the top-left offer better trade-offs. A curve below the diagonal suggests scores rank in the wrong direction; check the outcome coding and model.

AUC (Area Under the Curve):–

AUC summarizes ranking across cutoffs; run an analysis for a reading of this model.

AUC is not percent correct. An AUC of 0.80 means the model ranks an actual positive above an actual negative about 80% of the time across random pairs, counting a tied score as half a success. It does not mean 80% of customers were correctly classified at your chosen cutoff.

There is no automatically best cutoff. Choose based on the cost of a missed opportunity versus a wasted contact. AUC does not choose for you, does not check whether “70% likely” really happens 70% of the time, and can look reassuring when positives are rare. Check precision and held-out performance too. This curve uses the rows that fitted the model.

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.

Adjusted Odds Ratios

Independently scaled plots to avoid flattening continuous slopes
Continuous: per unit/SD • Zoomed scale Categorical: level vs. reference • Relative contrast Not statistically significant
Continuous Predictors Per 1 unit / 1 SD

Categorical Predictors Contrasts vs. Baseline

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 intervals at your selected confidence level. An interval including 1 is compatible with no association. Continuous and categorical terms are plotted on separate panels so small slopes (e.g. OR = 1.004) are not compressed by wide discrete contrasts.

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 compare fit with a null model, read association sizes, and check prediction separately

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²: Improvement over the null model on the log-likelihood scale; not the percentage of variation explained

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 α indicate evidence against the null; they do not establish practical importance

Managerial Interpretation

APA-Style Report

Coefficient Estimates (Log-odds and Odds Ratios)

Continuous slopes and categorical contrasts operate on different scales. They are organized into two dedicated tables below so you can appropriately read effect sizes.

Model Intercept Run analysis to see baseline model intercept.

Continuous Predictors Marginal Effects per Unit / 1 SD

Multiplicative change in odds per 1-unit increase (holding other variables constant)
Predictor Measurement Unit Estimate (log-odds) Standard Error z p-value Odds Ratio (per unit) OR CI (Lower) OR CI (Upper)
Provide data to see continuous predictor estimates.

Categorical Predictors Contrasts vs. Reference Group

Multiplicative change in odds comparing each category level against its reference baseline
Predictor Category Level Reference Group Estimate (log-odds) Standard Error z p-value Odds Ratio (vs. Ref) OR CI (Lower) OR CI (Upper)
Provide data to see categorical predictor estimates.
Show Combined Master Table (All Predictors in Model Order)
Predictor Level / Term Estimate (log-odds) Standard Error z p-value Odds Ratio OR CI (Lower) OR CI (Upper)
Provide data to see coefficient estimates.

The two right-hand bounds are on the odds-ratio scale: compare them with 1 (no association). The estimate and its standard error are on the log-odds scale, where no association is 0. Intervals describe uncertainty, not the range of individual customer outcomes.

Interpretation Aid

DIAGNOSTICS & ASSUMPTIONS

Diagnostics & Assumption Checks

Run the analysis to see checks on multicollinearity, outcome balance, rare categories, and probability calibration. 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) means the test found no evidence of miscalibration. That is not proof of good calibration: the test has little power in small samples and can miss real problems. 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

Yes/no outcome recorded period after period? (out of stock today, sold out on Saturday) Then the rows are not independent: yesterday predicts today. Use Dynamic Logistic Regression, which puts last period's outcome in as a predictor and tests the forecast on periods it never saw.

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