Logistic Regression Calculator
This free logistic regression calculator fits a logistic model to your data, returns the coefficients, odds ratio, accuracy and decision boundary, and plots the fitted S-curve — so you can see exactly how the probability of a yes/no outcome changes with your predictor.
How to use the logistic regression calculator
- Enter your predictor (\(x\)) values — any numeric variable such as hours studied, age, or dose.
- Enter the outcome (\(y\)) as
0or1(fail/pass, no/yes), one label per \(x\) value. - Press “Fit logistic model” to estimate the coefficients and draw the probability curve.
- Type any \(x\) in the predict box to get the probability and predicted class for a new case.
What the logistic regression calculator computes
Logistic regression models the probability of the outcome with the sigmoid function:
$$p = \frac{1}{1 + e^{-(\beta_0 + \beta_1 x)}}$$The calculator estimates \(\beta_0\) and \(\beta_1\) by maximum likelihood (using gradient descent), then reports:
| Output | Meaning |
|---|---|
| Intercept \(\beta_0\) | Log-odds of the outcome when \(x = 0\). |
| Coefficient \(\beta_1\) | Change in log-odds per one-unit increase in \(x\). |
| Odds ratio \(e^{\beta_1}\) | How the odds multiply for each one-unit rise in \(x\). |
| Accuracy | Share of points classified correctly at the 0.5 threshold. |
| Pseudo \(R^2\) | McFadden’s fit measure — higher means a better fit. |
| Decision boundary | The \(x\) where \(p = 0.5\) (the model flips its prediction). |
Worked example: hours studied vs passing
The built-in example is the classic study-hours dataset: 20 students, their hours of study (\(x\)), and whether they passed (\(y = 1\)) or failed (\(y = 0\)). Fitting it gives roughly \(\beta_0 \approx -4.08\) and \(\beta_1 \approx 1.50\), so each extra hour multiplies the odds of passing by about \(e^{1.5} \approx 4.5\), and the 50% decision boundary lands near 2.7 hours. Study less and you are more likely to fail; study more and the curve climbs toward a near-certain pass.
🤖 Why logistic regression matters in ML
Logistic regression is the simplest classification model and the building block of neural networks — a single neuron with a sigmoid activation. It is supervised learning; see supervised vs unsupervised vs reinforcement learning. To understand how it differs from fitting a straight line, read logistic regression vs linear regression, or fit continuous data with the linear regression calculator.
Assumptions to keep in mind
- The outcome is binary (exactly two classes).
- The log-odds are linearly related to the predictor.
- Observations are independent.
- There is enough data in both classes — this tool needs at least one 0 and one 1.
Frequently asked questions
What does a logistic regression calculator do?
What data do I need?
How is the coefficient interpreted?
What is the decision boundary?
Is this multiple or simple logistic regression?
Key takeaways
A logistic regression calculator turns raw 0/1 data into a fitted probability curve, coefficients and an odds ratio in one click. Use it to model any yes/no outcome, read the decision boundary, and predict the probability for new inputs. Pair it with the logistic vs linear regression guide or the formal reference on Wikipedia.
Keep learning: logistic regression is usually trained with L1 or L2 regularisation, and on imbalanced data you should weight the classes.