Math calculator

Logistic Regression Calculator

Odds, not risk.

Odds, not risk

A hundred and twenty accounts, thirty-one of which converted. Days active has an odds ratio of 1.1023 per day (95% CI 1.043 to 1.165, p = 0.0006) and engagement score 2.3345 per point (1.612 to 3.381, p = 0.0000073). The model’s likelihood ratio is 40.0253 on 2 degrees of freedom, p = 0.0000000020, and its AUC is 0.8422. The number to be careful with is the 2.3345: at this sample’s own event rate of 25.83% it corresponds to a risk ratio of 1.7360, so reading the odds ratio as a probability multiplier overstates the effect by more than a third.

120 cases · 31 events · 10.33 events per parameter

Likelihood ratio 40.0253 on 2 df, p = 2.0352e-9

McFadden's pseudo R² is 0.2919 and the AIC is 103.088, with an AUC of 0.8422. The sample's own event rate is 25.83%, which is what turns each odds ratio below into a risk ratio.

Events per parameter

10.33

comfortable

Pseudo R²

0.2919

McFadden, not variance explained

AUC

0.8422

31 against 89

Converged

in 7

iterations

Coefficients and odds ratios

Each coefficient with its standard error, odds ratio, confidence interval and p-value
TermCoefficientStd. errorOdds ratio95% intervalp
Intercept-8.76621.67920.00020.000 to 0.0041.78e-7
days active0.09740.02831.10231.043 to 1.1650.0006
engagement score0.84780.18902.33451.612 to 3.3817.30e-6

The intercept is the log odds when every predictor is zero, which is often outside the data entirely and rarely worth interpreting. Each other coefficient is the change in log odds per unit, and its exponential is the odds ratio.

What the odds ratios mean as risk

Each odds ratio converted to a risk ratio at this sample’s event rate
TermOdds ratioRisk ratio at 25.8%Overstatement
days active1.10231.07391.38×
engagement score2.33451.73601.81×

The last column is how much bigger the odds ratio’s apparent effect is than the risk ratio’s. The two converge only when the outcome is rare, and at a 25.8% event rate they are not close. This conversion uses the sample’s overall rate, which is a reasonable summary and not a substitute for the baseline risk of the specific group you care about.

With a single binary predictor this fit returns exactly the log odds ratio of the corresponding two-by-two table — an iterative maximum-likelihood estimate and a hand-computable cross-product ratio, agreeing to fifteen decimal places. The verification suite asserts that, which is the cleanest possible check that the whole iteration is right.

Risk ratios too Separation reported Likelihood ratio test Pseudo R² is not R²

What this tool shows

On the second preset the odds ratio is 9.3333 and the risk ratio is 2.6667. Eighty per cent of the exposed group had the outcome against thirty per cent of the unexposed — a factor of 2.67, not 9.33. Logistic regression returns odds ratios, most readers hear probabilities, and the gap grows with the base rate. Every odds ratio on this page is converted at your own sample’s event rate, beside the number the model actually produced.

  • Coefficients, standard errors, odds ratios and Wald intervals from an iteratively reweighted least squares fit
  • Each odds ratio converted to a risk ratio at the sample’s own event rate, with the overstatement factor
  • A likelihood ratio test against the intercept-only model, plus McFadden’s pseudo R² and the AIC
  • The AUC of the fitted probabilities, so discrimination is visible alongside significance
  • Separation detected and named, with the Wald and likelihood ratio results shown disagreeing
  • Events per parameter, which is what decides whether any individual coefficient is usable
Risk ratios too Separation reported Likelihood ratio test Checked against a 2×2 table

An odds ratio is not a probability multiplier.

Updated 13 September 2026 · Works in any browser, no installation

Logistic regression models the log odds of a binary outcome as a linear function of the predictors, and returns odds ratios. An odds ratio of 2 does not mean twice as likely; it means the odds double, which at a 40% base rate is a probability going from 40% to 57%. The two coincide only when the outcome is rare, and the distance between them is the most common misreading of a fitted model.

At a glance

