Binary Logistic Regression Calculator

Logistic regression predicts a two-outcome Y (yes/no, 0/1) from one or more predictors by fitting an S-shaped probability curve instead of a straight line: p = 1 / (1 + e^-(b0+b1X1+...+bpXp)).

Include or exclude columns, transform them if needed, then press Calculate for coefficients, odds ratios, a chi-square test, pseudo R², and a classification report. Your data stays in this browser.

New to statistics? Read the plain-English guide — no background needed.

This tool answers one question: "Which factors make a yes/no outcome more likely, and how well can I predict it?" Example: does studying more hours and attending more classes make a student more likely to pass? You give it past cases; it finds the pattern.

  1. 1. Put your data in the table

    One row per person or case. Each predictor gets its own column (for example Hours Studied). The last column is the yes/no outcome. Click Example to see a filled table.

  2. 2. Or paste from Excel

    Use Paste / import to copy a table from Excel, Sheets or a CSV. The first row must be the column names, and the outcome must be the last column.

  3. 3. Check the outcome column

    It must contain exactly two values, like 0/1 or Yes/No. Leave a row's outcome empty if you want the model to predict it for you.

  4. 4. Press Calculate

    Nothing is calculated until you press the button. You can leave More options on the defaults.

  5. 5. Read the result

    Start with the 'In simple words' box and the green/red dials. Green means the check looks healthy, red means take a second look.

Rule of thumb to remember: the model turns your factors into a probability between 0% and 100%. Every unfamiliar word is explained in the guide below the tool.

Data — Passed is the last column, exactly two values

How to fill this table: each row is one person or case (one student, one customer). Predictor columns are the factors you think matter, and the last column is the outcome you want to predict, with only two possible values such as 0/1 or Yes/No. The pre-filled example predicts whether a student passed from hours studied and attendance.

Untick Include to leave a column out without deleting it; pick a Transform if a relationship looks curved. Passed takes exactly two values (0/1, or labels like Yes/No) — leave a row's Passed cell empty to have the model predict it. Nothing recalculates automatically — press Calculate below when you're ready.

#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

Fill in your data above and press Calculate to see results.

The plain-English guide

Read this once and you will understand most of what the tool shows you. Think of logistic regression as a fair judge who studies past cases: it looks at what passers and failers had in common, then gives every new case a probability between 0% and 100%.

When, how and why to use this calculator

