Written and maintained by CASRAI Editorial Board
Last updated
Types of regression analysis differ mainly by the outcome variable and the problem in the data. Ordinary least squares fits a continuous outcome; logistic, Poisson and Gamma models are generalized linear models (GLMs) for binary, count and positive skewed outcomes; ridge, lasso and elastic-net handle many predictors; robust and quantile regression handle outliers and non-mean questions. This guide maps each type to the exact class or function in statsmodels, scikit-learn and R. Software documentation was read on 2026-11-08.
What it is used for in research
Regression estimates how an outcome changes with one or more predictors. The choice of type is driven by what the outcome looks like and which assumption is at risk, not by the software. The table below is the decision aid; the sections after it show how to run the choice.
| Situation | Type | statsmodels | scikit-learn | R (stats) |
|---|---|---|---|---|
| Continuous outcome, errors with constant variance | Ordinary least squares (OLS) | OLS |
LinearRegression |
lm() |
| Unequal error variance or correlated errors | Weighted / generalized least squares | WLS, GLS, GLSAR |
– | – |
| Binary outcome | Logistic regression (GLM, binomial family, logit link by default) | GLM with a binomial family |
LogisticRegression |
glm(..., family = binomial) |
| Count outcome | Poisson regression (GLM, log link by default) | GLM with a Poisson family |
PoissonRegressor / TweedieRegressor (power = 1) |
glm(..., family = poisson) |
| Counts or proportions more variable than the model allows (over-dispersion) | Quasi-Poisson / quasi-binomial | – | – | family = quasipoisson, family = quasibinomial |
| Positive, right-skewed continuous outcome | Gamma regression | – | TweedieRegressor (power = 2) |
family = Gamma |
| Many predictors, shrink coefficients | Ridge (L2), lasso (L1), elastic net | – | Ridge, Lasso, ElasticNet |
– |
| Outliers or corrupt data | Robust regression | – | robust estimators (section 1.1.14) | – |
| Median or other quantile of the outcome, not the mean | Quantile regression | QuantReg |
QuantileRegressor |
– |
| Curved relationship, still linear in the parameters | Polynomial regression | OLS on transformed columns | linear model on polynomial features | lm() with terms such as I(x^2) |
Cells marked “-” mean the packages’ linear-model documentation read for this guide does not list a dedicated class for that row. Cox and other time-to-event models are covered separately in Cox proportional hazards model explained.
Two clarifications that prevent common mistakes
- Logistic, Poisson and Gamma regression are generalized linear models. scikit-learn describes a GLM as an inverse link function combined with the unit deviance of an exponential-family distribution. R’s
familyobjects set the default link: binomial uses logit, poisson uses log, Gamma uses inverse, gaussian uses identity (andlm()is the gaussian case). - Polynomial regression is still linear regression. scikit-learn’s documentation presents it as a linear model fitted on nonlinear functions of the data, so the same OLS machinery and diagnostics apply.
Install or access (official source only)
- statsmodels (Python): documentation at statsmodels.org; the regression models are described on its Linear Regression page.
- scikit-learn (Python): documentation at scikit-learn.org, section 1.1 “Linear Models”.
- R:
lm(),glm()and thefamilyobjects are in the basestatspackage, so no extra install is needed.
Step-by-step: choose and fit the type
- Name the outcome type. Continuous, binary, count, positive skewed, or something where the median matters more than the mean.
- Pick the row in the table. Start with OLS for a continuous outcome; start with a GLM family for binary, count or positive-skewed outcomes.
- Fit the model. Examples, with
y,x1,x2anddfstanding for your own data:# Python, statsmodels formula API import statsmodels.api as sm import statsmodels.formula.api as smf ols = smf.ols("y ~ x1 + x2", data=df).fit() logit = smf.glm("y ~ x1 + x2", data=df, family=sm.families.Binomial()).fit() pois = smf.glm("y ~ x1 + x2", data=df, family=sm.families.Poisson()).fit() med = smf.quantreg("y ~ x1 + x2", data=df).fit(q=0.5) # R (stats) fit_lm <- lm(y ~ x1 + x2, data = df) fit_bin <- glm(y ~ x1 + x2, family = binomial, data = df) fit_pois <- glm(y ~ x1 + x2, family = poisson, data = df) fit_qp <- glm(y ~ x1 + x2, family = quasipoisson, data = df) summary(fit_pois) - Check the assumption that motivated the choice. If count residuals are more variable than the Poisson model allows, switch to quasi-Poisson (R documents that the quasi families do not fix the dispersion at one and can model over-dispersion). If error variance is unequal, use weighted least squares. For numerous predictors, move to ridge, lasso or elastic net.
- Report the type and software. State the model family, link, package and version in the methods section.
Output and how to read it
Every type reports a coefficient per predictor with a standard error and test statistic, but the scale differs. In OLS the coefficient is the change in the outcome per unit of the predictor. In a GLM the coefficient is on the link scale: the log-odds scale for logistic regression and the log scale for Poisson regression, because those are the default links. Exponentiating a logistic coefficient gives an odds ratio and exponentiating a Poisson coefficient gives a rate ratio. Quantile regression coefficients describe the chosen quantile; scikit-learn notes that quantile regression estimates the median or other quantiles of y conditional on X, while OLS estimates the conditional mean, so the two can differ when the outcome is skewed.
Ridge and lasso coefficients are deliberately shrunk. scikit-learn explains that ridge imposes a penalty on coefficient size and lasso can set coefficients exactly to zero, so shrunken estimates are not directly comparable to unpenalized OLS estimates.
Troubleshooting
- Logistic regression “for classification”. scikit-learn notes that despite its name,
LogisticRegressionis implemented as a linear model for classification. For a GLM-style fit with the usual inference output, use the binomial family in statsmodels or R. - Over-dispersed counts. Use
quasipoissonin R; see quasi-Poisson vs negative binomial. - Outliers dominating the fit. Try robust regression, or quantile regression at q = 0.5.
- Many predictors. See ridge vs lasso regression and stepwise regression steps.
- Unsure about assumptions. Review assumptions of simple regression.
Free alternatives (table)
statsmodels, scikit-learn and R are all free and open source. Each type also has a dedicated CASRAI guide:
| Type | CASRAI guide |
|---|---|
| Linear and multiple regression | Linear regression and multiple regression |
| Weighted least squares | Weighted least squares |
| Poisson regression | Poisson regression analysis |
| Multinomial logistic | Multinomial logistic regression |
| Ordinal logistic | Ordinal logistic regression |
| Quantile regression | Quantile regression analysis |
| Logistic in Python | scikit-learn logistic regression |
FAQ
What are the main types of regression analysis?
Linear (OLS), logistic, Poisson, Gamma, ridge, lasso, elastic net, robust, quantile and polynomial regression are the types covered in the scikit-learn, statsmodels and R documentation read for this guide. Choose by outcome variable first.
Is logistic regression really regression?
Yes. It is a generalized linear model with a binomial family and a logit link by default in R. scikit-learn calls its implementation a linear model for classification.
What is the difference between ridge and lasso?
Both penalize coefficient size. Lasso can set coefficients exactly to zero, giving sparse models; ridge shrinks without zeroing. Elastic net uses both penalties.
Is polynomial regression nonlinear?
It models a curved relationship but is linear in the parameters, so it is fitted as a linear model on transformed predictors.
Sources (official docs)
- statsmodels, Linear Regression: statsmodels.org/stable/regression.html (read 2026-11-08)
- scikit-learn, Linear Models: scikit-learn.org/stable/modules/linear_model.html (read 2026-11-08)
- R documentation,
family(stats): stat.ethz.ch/R-manual/R-devel/library/stats/html/family.html (read 2026-11-08)