Formula shown
log(p/(1−p)) = β₀ + β₁x₁ + … , fitted by iteratively reweighted least squares: at each step a weighted regression of the working response z = η + (y − μ)/w on the predictors, with weights w = μ(1 − μ). exp(βⱼ) is the odds ratio per unit of xⱼ. At a baseline risk p₀ the corresponding risk ratio is OR/(1 − p₀ + p₀·OR), which equals OR only in the limit p₀ → 0.
Scenario support
Modelling conversion, default, diagnosis, churn or any yes-or-no outcome from several predictors; converting a published odds ratio into a risk you can act on; and checking whether a logistic model has enough events to support the coefficients it reports.
Educational estimate
Planning support from the values you enter — not professional advice.

The odds ratio is not the risk ratio

This is the error the page is built around, because it is made constantly and because its size is easy to state exactly.

On the binary preset the odds ratio is 9.3333. The underlying table is 40 events in 50 exposed and 15 in 50 unexposed.

The risk ratio is 2.6667. Eighty per cent against thirty per cent. The odds ratio is three and a half times larger.

They agree only when the outcome is rare. At a 1% base rate an odds ratio of 2 is a risk ratio of 1.98; at 40% it is 1.43; at 60% it is 1.25.

So the base rate has to travel with the number. The page converts every odds ratio at the sample’s own event rate, and the conversion calculator does it for any baseline you name.

When the maximum likelihood estimate does not exist

Separation is the failure that most software reports as a successful fit, and the numbers it produces are not merely imprecise — they are meaningless.

On the third preset the predictor orders the outcome perfectly. Every value below 145 is a zero and every value above is a one.

The fit runs sixty iterations without converging. The intercept reaches −358.36 with a standard error of 84,955, and the slope’s p-value is 0.9966.

The likelihood ratio test on the same model gives p = 0.00000000011. Two tests of the same thing, one saying nothing is there and one saying it is certain.

That contradiction is the diagnostic. Wald standard errors are computed from the curvature at the estimate, and when the estimate is running off to infinity that curvature goes to zero. Firth’s penalised likelihood is the usual remedy; changing the threshold is not.

Checked against a table you can compute by hand

An iterative maximum-likelihood fit is hard to verify against published output, so this one is checked against a case with an exact closed form instead.

With a single binary predictor the slope IS the log odds ratio of the two-by-two table. Not approximately — the likelihood has a closed-form maximum there.

The second preset shows both numbers: 2.2335922215 and 2.2335922215. Agreeing to fifteen decimal places, from an iteration and from a cross-product ratio.

That single check covers the whole pipeline: the working response, the weights, the weighted normal equations, the matrix inverse and the convergence criterion.

The suite adds recovery on simulated data — six samples of three thousand cases, with the true slope recovered inside five standard errors each time — which catches a bias the exact case would not.

Events per parameter, not sample size

The usual instinct is to check n. For a logistic model n is close to irrelevant; what matters is the number of cases in the smaller outcome class.

The fourth preset has seventy cases and eight events. Three predictors and an intercept, so two events per parameter.

The overall test looks fine: p = 0.000016. The predictors genuinely carry information about the outcome.

And one odds ratio is 10.0145 with an interval from 1.465 to 68.463 — a span of a factor of 47. Nothing there is a usable estimate of anything.

Ten events per parameter is the conventional floor, and later work has shown it is rough rather than sacred. What is not rough is the direction: a significant model with unusable coefficients is what too few events looks like, and reporting the coefficients anyway is the mistake.

Pseudo R² is not R²

McFadden’s figure is printed because it is expected, and it is worth saying plainly what it is not.

It is 1 − (fitted log likelihood / null log likelihood). A ratio of likelihoods, not a share of variance.

Values that would be poor for a linear R² are normal here. McFadden himself suggested 0.2 to 0.4 represents an excellent fit; the shipped preset’s 0.2919 is a good model, not a weak one.

It reaches 1 only under separation, which is the third preset — where a pseudo R² of exactly 1 is a warning rather than a triumph.

The AUC is the more useful summary of discrimination, and the likelihood ratio test the more useful summary of evidence. Both are printed beside it.

Wald intervals are the weakest part of the output

The intervals on this page are Wald intervals, which is what most software reports, and they have a known failure mode beyond separation.

