Percentages and Math

Logistic Regression Calculator

Paste predictor values with a 0 or 1 outcome to fit a model and predict the chance of a 1.

Your numbers

One case per line: one to five predictor values, then the outcome 0 or 1 last, separated by commas, spaces or tabs. Example data.

Separate with commas, in column order.

One value per predictor, separated by commas.

More options

Cases with a fitted chance at or above this are counted as 1 in the table of hits and misses.

Result

Predicted chance of a 1

60.74%

For Hours = 3.

Predicted chance of a 1
60.74%
Cases
20
Log-likelihood
-8.0299
Log-likelihood of intercept-only model
-13.8629
Likelihood ratio chi-square
11.6661
Likelihood ratio p value
0.0006
McFadden pseudo R squared
0.4208
AIC
20.0598
Share called correctly
80.0%
Newton steps
7

Coefficients (log odds scale)

TermCoefficientStd. errorzpOdds ratio95% interval for odds ratio
Intercept-4.07771.7610-2.3160.0206--
Hours1.50460.62872.3930.01674.50261.3131 to 15.4393

Hits and misses at a cutoff of 0.5

Called 1Called 0
Actually 182
Actually 028
How this was calculated
  1. Start with all coefficients at 0 and repeat Newton steps (iteratively reweighted least squares) until the log-likelihood stops changing: 7 steps.
  2. The chance of a 1 is 1 / (1 + exp(-(-4.0777 + 1.5046 x Hours))).
  3. Standard errors are the square roots of the diagonal of the inverse information matrix. Odds ratios are exp(coefficient).
  4. The likelihood ratio chi-square is twice the gap between the model log-likelihood -8.0299 and the intercept-only value -13.8629: 11.6661, with 1 degree of freedom.
  • Odds ratios describe the change in odds for one unit more of a predictor with the others held fixed. Counting correct calls on the same data used to fit the model flatters the model. With few cases the standard errors are rough, and a fit that separates the 0s and 1s perfectly cannot be computed.

Calculated using SumPanda.com · https://sumpanda.com/logistic-regression-calculator/

Results are estimates for general information. Verify important figures before relying on them.

Next step

How to use the logistic regression calculator

  1. Paste one case per line: one to five predictor values, then the outcome 0 or 1 last. Separate them with commas, spaces or tabs.
  2. Optionally name the predictors, and enter values to predict the chance of a 1 for a new case.
  3. Read the coefficients, odds ratios and their intervals, then the likelihood ratio test and pseudo R squared.
  4. Open the advanced option to change the cutoff used in the table of hits and misses.

Formula

P(y = 1) = 1 / (1 + exp(-(b0 + b1 x1 + ... + bk xk)))

Newton step: b <- b + (X' W X)^-1 X' (y - p), with W = diag(p (1 - p))

Standard error of b_j = sqrt of the j-th diagonal of (X' W X)^-1

Odds ratio = exp(b_j); interval = exp(b_j plus or minus 1.96 x SE)

LR chi-square = 2 (logL - logL0), McFadden R^2 = 1 - logL / logL0, AIC = 2 (k + 1) - 2 logL

logL0 is the log-likelihood of a model with only an intercept. The p values for coefficients use the Wald z statistic, and the LR test uses chi-square with k degrees of freedom.

Hours studied and passing

Twenty students: hours studied from 0.5 to 5.5 with a pass (1) or fail (0) result. The fit gives an intercept of -4.0777 and a coefficient of 1.5046 for hours (standard error 0.6287, p = 0.0167). The odds ratio is 4.5026 with a 95% interval of 1.3131 to 15.4393.

The log-likelihood is -8.0299 against -13.8629 for the intercept-only model, so the likelihood ratio chi-square is 11.6661 (p = 0.0006), McFadden R squared is 0.4208 and AIC is 20.0598. For 3 hours the predicted chance of a pass is 60.74%. At a cutoff of 0.5, 8 passes and 8 fails are called correctly and 2 of each are missed.

Reading the coefficients

Logistic regression models the log odds of the outcome as a straight-line function of the predictors. A coefficient of 1.5046 means each extra hour adds 1.5046 to the log odds, which multiplies the odds of a 1 by exp(1.5046) = 4.50. With several predictors each odds ratio is "holding the others fixed".

The interval for the odds ratio is built from the Wald standard error. If it excludes 1, the data point to a real association at the 95% level. For a 2 by 2 table without a model, the odds ratio and relative risk calculator is simpler, and the linear regression calculator handles a numeric outcome.

Cautions

The model needs enough cases of each outcome. A common guide is at least 10 cases of the rarer outcome per predictor, though that is a rule of thumb. If one predictor separates all the 0s from all the 1s, the best coefficients are infinite and the page says so instead of reporting unstable numbers.

The table of hits and misses uses the same data that fit the model, so it is optimistic. See the confusion matrix metrics calculator for precision, recall and related measures of a table of counts. Predictions apply only within the range of the data.

Assumptions and limits

  • Cases are independent, and the outcome is exactly 0 or 1.
  • The log odds are a straight-line function of each predictor (no interactions or curves are added).
  • There is no perfect separation and no predictor is a copy or exact combination of others.
  • Coefficient p values and intervals use a large-sample approximation, so treat them as rough with few cases.

Formulas reviewed October 10, 2026. See the calculation methodology for how SumPanda rounds, tests and sources its formulas.

Frequently asked questions

Why does the page say the fit does not settle?

When the predictors split the 0s and 1s completely, the likelihood keeps improving as coefficients grow without limit. No finite best answer exists, so the page stops and suggests more varied data or fewer predictors.

What is McFadden R squared?

It compares the log-likelihood of your model with that of a model that uses only the overall rate of 1s. Values are lower than ordinary R squared would be, and it is meant for comparing models on the same data, not for judging a single model against a fixed scale.

Can I add category predictors?

Recode each category as its own 0 or 1 column, leaving one category out as the baseline. Each coefficient then compares that category with the baseline.

Is this the same output as statsmodels or R?

The coefficients, standard errors, log-likelihood and AIC agree with statsmodels Logit to many digits on the test data. Different packages may report z or chi-square forms of the coefficient test, but the maximum likelihood estimates are identical.