Regression Analysis
Regression analysis is the practice of fitting a mathematical function to observed data so you can describe how one or more inputs relate to an outcome, and use that fitted function to predict or explain the outcome.
itData engineering and analytics | OpenSkills.info
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Don't Panic
Don't Panic — Regression Analysis
Regression analysis is the art of drawing a line through a cloud of data points and then, this is the important part, interrogating the line about everything it is hiding. You give it inputs and an outcome. It returns coefficients, an R-squared, and a pile of residuals, the gaps between what happened and what the model predicted. Those gaps are the interesting part. Treat them with respect and the model can be trusted; ignore them and you have a confident number with a private life.
Before regression existed, people either had an exact formula, like converting Celsius to Fahrenheit, or they squinted at scatter plots and handed round the sturdiest-looking guess. Regression handles the middle ground: real relationships, which have a trend plus scatter, because two houses of identical size still refuse to sell at the same price. Least squares is the machinery that picks the line, by making every miss count proportionally to its square. One huge miss costs more than a hundred small ones, which is the fitting criterion's way of holding grudges.
Three ideas hold everything up. First, the slope is a rate of change estimated from this data, one unit of input at a time. Second, the residuals are where the truth about the model lives: plot them against the fitted values, and curvature or funnel shapes mean the model's assumptions are leaking. Third, the intervals around predictions are only as honest as the assumptions behind them, summarized as the LINE conditions: mean is Linear, errors are Independent, errors are Normal, errors have Equal variance. The fit itself needs none of those; the statistical promises need all of them, which is why the plots come before the promises.
The surprise is what the vocabulary gets away with. A coefficient reads like a button you can press, "raise education by one unit and wages rise by X", but the method only measured an association in this dataset, conditional on the other predictors. An unobserved factor that drives both, ability say, can inflate the number while every calculation stays technically correct. And two predictors that move together cannot be pulled apart: their slopes swing depending on who else is in the model, even though the predictions stay calm. Correlation of predictors is a trap for interpretation, not necessarily for prediction.
One more behavior worth knowing: high-leverage observations, data points with unusual input values, can drag the line toward themselves and even flip a slope's sign. Verify them before deleting; occasionally they are the most informative point in the dataset.
Where to go from here: the Reference tab has the NIST handbook and Penn State's STAT 501 course, which is the full map from this overview to working diagnostics. The Cheatsheet keeps the formulas and the residual-plot decoder at hand. The Practice reference works the calculations, the Landscape tab shows the software that fits these models, and the Field Notes carry what teams reliably get wrong. The Quiz, when you are ready, will ask what the residuals would say.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://www.itl.nist.gov/div898/handbook/pmd/section1/pmd141.htm
Supports
- Linear least squares as the most widely used modeling method
- Linear-in-the-parameters definition and examples
- Advantages - efficiency with small datasets, interpretable intervals
- Disadvantages - shape limits, poor extrapolation, outlier sensitivity
- Gauss, Legendre, and Adrain's independent development of least squares
- https://www.itl.nist.gov/div898/handbook/pmd/section4/pmd431.htm
Supports
- Least squares criterion Q = sum of squared deviations
- Closed-form slope and intercept estimators for the straight line
- Correlation of parameter estimators
- Residual standard deviation formula with n - p degrees of freedom
- https://www.itl.nist.gov/div898/handbook/pmd/section4/pmd44.htm
Supports
- R-squared is not enough; model validation as the important step
- Residual as observed minus fitted (ei = yi − f(xi; beta-hat))
- Graphical residual analysis as the primary validation tool
- Random residuals indicate adequate fit; structure indicates poor fit
- Residual plots against fitted values, predictors, and order
- https://online.stat.psu.edu/stat501/
Supports
- Course structure covering SLR, MLR, assumptions, influential points, multicollinearity, weighted least squares, and logistic regression
- CC BY-NC 4.0 open educational resource status
- https://online.stat.psu.edu/stat501/Lesson01.html
Supports
- Simple linear regression definition; predictor and response terms
- Deterministic versus statistical relationship distinction
- Interpretation of intercept and slope
- R-squared and correlation as measures of linear association
- R-squared cautions
- https://online.stat.psu.edu/stat501/Lesson04.html
Supports
- LINE conditions (Linear, Independent, Normal, Equal variance)
- Residual plots as the check for each condition
- What goes wrong when each condition fails
- https://online.stat.psu.edu/stat501/Lesson05.html
Supports
- Multiple linear regression extension of SLR concepts
- Adjusted R-squared for model building
- Coefficient interpretation with other predictors held fixed
- Confidence vs prediction intervals carried to MLR
- https://online.stat.psu.edu/stat501/Lesson08.html
Supports
- Indicator (dummy) coding for categorical predictors
- Interaction effects between predictors
- https://online.stat.psu.edu/stat501/Lesson09.html
Supports
- Remedies for assumption failures, including transformations and polynomial regression, log transforms
- https://online.stat.psu.edu/stat501/Lesson11.html
Supports
- Outlier (unusual response) versus high-leverage (unusual predictors)
- A point can be both outlier and high leverage
- Leverages, studentized residuals, DFFITS, Cook's distance
- https://online.stat.psu.edu/stat501/Lesson12.html
Supports
- Multicollinearity definition (moderately or highly correlated predictors)
- Pitfalls such as coefficients that depend on which predictors are included, precision loss, and hypothesis tests flipping
- Extrapolation, overfitting, omitted predictors as regression pitfalls
- Detection and reduction of multicollinearity
- https://online.stat.psu.edu/stat501/Lesson13.html
Supports
- Weighted least squares for heteroscedastic errors
- Logistic regression for binary responses
- https://www.openintro.org/book/os/
Supports
- Chapter 8 on linear regression covering line fitting, residuals, correlation, least squares, outliers in regression, and inference
- Chapter 9 on multiple regression covering model selection, checking conditions, and logistic regression
- Free textbook availability and chapter structure
- https://scikit-learn.org/stable/modules/linear_model.html
Supports
- Linear model as linear combination of features; coef_ and intercept_
- OLS minimization of residual sum of squares
- Multicollinearity from correlated features making estimates highly sensitive
- Ridge penalty on coefficient size; larger alpha shrinks more
- Lasso L1 penalty producing sparse coefficients
- Elastic Net combining L1 and L2
- https://scikit-learn.org/stable/auto_examples/inspection/plot_linear_model_coefficient_interpretation.html
Supports
- Coefficients as conditional (not marginal) dependencies
- Correlated features (AGE and EXPERIENCE) causing coefficient instability across cross-validation folds
- Omitted variable bias from unobserved confounder (ability) in the wage-education example
- Causal interpretation difficulty with confounding effects
- Cross-validation coefficient variability as a stability check
- https://www.statsmodels.org/stable/regression.html
Supports
- OLS, WLS, GLS estimation in statsmodels
- Summary table with coefficients, standard errors, t statistics, confidence intervals, Durbin-Watson
- https://www.statsmodels.org/stable/about.html
Supports
- statsmodels origin in the scipy.stats models module, corrected, tested, and released as a package after Google Summer of Code 2009
- Verification of results against R, Stata, or SAS
- https://scikit-learn.org/stable/about.html
Supports
- scikit-learn started 2007 as a Google Summer of Code project
- First public release February 1, 2010
- https://journal.r-project.org/articles/RJ-2009-014/
Supports
- R history with early public releases in 1993, GNU project status, and the R 1.0.0 release in 2000
- https://www.stata.com/company/
Supports
- Stata 1.0 released January 1985
- https://archive.org/details/nouvellesmthode00legegoog
Supports
- Legendre's 1805 "Nouvelles méthodes pour la détermination des orbites des comètes" containing the least squares appendix
- https://doi.org/10.1017/cbo9780511841705
Supports
- Gauss's Theoria motus corporum coelestium (1809), developing least squares with a probabilistic error foundation
- https://doi.org/10.2307/2841583
Supports
- Galton's "Regression Towards Mediocrity in Hereditary Stature" (1886), origin of the term regression
- https://doi.org/10.2307/2331554
Supports
- Gosset's "The Probable Error of a Mean" (1908), the t distribution underlying coefficient inference
- https://doi.org/10.1098/rsta.1922.0009
Supports
- Fisher's "On the Mathematical Foundations of Theoretical Statistics" (1922), estimation theory framework
- https://doi.org/10.1080/00031305.1973.10478966
Supports
- Anscombe's "Graphs in Statistical Analysis" (1973), identical regression summaries across datasets with different shapes
- https://doi.org/10.1080/00031305.2016.1154108
Supports
- ASA statement context on statistical significance and p-value interpretation supporting caution around test-based inference
- https://octave.org/
Supports
- GNU Octave as an open numerical computing environment
- https://github.com/qinwf/awesome-R#readme
Supports
- broom (statistical objects to tidy data frames)
- jamovi and JASP as SPSS-familiar open statistical applications
- Radiant (browser-based business analytics in R)
- https://github.com/academic/awesome-datascience#readme
Supports
- scikit-learn, pandas, NumPy, Seaborn, and Matplotlib as the core Python data-science stack
- Jupyter as the standard notebook environment
