Regression
Logistic Regression
Models the probability of a two-outcome event from numeric predictors and expresses each predictor's contribution as an odds ratio.
Method summary
Logistic regression is for outcomes with exactly two states: a subscriber renews or lapses, a respondent finishes the questionnaire or drops out. A straight line fitted to such an outcome would predict probabilities below zero and above one, so what gets modelled instead is the natural logarithm of the odds, which keeps every prediction between zero and one. Exponentiating a coefficient turns it into an odds ratio, the factor by which the odds of the event change for a one-unit rise in that predictor. YouReply Analyze estimates the model through the Logit class of statsmodels, includes an intercept by default and caps the solver at 100 iterations. The output carries coefficients, odds ratios, p values, McFadden's pseudo R squared, the log likelihood, AIC and BIC, along with a note on which value of the outcome was treated as the event. Nothing resembling a classification table or a ROC measure is produced.
Which research questions does it answer?
- How do satisfaction level and the number of support tickets change the probability of renewing a subscription?
- Do a respondent's age and the time spent on the questionnaire predict dropping out before the end?
- By what factor do the odds of trying a new product rise as brand trust increases?
- Which numeric variables distinguish those who completed a training programme from those who did not?
When should you use it?
- When the outcome takes exactly two values: happened or did not, stayed or left, chose or declined.
- When the probability of an event is to be described as a function of one or more numeric variables.
- When the effect is best reported multiplicatively, as a factor applied to the odds.
- When both states of the outcome occur often enough in the sample to be estimated.
Required variable types
- Dependent variable: a column holding exactly two distinct values. They need not be 0 and 1; the engine codes them itself and reports which value it treated as the event.
- Predictors: numeric columns, several of which can be selected together in the parameter form.
- Categorical predictors have to be turned into dummy columns first, which the derived column tool on the Variable tab will do.
- Outcomes with three or more categories do not belong here, and collapsing them to two is only acceptable when the merge makes substantive sense.
Key assumptions
- A two-state outcome
- The model is defined only for an event with two outcomes. A three-category variable can be collapsed into two, but the merge has to be defensible on theoretical grounds.
- Linearity on the logit scale
- The assumption concerns the log odds rather than the outcome itself: each unit increase in a predictor is taken to shift the logit by the same amount everywhere along the scale.
- Independent observations
- Every row should come from a different participant. Several outcomes recorded from the same person, or a clustered sample, make the standard errors smaller than they ought to be.
- No severe overlap among predictors
- Predictors that duplicate one another destabilise the estimates: odds ratios can point in unexpected directions and standard errors swell.
- Enough events per predictor
- When the outcome is rare the coefficients come out exaggerated. A widely used benchmark asks for at least 10 cases in the less frequent category for every predictor.
- Model fit assessed separately
- Significant coefficients say nothing about whether the model fits. Fit is a question of how closely predicted and observed outcomes agree.
How YouReply checks these assumptions
- A two-state outcome: The engine requires exactly two distinct values in the outcome column and stops with an error when it finds more. Which value counts as the event appears in the coding section of the result.
- Linearity on the logit scale: This linearity is never tested, and no warning appears when the pattern curves. If you suspect it does, split the predictor into bands and compare the event rate across bands yourself.
- Independent observations: The panel does not check this assumption automatically; the researcher evaluates it.
- No severe overlap among predictors: Not a single collinearity measure is computed: no VIF, no tolerance, no condition index, and no notice that your predictors overlap. Examining the correlations among them with the correlation methods, and deciding what to do, is your own task.
- Enough events per predictor: The panel never compares your event count with the number of predictors or judges whether it is sufficient. Work the ratio out yourself from the reported sample size and the distribution of the outcome.
- Model fit assessed separately: No Hosmer-Lemeshow goodness-of-fit test, classification table, ROC curve or AUC is calculated for this method. All you have on fit is McFadden's pseudo R squared and the information criteria; seeing how well the model classifies means generating predictions elsewhere.
How the analysis is run
- 1Drop your data file on the upload area; CSV and XLSX are both accepted.
- 2Check on the Data tab that the outcome column really holds just two values. Blank cells or codes such as 'No answer' count as a third value, so declare them as missing on the Variable tab.
- 3Pick the method from the search box or under the regression heading on the Analysis tab. With the 'Only ones that fit my data' switch on, a dataset without a two-valued column leaves the method dimmed, with the reason stated.
- 4Mark the outcome and the predictors in the parameter form. The intercept and the iteration ceiling can both stay at their defaults.
- 5Start the run. Coefficients and odds ratios, the pseudo R squared with the likelihood measures, and the coding information open as separate sections, with a bar chart of the coefficients on top.
- 6Do not finish interpreting before reading the convergence line: when the ordinary fit fails, the engine falls back on a regularised one. Tables export to Excel, the chart to PNG, and the run can be reopened from the History tab.
Statistics and tables produced
- Coefficients
- Raw coefficients on the logit scale. A positive sign means the probability of the event rises as the predictor grows.
- Odds ratios
- The exponentiated coefficients. Above one the predictor multiplies the odds upward, below one downward, and exactly one marks no effect.
- p value per coefficient
- The significance of each predictor's contribution against zero. In runs that fall back on the regularised fit these cells may hold a non-numeric value instead.
- McFadden's pseudo R squared
- A fit index built on the improvement in log likelihood. It does not live on the same scale as R squared from a linear model; in survey data values near 0.20 already indicate good fit.
- Log likelihood, AIC and BIC
- The likelihood the solver reached, plus two information criteria for weighing up competing models fitted on the same data.
- Convergence flag
- Whether the ordinary estimation finished successfully. If it did not, the model came from the regularised fit and the p values may be unreadable.
- Outcome coding
- The two values found in the outcome column and which of them was taken as 1. Reading the direction of the odds ratios correctly depends on this line.
- Number of observations and predictors
- How many rows entered the model and how many predictors it holds. With a rare outcome, the ratio between the two is the first clue to how much the coefficients can be trusted.
- Coefficient chart
- The results panel charts the coefficients as bars, downloadable as a PNG. The bars show logit-scale coefficients rather than odds ratios.
Effect size and confidence intervals
- Odds ratio
- The factor by which a one-unit rise in the predictor multiplies the odds of the event. A value of 1.50 means the odds grow by half, 0.67 that they shrink by about a third. An odds ratio is not a risk ratio: when the event is very common or very rare, the same odds ratio corresponds to quite different changes in probability.
- McFadden's pseudo R squared
- The share of likelihood the model accounts for. It takes distinctly smaller values than R squared in linear models; the literature treats 0.20 to 0.40 as good fit, and a value near 0.05 can accompany a weak but genuine model.
No confidence interval is returned for the coefficients or for the odds ratios; the tables hold point estimates and p values only. The pseudo R squared comes without an interval as well. Where a journal insists on a 95% interval for an odds ratio, it has to be derived from the coefficient and its standard error outside the panel. Keep in mind too that the p values may come back as non-numeric when the run falls back on the regularised fit: significance cannot be interpreted in that case, and trimming the predictor list is usually the sounder response.
Example research question and example result
The numbers below are a representative example, not data from a real study or a real user.
- Research question
- In an illustrative subscriber study, how do satisfaction and the number of support tickets opened during the year affect the probability of renewal?
- Variables
- Dependent variable: subscription renewed (renewed / not renewed) · Predictor 1: satisfaction level (continuous score from 1 to 10) · Predictor 2: number of support tickets opened during the year
- Example result
- Across n = 480 subscribers, 'renewed' was coded as 1. The odds ratio for satisfaction was 1.12 (b = 0.11, p < 0.001) and for ticket count 0.78 (b = -0.25, p = 0.010). McFadden's pseudo R squared = 0.18, log likelihood = -241.6, AIC = 489.2, BIC = 501.7. The ordinary estimation converged.
- Interpretation
- Each additional point of satisfaction raises the odds of renewal by roughly 12% with ticket count held constant, while every further support ticket multiplies those odds by 0.78, a drop of about a fifth. At 0.18 the pseudo R squared sits in the range usually considered good for models of this kind. Odds and probability are not interchangeable: for a subscriber already almost certain to renew, an odds ratio of 1.12 shifts the probability very little, whereas for one on the fence it can matter. Since the panel produces neither a classification table nor an AUC, this output cannot tell you whom the model gets right.
Real output on a sample dataset
The results below were produced by the analysis engine from this data file. Changing the variable changes the research question as well; every run was computed in advance, so the page sends no request to the engine.
General customer survey (synthetic)
A wide survey of three hundred respondents: two and three category grouping variables, continuous measures, a five point ordinal scale, a binary purchase outcome, a four category brand choice, three repeated measurements, paired binary questions, three raters, four price questions and deliberately empty cells.
- Rows
- 300
- Columns
- respondent_id, gender, education, region, age, income, satisfaction, service_score, price_score, quality_score, loyalty, nps_score, purchased, brand_choice, satisfaction_level, pre_score, post_score, measure_1, measure_2, measure_3, use_before, use_after, use_followup, rater_1, rater_2, rater_3, price_too_cheap, price_cheap, price_expensive, price_too_expensive, feedback_score, followup_rating
The data is synthetic: it comes from a fixed random seed, not from a real study. The values below were produced by the analysis engine from this file, so uploading the same file to the panel gives the same results.
Research question: Do satisfaction and income predict the probability of purchase?
- Dependent variable
- purchased
- Independent variables
- satisfaction,income
- Pseudo R squared (McFadden)
- 0.103
- Log likelihood
- -186.44
- Valid observations
- 300
- Number of predictors
- 2
- Akaike information criterion (AIC)
- 378.89
- Bayesian information criterion (BIC)
- 390.00
- Estimation converged
- Yes
- Degrees of freedom
- 297
- dependent_var
- purchased
Coefficients
- Intercept (constant)
- -4.72
- satisfaction
- 0.730
- income
- 0.021
Odds ratios
- Intercept (constant)
- 0.009
- satisfaction
- 2.08
- income
- 1.02
p values
- Intercept (constant)
- < 0.001
- satisfaction
- < 0.001
- income
- 0.005
Outcome coding as 0/1
- 0
- 0
- 1
- 1
Computation credits: scipy 1.18.0 · statsmodels 0.14.6 · scikit-learn 1.9.0 · numpy 2.5.1 · pandas 3.0.5 · semopy 2.3.11 · 89fc29a · Data seed: 20260914
How to report the result
In a logistic regression, renewal was predicted by satisfaction (OR = 1.12, p < .001) and by the number of support tickets (OR = 0.78, p = .010), with McFadden's pseudo R squared = .18 (n = 480).
An example sentence close to APA style; the numbers are representative.
When you should not use it
- With no classification table, ROC curve or AUC, the predictive performance of the model cannot be judged in the panel; only likelihood-based fit indices are available.
- There is no goodness-of-fit test such as Hosmer-Lemeshow, so you cannot see whether predicted and observed rates agree across bands of predicted risk.
- No collinearity measure of any kind is returned, which means the instability caused by overlapping predictors leaves no trace on the results screen.
- Coefficients and odds ratios arrive without intervals, so the 95% interval that most journals expect has to be computed outside the panel.
- When the ordinary fit fails, the regularised fallback can leave the p values as non-numeric values, and significance should not be interpreted from those runs.
- An outcome with three or more categories, or with ordered categories, calls for a different model; forcing it into two throws information away.
What to use when the assumptions are not met
- Chi-Square Test of IndependenceWhy: When the predictor is categorical as well and the question is simply whether two categorical variables are associated, a cross-tabulation answers it more directly.
- Linear Regression (OLS)Why: When the outcome is continuous rather than binary, the coefficients can be read straight off in the units of the scale.
- Ordinal Logistic RegressionWhy: When the outcome categories are ordered (not at all satisfied, slightly, moderately, very), the ordering is not wasted by collapsing to two.
- Multinomial Logistic RegressionWhy: When the outcome has more than two unordered categories, such as which of brands A, B and C was chosen.
Frequently asked questions
- How do I read an odds ratio?
- An odds ratio is the factor by which one more unit of the predictor multiplies the odds of the event. 1.25 means the odds go up by a quarter, 0.80 that they fall by a fifth, and exactly 1 means no effect. Two cautions: the figure concerns odds rather than probability, and its direction depends on which value of the outcome was coded as 1. Confirm that in the coding section before you describe the direction.
- My p values came back empty or non-numeric, what happened?
- The ordinary estimation did not converge and the engine switched to a regularised fit. Behind that you will usually find one of three situations: a predictor separates the outcome almost perfectly, the predictors duplicate each other, or the rarer outcome category holds too few cases for the number of predictors. The remedy is not to force a p value but to simplify: drop predictors, merge overlapping columns, and look at how the outcome is distributed.
- Where can I see the model's classification accuracy?
- This method computes no classification table, sensitivity, specificity or AUC; only likelihood-based fit measures are returned. If classification performance is central to your question, generate predictions from the coefficients yourself or do that part of the work in another tool. Reading the pseudo R squared as a percentage of correct classifications is a common and serious mistake.
- How many cases do I need?
- What matters is not the total row count but the number of cases in the less frequent outcome category. At least 10 events per predictor is the usual floor: if an event occurred only 30 times in a sample of 500, going beyond two or three predictors will inflate the coefficients. The panel does not police this ratio, so the calculation is yours to make.
References
- Hosmer, D. W., Lemeshow, S., & Sturdivant, R. X. (2013). Applied Logistic Regression
- Field, A. (2018). Discovering Statistics Using IBM SPSS Statistics
- Tabachnick, B. G., & Fidell, L. S. (2019). Using Multivariate Statistics
- statsmodels Logit documentation
Try it with your own data
The free plan includes 50 analysis runs a month and needs no card.