Skip to content

Logistic Regression Calculator

Paste a spreadsheet with a binary outcome (0/1, pass/fail, yes/no) and any number of predictors. You get coefficients and odds ratios with Wald confidence intervals, the likelihood-ratio test, pseudo-R² measures, a classification table, an ROC curve and predicted probabilities — fitted by the same IRLS algorithm as R's glm. When the data are separated, the page says so instead of printing nonsense, and offers Firth's penalised fit. Free, no sign-up; nothing leaves your browser.

Paste from a spreadsheet (with a header row of variable names), or separate values with tabs, commas, semicolons or spaces. The outcome can be 0/1 or any two labels such as pass/fail. Blank cells and NA count as missing.

How to Use the Logistic Regression Calculator

  1. 1. Paste your data. One row per case, one column per variable, with a header row of names. The outcome can be numbers (0/1) or any two labels (pass/fail); blank cells and NA count as missing and the case is left out.
  2. 2. Choose the outcome and the event. Pick the outcome column, then the value that counts as the event (coded 1). The odds ratios describe the odds of that event.
  3. 3. Tick the predictors. Numeric columns work as they are; a two-value text column becomes a 0/1 predictor. Optionally set the classification cutoff and the confidence level.
  4. 4. Read the model, then the coefficients. Check the warnings first: the page flags separation, non-convergence and too few events per predictor before you read any number.

What Logistic Regression Does

Logistic regression models the probability of a binary outcome through the log-odds: ln(p ÷ (1 − p)) = b₀ + b₁x₁ + … + b_kx_k. A coefficient b is the change in the log-odds for a one-unit rise in its predictor, and exp(b) is the odds ratio: the factor by which the odds of the event are multiplied. An odds ratio of 1 means no association, above 1 raises the odds, below 1 lowers them. Unlike linear regression there is no closed-form solution, so the coefficients are found by maximum likelihood, iterating until the deviance stops changing.

The calculator uses iteratively reweighted least squares, the algorithm behind R's glm(family = binomial): each pass solves a weighted least-squares problem by QR decomposition, using the working response z = η + (y − μ) ÷ (μ(1 − μ)) and weights μ(1 − μ). Starting values, convergence rule (relative deviance change below 10⁻⁸, at most 25 iterations) and covariance matrix follow R, so coefficients, standard errors and even the iteration count match.

Worked Example

Twenty students record hours studied and whether they passed (the example button loads the data). The fitted model is ln(odds of passing) = −4.0777 + 1.5046 × hours. The slope has SE 0.6287, Wald z = 2.39, p = 0.0167, so the odds ratio is exp(1.5046) = 4.50, 95% CI 1.31 to 15.44: each extra hour multiplies the odds of passing by about 4.5, though the wide interval reflects only 20 cases.

  • Model test. The likelihood-ratio χ²(1) = 27.7259 − 16.0598 = 11.67, p = 0.0006: the model fits significantly better than one with no predictors.
  • Pseudo-R². McFadden 0.42, Cox–Snell 0.44, Nagelkerke 0.59, Tjur 0.47. They are different yardsticks, and none is "variance explained".
  • Classification. At a 0.5 cutoff the model labels 80% of cases correctly, with 80% sensitivity and 80% specificity; the AUC is 0.895.
  • Prediction. A student who studies 3 hours has a predicted pass probability of 60.7% (95% CI 29.3% to 85.2%); at 4 hours, 87.4%. The probability crosses 50% at 2.71 hours (−b₀ ÷ b₁).

When the Data Are Separated

If a predictor (or combination of predictors) splits the outcomes perfectly — every case above some value passes, every case below fails — the likelihood keeps rising as the slope grows, and no maximum exists. Software then returns huge coefficients with enormous standard errors, a Wald p-value near 1, and a warning that is easy to miss. Many tools print the result as if it were fine.

This calculator treats it as a result in itself. If any fitted probability is within 10⁻⁸ of 0 or 1, it shows a warning, withholds the p-values and odds ratios (the model-level likelihood-ratio test remains valid) and disables prediction. Eight cases with x = 1…8 and an outcome that switches at 5 give a slope of 45.8 with SE 80,644 under maximum likelihood. Ticking Firth's penalised likelihood adds Jeffreys-prior bias reduction, and the same data give a finite slope of 1.03 (SE 0.67), odds ratio 2.81 (95% CI 0.75 to 10.50) and penalised LR χ²(1) = 8.09. Firth's estimates are also less biased than ordinary ML when the sample is small or events are rare.

Frequently Asked Questions

How do I interpret odds ratios in logistic regression?
The odds ratio for a predictor is the multiplicative change in the odds of the event for a one-unit increase in that predictor, holding the others constant. An odds ratio of 4.5 means the odds are 4.5 times as large; 0.5 means they are halved; 1 means no association. Odds ratios are not risk ratios: they overstate relative risk when the event is common.
What is complete or quasi-complete separation?
Separation means some predictor value or combination predicts the outcome perfectly (complete) or predicts one of the two outcomes perfectly for part of the data (quasi-complete). The maximum-likelihood coefficient is then infinite, so software reports a very large number with a huge standard error. Remedies include Firth's penalised likelihood, merging sparse categories, dropping the predictor, or getting more data.
What is Firth logistic regression and when should I use it?
Firth's method adds a penalty to the likelihood (Jeffreys' prior) that removes the first-order bias of maximum-likelihood estimates and keeps them finite under separation. Use it for small samples, rare events, or separated data. Here the standard errors are Wald-based; profile penalised-likelihood intervals, as in R's logistf, are usually preferred for reporting.
How many events do I need per predictor?
A common rule of thumb is at least 10 events (the rarer outcome) per predictor. Below that the coefficients are biased away from zero and unstable, and separation becomes likely. The page warns when you are under 10. More recent work suggests the right number depends on the situation, so treat 10 as a minimum for exploratory work.
What is a good pseudo-R² for logistic regression?
There is no single answer, because pseudo-R² values are not shares of explained variance and different ones are on different scales. McFadden's runs lower: 0.2–0.4 is often described as an excellent fit. Nagelkerke rescales Cox–Snell to reach 1. Report the one you use, and judge the model mainly by discrimination (AUC) and calibration.
How do I report logistic regression results in APA style?
State the model test, χ²(df, N = n) = value, p = value, a pseudo-R² and then, for each predictor, the odds ratio with its 95% confidence interval and p-value, for example: hours, OR = 4.50, 95% CI [1.31, 15.44], p = .017. The page writes this summary for you.

Related Tools

More in Statistics Calculators

See all Statistics Calculators