Binary logistic regression online: odds ratios, Nagelkerke R²
Binary logistic regression is the model to use when the outcome has only two values, such as bought or did not buy, used a service or not, left or stayed; aim for at least 10 cases in the rarer outcome group per parameter (Peduzzi et al., 1996). Upload your data, choose the outcome and the predictors, and the tool estimates the model as SPSS Binary Logistic does and writes three tables plus the results paragraph.
- Upload an Excel or CSV file (one row per case), or try the sample data.
- Choose the two-valued dependent variable, the value coded as 1, and the predictors.
- Run the model, then download the Word file or copy the tables and text.
Saved to the results chapter report builder in this browser.
Maximum likelihood estimation (Newton–Raphson), as in SPSS Binary Logistic and R’s glm(family = binomial); the Hosmer–Lemeshow test uses 10 groups by predicted probability without splitting tied cases, as SPSS does. Check against SPSS the first time you use it.Was this tool useful? Feedback / report a bug (by email; please do not paste real data).
When to use logistic regression
- The dependent variable has exactly two values (a binary nominal variable). If your outcome is the mean Likert score of a construct, use linear regression instead.
- Predictors can be numeric (age, income, construct mean scores) or categorical (gender, region). Categorical predictors are dummy-coded against a reference category, which you can set to the first category or to the last (the SPSS default).
- Sample size: each estimated parameter should have at least 10 cases in the rarer outcome group (Peduzzi et al., 1996). A model with 6 parameters therefore needs about 60 people in the smaller group. The tool warns you when your data fall below this.
How to read the three tables
- Omnibus test compares your model with the constant-only model. p < .05 means the predictors together improve prediction.
- Nagelkerke R² is a pseudo-R² and should not be read like the R² of linear regression; values of .20 to .40 are common in the social sciences. Cox & Snell R² is always smaller and cannot reach 1.
- Hosmer–Lemeshow test: p ≥ .05 indicates adequate fit, meaning predicted and observed proportions do not differ significantly. Unlike most tests, here you want a large p.
- Classification table: compare the overall percentage correct with the share of the larger group. The model is useful only when it beats always guessing the larger group.
- Exp(B), the odds ratio: above 1, the odds of the event rise as the predictor increases; below 1, they fall. Exp(B) = 1.5 means the odds rise by 50%, not the probability. If the 95% confidence interval for Exp(B) contains 1, the coefficient is not significant.
Reporting it in APA 7 style
Report the omnibus chi-square with its degrees of freedom and p, Nagelkerke R², the Hosmer–Lemeshow result and the percentage correctly classified, then each predictor with B, Wald, p and the odds ratio with its 95% CI. Drop the leading zero for p and R², which cannot exceed 1. A template: “The model was statistically significant, χ²(df) = value, p < .001, Nagelkerke R² = value. Each one-unit increase in perceived usefulness increased the odds of using the service by a factor of Exp(B), holding the other predictors constant.” Always state the reference category for categorical predictors. The tool writes this paragraph from your results and saves it to the results chapter report builder.
Worked example: the built-in sample data
Click “Use sample data” to load 300 student responses. The outcome, UsedPanel (Yes/No), records whether the student used a paid survey-panel service; the predictors are perceived usefulness (PU1–PU3), cost concern (CP1–CP3), year of study and gender. The tool offers the construct scores PU and CP, already ticked, plus gender and year as categorical predictors, and sets “Yes” as the event. The coefficient table then shows how the odds of using the service change with each predictor.
Common problems
- Huge coefficients or standard errors: complete separation (one predictor sorts every case correctly) or a category with too few cases. Merge small categories or drop the predictor.
- Selecting a construct score together with its items (PU and PU1–PU3) makes the model impossible to estimate. Choose one or the other.
- Changing the reference category changes the sign and the Exp(B) of a categorical predictor but not the fit of the model. State the reference category in your write-up.
FAQ
What is the difference between an odds ratio and a probability?
Odds are the probability of the event divided by the probability of no event. An odds ratio of 2 doubles the odds, which is not the same as doubling the probability, especially when the event is common.
Do I need SPSS to check the results?
No, but it is worth comparing once. The estimates use maximum likelihood (Newton–Raphson), as SPSS Binary Logistic and R's glm with a binomial family do, and the Hosmer–Lemeshow test groups cases as SPSS does.
My Hosmer–Lemeshow test is significant. Is the model useless?
Not necessarily, but predicted probabilities do not match observed proportions in some groups. Consider adding predictors or a different functional form (Hosmer et al., 2013), and note it in your limitations.
I only have one categorical predictor. Do I need regression?
A chi-square test of the crosstab answers the same question more simply.
References
- Hosmer, D. W., Jr., Lemeshow, S., & Sturdivant, R. X. (2013). Applied logistic regression (3rd ed.). Wiley. https://doi.org/10.1002/9781118548387
- Nagelkerke, N. J. D. (1991). A note on a general definition of the coefficient of determination. Biometrika, 78(3), 691–692. https://doi.org/10.1093/biomet/78.3.691
- Peduzzi, P., Concato, J., Kemper, E., Holford, T. R., & Feinstein, A. R. (1996). A simulation study of the number of events per variable in logistic regression analysis. Journal of Clinical Epidemiology, 49(12), 1373–1379. https://doi.org/10.1016/S0895-4356(96)00236-3
One of the free research tools of Research Corner.