When: whenever your answer is one of two things (pass/fail, buy/don't buy, sick/healthy, spam/not spam) and you have data on possible causes. How: fill the table (predictors in the columns, outcome last), then press Calculate. Why: to find out which factors really matter, how strongly, and to predict the outcome for new cases, for a class project, research paper or business decision.

Key words, explained simply

Predictor (X)

A factor you think influences the outcome. Example: hours studied, age, income. You can use one or several.

Outcome (Y)

What you want to predict, with exactly two possible values. Example: passed or failed.

Probability (p)

A number from 0 to 1 (0% to 100%) showing how likely the outcome is. p = 0.80 means an 80% chance.

Odds

Another way to express chance: p divided by (1 − p). A 50% chance = odds of 1; an 80% chance = odds of 4 (four to one).

Odds ratio (OR)

How much the odds multiply when a predictor goes up by 1. OR = 2 means the odds double; OR = 0.5 means they halve; OR = 1 means no effect.

Coefficient (b)

The raw effect of a predictor on the log-odds. Positive = raises the chance, negative = lowers it. The odds ratio is easier to read.

Log-odds (logit)

The scale the model works on internally so the maths is a straight line. You rarely need to read it directly.

p-value

The chance of seeing a pattern this strong by pure luck if the factor did nothing. Below 0.05 usually means 'significant'.

Significant

Unlikely to be luck alone. It does not mean the effect is large or important, only that it is probably real.

Confidence interval (CI)

The range the true value probably falls in. If a CI for an odds ratio includes 1, the effect could be zero.

Chi-square test

Checks whether your predictors, together, do better than just guessing the overall average for everyone.

Pseudo R²

How much of the pattern the model explains, from 0 to 1. Even 0.2 to 0.4 is considered a good fit here.

Classification cutoff

The line for turning a probability into a yes/no answer. At 0.5, anyone with 50% or more is predicted 'yes'.

Sensitivity / Specificity

Sensitivity: of the people who really are 'yes', how many did the model catch? Specificity: of the real 'no' people, how many did it correctly clear?

AUC

One score for how well the model separates 'yes' from 'no'. 0.5 = coin flip, 0.7 = fair, 0.8 = good, 0.9+ = excellent.

VIF

Warns when two predictors say almost the same thing (for example height in cm and height in inches). Above 5 is a warning.

Ridge (L2) penalty

An optional brake that keeps coefficients from getting extreme. Leave it at 0 unless the model has trouble converging.

A worked example you can check by hand

Imagine a model (made-up numbers, for illustration only) that predicts whether a student passes from hours studied, with b0 = −3 and b1 = 0.7.

  1. The odds ratio is e^0.7 ≈ 2.01: every extra hour of study roughly doubles the odds of passing.
  2. For a student who studies 2 hours: log-odds = −3 + 0.7×2 = −1.6, so p = 1 / (1 + e^1.6) ≈ 0.17 (17% chance).
  3. For 5 hours: log-odds = −3 + 0.7×5 = 0.5, so p = 1 / (1 + e^−0.5) ≈ 0.62 (62%).
  4. For 8 hours: log-odds = 2.6, so p ≈ 0.93 (93%). With a cutoff of 0.5, the model predicts "pass" for 5 and 8 hours and "fail" for 2 hours.

Notice the chance rises in an S-shape, not a straight line: big gains in the middle, small gains near 0% and 100%. That is why this method is used instead of linear regression for yes/no outcomes.

How to judge accuracy: a confusion matrix example

Say the model predicted 100 students and got this (again, made-up numbers): 40 real passers correctly predicted as pass, 10 real passers missed, 5 real failers wrongly predicted as pass, and 45 real failers correctly predicted as fail.

  • Accuracy = (40 + 45) / 100 = 0.85: 85 of 100 correct.
  • Sensitivity = 40 / (40 + 10) = 0.80: it caught 80% of the real passers.
  • Specificity = 45 / (45 + 5) = 0.90: it correctly cleared 90% of the real failers.
  • Precision = 40 / (40 + 5) ≈ 0.89: when it says "pass", it is right about 89% of the time.

What each tab shows

ResultThe big picture: is the model useful, how good is the fit, and a plain-language summary.
TestsOne row per predictor: its effect (odds ratio), whether it is significant, and its confidence interval.
DiagnosticsHealth checks on your data: averages, correlations, and warnings about overlapping predictors.
ClassificationHow often the model gets it right, shown as a confusion matrix and the ROC curve.
PredictThe predicted chance for every row, including rows where you left the outcome blank.
LearnThe whole calculation explained step by step, plus R and Python code to repeat it.

How to read your results

χ² p-value

Below 0.05: your predictors together really help. Above 0.05: the model is not clearly better than guessing.

Odds ratio

Above 1 raises the chance of the outcome, below 1 lowers it, exactly 1 means no effect. The further from 1, the stronger.

Predictor p-value

Below 0.05: that factor is probably a real influence. Above 0.05: can't tell it apart from luck.

McFadden R²

How much the model explains. Under 0.1 is weak, 0.2 to 0.4 is a good fit, and it rarely goes far above that.

Accuracy and AUC

Accuracy is the share of correct answers. AUC (0.5 = coin flip, 1 = perfect) says how well the two groups are separated.

Dials (green to red)

Green: healthy by common rules of thumb. Yellow/orange: acceptable. Red: worth a second look.

Common beginner mistakes

  • Using too little data. A handful of rows can give dramatic-looking but unreliable results.
  • Reading "significant" as "important". A tiny effect can still be significant in a large dataset.
  • Believing correlation means cause. The tool shows a pattern, not proof that one thing causes the other.
  • Feeding it an outcome with more than two values, or one where every row has the same value. It needs both outcomes present.
  • Including two predictors that mean the same thing. Check the VIF in the Diagnostics tab.

How this calculator works

The calculator fits logit(p) = b0 + b1X1 + ... + bpXp by maximum likelihood, using Newton's method (iteratively reweighted least squares) with optional step-halving and an optional ridge (L2) penalty for stability. Each coefficient's standard error, z-statistic, and p-value come from the inverse of the Hessian at convergence.

The chi-square test compares the fitted model to an intercept-only model; pseudo R² (McFadden, Cox & Snell, Nagelkerke) summarizes fit on a scale loosely like R² but not directly comparable to linear regression. The classification table and ROC/AUC evaluate how well the fitted probabilities separate the two outcome classes. Nothing is calculated until you press Calculate.

Common questions