They are symmetric on the log odds scale and therefore asymmetric on the odds ratio scale, which is correct and often surprises people.

They rely on the likelihood being approximately quadratic at the estimate, which holds well at large samples and poorly at small ones or near-perfect prediction.

Profile likelihood intervals are better and are not computed here. They require re-maximising at a grid of fixed values, and the difference is usually small except exactly where the Wald interval is already suspect.

The practical rule: when the Wald p-value and the likelihood ratio test disagree noticeably, trust the likelihood ratio and treat the intervals as indicative.

Reporting a logistic model

Four items, and the first is what stops a reader converting your odds ratio into the wrong probability.

Give the base rate. An odds ratio without the baseline risk cannot be turned into anything a reader can act on.

Give the number of events, not just the sample size. Events per parameter is what determines whether the coefficients are estimable.

Give the likelihood ratio test as well as the individual p-values. They disagree exactly where the model is in trouble.

And say the predictors were chosen in advance. Stepwise selection invalidates every p-value and every interval in the table, and that is rarely mentioned alongside the output.

Sources and methodology

References for the model and its pitfalls.

Method. The fit is by iteratively reweighted least squares with a convergence tolerance of 1e-10 and a hard stop at sixty iterations, and the report says which of those ended it rather than presenting the final iterate as a converged answer. Separation is detected from three signals together — fitted probabilities pinned at the boundary, a runaway coefficient, and failure to converge — because any one alone produces false alarms. The verification suite anchors the whole iteration on a case with a closed-form answer: with a single binary predictor the slope must equal the log odds ratio of the corresponding two-by-two table, which it does to 1e-12. On top of that it recovers known slopes from six simulated samples of three thousand cases, checks that every reported ratio is the exponential of its coefficient and every fitted probability lies in 0 to 1 across eighty designs, and asserts that the separated preset reports itself as separated with a Wald p-value above 0.5 and a pseudo R² of 1. That engine is verified on every change against 100 assertions. The count and the per-case breakdown are published on the formula verification page.

Related calculators

Where this goes next:

Odds Ratio to Risk RatioConvert an odds ratio to a risk ratio at any baseline risk, with the interval converted too and the same odds ratio shown across eleven baselines.
Hosmer-LemeshowThe Hosmer-Lemeshow calibration test with the group count swept from five to fifteen, per-group promised-against-observed rates, and the Brier reliability alongside.
Brier ScoreThe Brier score split into reliability, resolution and uncertainty, with the term the decomposition drops printed rather than absorbed, plus a skill score and a calibration table.
ROC Curve & AUCBuilds the curve from raw scores with every threshold enumerated, and computes the AUC twice — trapezoid and Mann-Whitney U — which agree to 1.11e-16 across 300 datasets.
Odds RatioOdds ratio, relative risk, risk difference and number needed to treat from one 2x2 table — because an odds ratio of 6.00 can describe a relative risk of 1.50.
Poisson RegressionPoisson regression with rate ratios, the Pearson dispersion check, and quasi-Poisson standard errors printed beside the Poisson ones for every coefficient.

More in Math, or browse all calculators.

Educational use disclaimer

An educational tool. Logistic regression returns odds ratios, which are not probability multipliers — the risk ratios shown beside them use the sample’s overall event rate, not the baseline risk of any particular group. When a predictor separates the outcome perfectly the maximum likelihood estimate does not exist, and the coefficients, standard errors and p-values reported in that case are artefacts of where the iteration stopped.

How we calculate · Found an error? email us

Authorship & verification

Written and maintained by , a business operator who builds spreadsheet-based calculators.

What's changed (5 updates)

Published 13 September 2026

  1. Published a logistic fit by iteratively reweighted least squares with odds ratios and Wald intervals.
  2. Converted every odds ratio to a risk ratio at the sample’s own event rate, with the overstatement factor.
  3. Reported separation explicitly, with the Wald and likelihood ratio results shown disagreeing.
  4. Shipped a binary-predictor preset where the slope equals the table’s log odds ratio to fifteen decimal places.
  5. Printed events per parameter, which decides whether any individual coefficient is usable.

Add this calculator to your site

Responsive embed — and private: nothing your visitors type leaves their browser.