Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Regression analysis
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Set of statistical processes for estimating the relationships among variables}} [[File:Normdist regression.png|thumb|right|200px|Regression line for 50 random points in a [[Gaussian distribution]] around the line y=1.5x+2.]] {{Regression bar}} {{Machine learning|Problems}} In [[statistical model]]ing, '''regression analysis''' is a set of statistical processes for [[Estimation theory|estimating]] the relationships between a [[dependent variable]] (often called the ''outcome'' or ''response'' variable, or a ''label'' in machine learning parlance) and one or more error-free [[independent variable]]s (often called ''regressors'', ''predictors'', ''covariates'', ''explanatory variables'' or ''features''). The most common form of regression analysis is [[linear regression]], in which one finds the line (or a more complex [[linear combination]]) that most closely fits the data according to a specific mathematical criterion. For example, the method of [[ordinary least squares]] computes the unique line (or [[hyperplane]]) that minimizes the sum of squared differences between the true data and that line (or hyperplane). For specific mathematical reasons (see [[linear regression]]), this allows the researcher to estimate the [[conditional expectation]] (or population [[average value]]) of the dependent variable when the independent variables take on a given set of values. Less common forms of regression use slightly different procedures to estimate alternative [[location parameters]] (e.g., [[quantile regression]] or [[Necessary Condition Analysis]]<ref>[http://www.erim.eur.nl/centres/necessary-condition-analysis/ Necessary Condition Analysis]</ref>) or estimate the conditional expectation across a broader collection of non-linear models (e.g., [[nonparametric regression]]). Regression analysis is primarily used for two conceptually distinct purposes. First, regression analysis is widely used for [[prediction]] and [[forecasting]], where its use has substantial overlap with the field of [[machine learning]]. Second, in some situations regression analysis can be used to infer [[causality|causal relationships]] between the independent and dependent variables. Importantly, regressions by themselves only reveal relationships between a dependent variable and a collection of independent variables in a fixed dataset. To use regressions for prediction or to infer causal relationships, respectively, a researcher must carefully justify why existing relationships have predictive power for a new context or why a relationship between two variables has a causal interpretation. The latter is especially important when researchers hope to estimate causal relationships using [[observational study|observational data]].<ref name="Freedman2009">{{cite book|author=David A. Freedman|title=Statistical Models: Theory and Practice|url=https://books.google.com/books?id=fW_9BV5Wpf8C&q=%22regression+analysis%22|date=27 April 2009|publisher=Cambridge University Press|isbn=978-1-139-47731-4}}</ref><ref>R. Dennis Cook; Sanford Weisberg [https://www.jstor.org/stable/270724 Criticism and Influence Analysis in Regression], ''Sociological Methodology'', Vol. 13. (1982), pp. 313–361</ref> ==History== The earliest regression form was seen in [[Isaac Newton]]'s work in 1700 while studying [[Equinox|equinoxes]], being credited with introducing "an embryonic linear aggression analysis" as "Not only did he perform the averaging of a set of data, 50 years before [[Tobias Mayer]], but summing the residuals to zero he ''forced'' the regression line to pass through the average point. He also distinguished between two inhomogeneous sets of data and might have thought of an ''optimal'' solution in terms of bias, though not in terms of effectiveness." He previously used an averaging method in his 1671 work on Newton's rings, which was unprecedented at the time.<ref>{{cite arXiv |eprint=0810.4948 |class=physics.hist-ph |first1=Ari |last1=Belenkiy |first2=Eduardo Vila |last2=Echague |title=Groping Toward Linear Regression Analysis: Newton's Analysis of Hipparchus' Equinox Observations |date=2008}}</ref><ref>{{Cite book |last1=Buchwald |first1=Jed Z. |title=Newton and the Origin of Civilization |last2=Feingold |first2=Mordechai |date=2013 |publisher=[[Princeton University Press]] |isbn=978-0-691-15478-7 |location= |pages=90–93, 101–103}}</ref> The [[method of least squares]] was published by [[Adrien-Marie Legendre|Legendre]] in 1805,<ref name="Legendre">[[Adrien-Marie Legendre|A.M. Legendre]]. [https://books.google.com/books?id=FRcOAAAAQAAJ ''Nouvelles méthodes pour la détermination des orbites des comètes''], Firmin Didot, Paris, 1805. "Sur la Méthode des moindres quarrés" appears as an appendix.</ref> and by [[Carl Friedrich Gauss|Gauss]] in 1809.<ref name="Gauss">Chapter 1 of: Angrist, J. D., & Pischke, J. S. (2008). ''Mostly Harmless Econometrics: An Empiricist's Companion''. Princeton University Press.</ref> Legendre and Gauss both applied the method to the problem of determining, from astronomical observations, the orbits of bodies about the Sun (mostly comets, but also later the then newly discovered minor planets<!-- Legendre's first example is applied to [[C/1769 P1]] (Messier) -->). Gauss published a further development of the theory of least squares in 1821,<ref name="Gauss2">{{cite book|author-first1=C.F. |author-last1=Gauss|author-link=Carl Friedrich Gauss|url=https://books.google.com/books?id=ZQ8OAAAAQAAJ&q=Theoria+combinationis+observationum+erroribus+minimis+obnoxiae|title=Theoria combinationis observationum erroribus minimis obnoxiae|year=1821–1823|via=Google Books}}</ref> including a version of the [[Gauss–Markov theorem]]. The term "regression" was coined by [[Francis Galton]] in the 19th century to describe a biological phenomenon. The phenomenon was that the heights of descendants of tall ancestors tend to regress down towards a normal average (a phenomenon also known as [[regression toward the mean]]).<ref> {{cite book | last = Mogull | first = Robert G. | title = Second-Semester Applied Statistics | publisher = Kendall/Hunt Publishing Company | year = 2004 | page = 59 | isbn = 978-0-7575-1181-3 }}</ref><ref>{{cite journal | last=Galton | first=Francis | journal=Statistical Science | year=1989 | title=Kinship and Correlation (reprinted 1989) | volume=4 | jstor=2245330 | pages=80–86 | issue=2 | doi=10.1214/ss/1177012581| doi-access=free }}</ref> For Galton, regression had only this biological meaning,<ref>[[Francis Galton]]. "Typical laws of heredity", Nature 15 (1877), 492–495, 512–514, 532–533. ''(Galton uses the term "reversion" in this paper, which discusses the size of peas.)''</ref><ref>Francis Galton. Presidential address, Section H, Anthropology. (1885) ''(Galton uses the term "regression" in this paper, which discusses the height of humans.)''</ref> but his work was later extended by [[Udny Yule]] and [[Karl Pearson]] to a more general statistical context.<ref>{{cite journal | doi=10.2307/2979746 | last=Yule | first=G. Udny | author-link=G. Udny Yule | title=On the Theory of Correlation | journal=Journal of the Royal Statistical Society | year= 1897 | pages=812–54 | jstor=2979746 | volume=60 | issue=4 | url=https://zenodo.org/record/1449703 }}</ref><ref>{{cite journal | doi=10.1093/biomet/2.2.211 | author-link=Karl Pearson | last=Pearson | first=Karl |author2=Yule, G.U. |author3=Blanchard, Norman |author4= Lee, Alice | title=The Law of Ancestral Heredity | journal=[[Biometrika]] | year=1903 | jstor=2331683 | pages=211–236 | volume=2 | issue=2 | url=https://zenodo.org/record/1431601 }}</ref> In the work of Yule and Pearson, the [[joint distribution]] of the response and explanatory variables is assumed to be [[Normal distribution|Gaussian]]. This assumption was weakened by [[Ronald A. Fisher|R.A. Fisher]] in his works of 1922 and 1925.<ref>{{cite journal | last=Fisher | first=R.A. | title=The goodness of fit of regression formulae, and the distribution of regression coefficients | journal=Journal of the Royal Statistical Society | volume=85 | pages=597–612 | year=1922 | doi=10.2307/2341124 | pmc=1084801 | jstor=2341124 | issue=4 }}</ref><ref name="FisherR1954Statistical">{{Cite book | author = Ronald A. Fisher | title = Statistical Methods for Research Workers | publisher = Oliver and Boyd | location = [[Edinburgh]] | year = 1970 | edition = Twelfth | url = https://archive.org/details/dli.scoerat.2986statisticalmethodsforresearchworkers/page/n7/mode/2up | isbn = 978-0-05-002170-5 | author-link = Ronald A. Fisher | url-access = registration }}</ref><ref>{{cite journal | last=Aldrich | first=John | journal=Statistical Science | year=2005 | title=Fisher and Regression | volume=20 | issue=4 | pages=401–417 | jstor=20061201 | doi=10.1214/088342305000000331| doi-access=free | url=https://eprints.soton.ac.uk/34871/1/088342305000000331.pdf }}</ref> Fisher assumed that the [[conditional distribution]] of the response variable is Gaussian, but the joint distribution need not be. In this respect, Fisher's assumption is closer to Gauss's formulation of 1821. In the 1950s and 1960s, economists used [[Calculator#Precursors to the electronic calculator|electromechanical desk calculators]] to calculate regressions. Before 1970, it sometimes took up to 24 hours to receive the result from one regression.<ref>Rodney Ramcharan. [http://www.imf.org/external/pubs/ft/fandd/2006/03/basics.htm Regressions: Why Are Economists Obessessed with Them?] March 2006. Accessed 2011-12-03.</ref> Regression methods continue to be an area of active research. In recent decades, new methods have been developed for [[robust regression]], regression involving correlated responses such as [[time series]] and [[growth curve (statistics)|growth curve]]s, regression in which the predictor (independent variable) or response variables are curves, images, graphs, or other complex data objects, regression methods accommodating various types of missing data, [[nonparametric regression]], [[Bayesian statistics|Bayesian]] methods for regression, regression in which the predictor variables are measured with error, regression with more predictor variables than observations, and [[causal inference]] with regression. Modern regression analysis is typically done with statistical and [[spreadsheet]] software packages on computers as well as on handheld [[scientific calculator|scientific]] and [[graphing calculator]]s. ==Regression model== In practice, researchers first select a model they would like to estimate and then use their chosen method (e.g., [[ordinary least squares]]) to estimate the parameters of that model. Regression models involve the following components: *The '''unknown parameters''', often denoted as a [[scalar (physics)|scalar]] or [[Euclidean vector|vector]] <math>\beta</math>. *The '''independent variables''', which are observed in data and are often denoted as a vector <math>X_i</math> (where <math>i</math> denotes a row of data). *The '''dependent variable''', which are observed in data and often denoted using the scalar <math>Y_i</math>. *The '''error terms''', which are ''not'' directly observed in data and are often denoted using the scalar <math>e_i</math>. In various [[List of fields of application of statistics|fields of application]], different terminologies are used in place of [[dependent and independent variables]]. Most regression models propose that <math>Y_i</math> is a [[Function (mathematics)|function]] ('''regression function''') of <math>X_i</math> and <math> \beta</math>, with <math>e_i</math> representing an [[Errors and residuals|additive error term]] that may stand in for un-modeled determinants of <math>Y_i</math> or random statistical noise: :<math>Y_i = f (X_i, \beta) + e_i</math> Note that the independent variables <math>X_i</math> are assumed to be free of error. This important assumption is often overlooked, although [[errors-in-variables models]] can be used when the independent variables are assumed to contain errors. The researchers' goal is to estimate the function <math>f(X_i, \beta)</math> that most closely fits the data. To carry out regression analysis, the form of the function <math>f</math> must be specified. Sometimes the form of this function is based on knowledge about the relationship between <math>Y_i</math> and <math>X_i</math> that does not rely on the data. If no such knowledge is available, a flexible or convenient form for <math>f</math> is chosen. For example, a simple univariate regression may propose <math>f(X_i, \beta) = \beta_0 + \beta_1 X_i</math>, suggesting that the researcher believes <math>Y_i = \beta_0 + \beta_1 X_i + e_i</math> to be a reasonable approximation for the statistical process generating the data. Once researchers determine their preferred [[statistical model]], different forms of regression analysis provide tools to estimate the parameters <math>\beta </math>. For example, [[least squares]] (including its most common variant, [[ordinary least squares]]) finds the value of <math>\beta </math> that minimizes the sum of squared errors <math>\sum_i (Y_i - f(X_i, \beta))^2</math>. A given regression method will ultimately provide an estimate of <math>\beta</math>, usually denoted <math>\hat{\beta}</math> to distinguish the estimate from the true (unknown) parameter value that generated the data. Using this estimate, the researcher can then use the ''fitted value'' <math>\hat{Y_i} = f(X_i,\hat{\beta})</math> for prediction or to assess the accuracy of the model in explaining the data. Whether the researcher is intrinsically interested in the estimate <math>\hat{\beta}</math> or the predicted value <math>\hat{Y_i}</math> will depend on context and their goals. As described in [[ordinary least squares]], least squares is widely used because the estimated function <math>f(X_i, \hat{\beta})</math> approximates the [[conditional expectation]] <math>E(Y_i|X_i)</math>.<ref name="Gauss" /> However, alternative variants (e.g., [[least absolute deviations]] or [[quantile regression]]) are useful when researchers want to model other functions <math>f(X_i,\beta)</math>. It is important to note that there must be sufficient data to estimate a regression model. For example, suppose that a researcher has access to <math>N</math> rows of data with one dependent and two independent variables: <math>(Y_i, X_{1i}, X_{2i})</math>. Suppose further that the researcher wants to estimate a bivariate linear model via [[least squares]]: <math>Y_i = \beta_0 + \beta_1 X_{1i} + \beta_2 X_{2i} + e_i</math>. If the researcher only has access to <math>N=2</math> data points, then they could find infinitely many combinations <math>(\hat{\beta}_0, \hat{\beta}_1, \hat{\beta}_2)</math> that explain the data equally well: any combination can be chosen that satisfies <math>\hat{Y}_i = \hat{\beta}_0 + \hat{\beta}_1 X_{1i} + \hat{\beta}_2 X_{2i}</math>, all of which lead to <math>\sum_i \hat{e}_i^2 = \sum_i (\hat{Y}_i - (\hat{\beta}_0 + \hat{\beta}_1 X_{1i} + \hat{\beta}_2 X_{2i}))^2 = 0</math> and are therefore valid solutions that minimize the sum of squared [[Errors and residuals|residuals]]. To understand why there are infinitely many options, note that the system of <math>N=2</math> equations is to be solved for 3 unknowns, which makes the system [[Underdetermined system|underdetermined]]. Alternatively, one can visualize infinitely many 3-dimensional planes that go through <math>N=2</math> fixed points. More generally, to estimate a [[least squares]] model with <math>k</math> distinct parameters, one must have <math>N \geq k</math> distinct data points. If <math>N > k</math>, then there does not generally exist a set of parameters that will perfectly fit the data. The quantity <math>N-k</math> appears often in regression analysis, and is referred to as the [[Degrees of freedom (statistics)|degrees of freedom]] in the model. Moreover, to estimate a least squares model, the independent variables <math>(X_{1i}, X_{2i}, ..., X_{ki})</math> must be [[Linear independence|linearly independent]]: one must ''not'' be able to reconstruct any of the independent variables by adding and multiplying the remaining independent variables. As discussed in [[ordinary least squares]], this condition ensures that <math>X^{T}X</math> is an [[invertible matrix]] and therefore that a unique solution <math>\hat{\beta}</math> exists. ==Underlying assumptions== {{more citations needed section|date=December 2020}} By itself, a regression is simply a calculation using the data. In order to interpret the output of regression as a meaningful statistical quantity that measures real-world relationships, researchers often rely on a number of classical [[statistical assumption|assumptions]]. These assumptions often include: *The sample is representative of the population at large. *The independent variables are measured without error. *Deviations from the model have an expected value of zero, conditional on covariates: <math>E(e_i | X_i) = 0</math> *The variance of the residuals <math>e_i</math> is constant across observations ([[homoscedasticity]]). * The residuals <math>e_i</math> are [[uncorrelated]] with one another. Mathematically, the [[Covariance matrix|variance–covariance matrix]] of the errors is [[Diagonal matrix|diagonal]]. A handful of conditions are sufficient for the least-squares estimator to possess desirable properties: in particular, the [[Gauss–Markov theorem|Gauss–Markov]] assumptions imply that the parameter estimates will be [[bias of an estimator|unbiased]], [[consistent estimator|consistent]], and [[efficient (statistics)|efficient]] in the class of linear unbiased estimators. Practitioners have developed a variety of methods to maintain some or all of these desirable properties in real-world settings, because these classical assumptions are unlikely to hold exactly. For example, modeling [[errors-in-variables model|errors-in-variables]] can lead to reasonable estimates independent variables are measured with errors. [[Heteroscedasticity-consistent standard errors]] allow the variance of <math>e_i</math> to change across values of <math>X_i</math>. Correlated errors that exist within subsets of the data or follow specific patterns can be handled using ''clustered standard errors, geographic weighted regression'', or [[Newey–West estimator|Newey–West]] standard errors, among other techniques. When rows of data correspond to locations in space, the choice of how to model <math>e_i</math> within geographic units can have important consequences.<ref>{{cite book|title=Geographically weighted regression: the analysis of spatially varying relationships|last1=Fotheringham|first1=A. Stewart|last2=Brunsdon|first2=Chris|last3=Charlton|first3=Martin|publisher=John Wiley|year=2002|isbn=978-0-471-49616-8|edition=Reprint|location=Chichester, England}}</ref><ref>{{cite journal|last=Fotheringham|first=AS|author2=Wong, DWS|date=1 January 1991|title=The modifiable areal unit problem in multivariate statistical analysis|journal=Environment and Planning A|volume=23|issue=7|pages=1025–1044|doi=10.1068/a231025|bibcode=1991EnPlA..23.1025F |s2cid=153979055}}</ref> The subfield of [[econometrics]] is largely focused on developing techniques that allow researchers to make reasonable real-world conclusions in real-world settings, where classical assumptions do not hold exactly. ==Linear regression== {{Main|Linear regression}} {{Hatnote|See [[simple linear regression]] for a derivation of these formulas and a numerical example}} In linear regression, the model specification is that the dependent variable, <math> y_i </math> is a [[linear combination]] of the ''parameters'' (but need not be linear in the ''independent variables''). For example, in [[simple linear regression]] for modeling <math> n </math> data points there is one independent variable: <math> x_i </math>, and two parameters, <math>\beta_0</math> and <math>\beta_1</math>: :straight line: <math>y_i=\beta_0 +\beta_1 x_i +\varepsilon_i,\quad i=1,\dots,n.\!</math> In multiple linear regression, there are several independent variables or functions of independent variables. Adding a term in <math>x_i^2</math> to the preceding regression gives: :parabola: <math>y_i=\beta_0 +\beta_1 x_i +\beta_2 x_i^2+\varepsilon_i,\ i=1,\dots,n.\!</math> This is still linear regression; although the expression on the right hand side is quadratic in the independent variable <math>x_i</math>, it is linear in the parameters <math>\beta_0</math>, <math>\beta_1</math> and <math>\beta_2.</math> In both cases, <math>\varepsilon_i</math> is an error term and the subscript <math>i</math> indexes a particular observation. Returning our attention to the straight line case: Given a random sample from the population, we estimate the population parameters and obtain the sample linear regression model: : <math> \widehat{y}_i = \widehat{\beta}_0 + \widehat{\beta}_1 x_i. </math> The [[errors and residuals in statistics|residual]], <math> e_i = y_i - \widehat{y}_i </math>, is the difference between the value of the dependent variable predicted by the model, <math> \widehat{y}_i</math>, and the true value of the dependent variable, <math>y_i</math>. One method of estimation is [[ordinary least squares]]. This method obtains parameter estimates that minimize the sum of squared [[errors and residuals in statistics|residuals]], [[Residual sum of squares|SSR]]: :<math>SSR=\sum_{i=1}^n e_i^2</math> Minimization of this function results in a set of [[Linear least squares (mathematics)|normal equations]], a set of simultaneous linear equations in the parameters, which are solved to yield the parameter estimators, <math>\widehat{\beta}_0, \widehat{\beta}_1</math>. [[Image:Linear regression.svg|thumb|upright=1.3|Illustration of linear regression on a data set]] In the case of simple regression, the formulas for the least squares estimates are :<math>\widehat{\beta}_1=\frac{\sum(x_i-\bar{x})(y_i-\bar{y})}{\sum(x_i-\bar{x})^2}</math> :<math>\widehat{\beta}_0=\bar{y}-\widehat{\beta}_1\bar{x}</math> where <math>\bar{x}</math> is the [[Arithmetic mean|mean]] (average) of the <math>x</math> values and <math>\bar{y}</math> is the mean of the <math>y</math> values. Under the assumption that the population error term has a constant variance, the estimate of that variance is given by: : <math> \hat{\sigma}^2_\varepsilon = \frac{SSR}{n-2}</math> This is called the [[mean square error]] (MSE) of the regression. The denominator is the sample size reduced by the number of model parameters estimated from the same data, <math>(n-p)</math> for <math>p</math> [[regressor]]s or <math>(n-p-1)</math> if an intercept is used.<ref>Steel, R.G.D, and Torrie, J. H., ''Principles and Procedures of Statistics with Special Reference to the Biological Sciences.'', [[McGraw Hill]], 1960, page 288.</ref> In this case, <math>p=1</math> so the denominator is <math>n-2</math>. The [[standard error (statistics)|standard error]]s of the parameter estimates are given by :<math>\hat\sigma_{\beta_1}=\hat\sigma_{\varepsilon} \sqrt{\frac{1}{\sum(x_i-\bar x)^2}}</math> :<math>\hat\sigma_{\beta_0}=\hat\sigma_\varepsilon \sqrt{\frac{1}{n} + \frac{\bar{x}^2}{\sum(x_i-\bar x)^2}}=\hat\sigma_{\beta_1} \sqrt{\frac{\sum x_i^2}{n}}. </math> Under the further assumption that the population error term is normally distributed, the researcher can use these estimated standard errors to create [[confidence interval]]s and conduct [[hypothesis test]]s about the [[population parameter]]s. ===General linear model=== {{Hatnote|For a derivation, see [[linear least squares]]}} {{Hatnote|For a numerical example, see [[linear regression]]}} In the more general multiple regression model, there are <math>p</math> independent variables: : <math> y_i = \beta_1 x_{i1} + \beta_2 x_{i2} + \cdots + \beta_p x_{ip} + \varepsilon_i, \, </math> where <math>x_{ij}</math> is the <math>i</math>-th observation on the <math>j</math>-th independent variable. If the first independent variable takes the value 1 for all <math>i</math>, <math>x_{i1} = 1</math>, then <math>\beta_1</math> is called the [[regression intercept]]. The least squares parameter estimates are obtained from <math>p</math> normal equations. The residual can be written as :<math>\varepsilon_i=y_i - \hat\beta_1 x_{i1} - \cdots - \hat\beta_p x_{ip}.</math> The '''normal equations''' are :<math>\sum_{i=1}^n \sum_{k=1}^p x_{ij}x_{ik}\hat \beta_k=\sum_{i=1}^n x_{ij}y_i,\ j=1,\dots,p.\,</math> In matrix notation, the normal equations are written as :<math>\mathbf{(X^\top X )\hat{\boldsymbol{\beta}}= {}X^\top Y},\,</math> where the <math>ij</math> element of <math>\mathbf X</math> is <math>x_{ij}</math>, the <math>i</math> element of the column vector <math>Y</math> is <math>y_i</math>, and the <math>j</math> element of <math>\hat \boldsymbol \beta</math> is <math>\hat \beta_j</math>. Thus <math>\mathbf X</math> is <math>n \times p</math>, <math>Y</math> is <math>n \times 1</math>, and <math>\hat \boldsymbol \beta</math> is <math>p \times 1</math>. The solution is :<math>\mathbf{\hat{\boldsymbol{\beta}}= (X^\top X )^{-1}X^\top Y}.\,</math> ===Diagnostics=== {{main|Regression diagnostics}} {{Category see also|Regression diagnostics}} Once a regression model has been constructed, it may be important to confirm the [[goodness of fit]] of the model and the [[statistical significance]] of the estimated parameters. Commonly used checks of goodness of fit include the [[R-squared]], analyses of the pattern of [[errors and residuals in statistics|residuals]] and hypothesis testing. Statistical significance can be checked by an [[F-test]] of the overall fit, followed by [[t-test]]s of individual parameters. Interpretations of these diagnostic tests rest heavily on the model's assumptions. Although examination of the residuals can be used to invalidate a model, the results of a [[t-test]] or [[F-test]] are sometimes more difficult to interpret if the model's assumptions are violated. For example, if the error term does not have a normal distribution, in small samples the estimated parameters will not follow normal distributions and complicate inference. With relatively large samples, however, a [[central limit theorem]] can be invoked such that hypothesis testing may proceed using asymptotic approximations. ===Limited dependent variables=== [[Limited dependent variable]]s, which are response variables that are [[categorical variable|categorical]] or constrained to fall only in a certain range, often arise in [[econometrics]]. The response variable may be non-continuous ("limited" to lie on some subset of the real line). For binary (zero or one) variables, if analysis proceeds with least-squares linear regression, the model is called the [[linear probability model]]. Nonlinear models for binary dependent variables include the [[probit model|probit]] and [[logistic regression|logit model]]. The [[multivariate probit]] model is a standard method of estimating a joint relationship between several binary dependent variables and some independent variables. For [[categorical variable]]s with more than two values there is the [[multinomial logit]]. For [[ordinal variable]]s with more than two values, there are the [[ordered logit]] and [[ordered probit]] models. [[Censored regression model]]s may be used when the dependent variable is only sometimes observed, and [[Heckman correction]] type models may be used when the sample is not randomly selected from the population of interest. An alternative to such procedures is linear regression based on [[polychoric correlation]] (or polyserial correlations) between the categorical variables. Such procedures differ in the assumptions made about the distribution of the variables in the population. If the variable is positive with low values and represents the repetition of the occurrence of an event, then count models like the [[Poisson regression]] or the [[negative binomial]] model may be used. ==Nonlinear regression== {{Main|Nonlinear regression}} When the model function is not linear in the parameters, the sum of squares must be minimized by an iterative procedure. This introduces many complications which are summarized in [[least squares#Differences between linear and nonlinear least squares|Differences between linear and non-linear least squares]]. ==Prediction (interpolation and extrapolation) {{anchor|Prediction|Interpolation|Extrapolation|Interpolation and extrapolation}}== {{further|Predicted response|Prediction interval}} [[File:CurveWeightHeight.png|thumb|upright=1.5|In the middle, the fitted straight line represents the best balance between the points above and below this line. The dotted straight lines represent the two extreme lines, considering only the variation in the slope. The inner curves represent the estimated range of values considering the variation in both slope and intercept. The outer curves represent a prediction for a new measurement.<ref>{{cite book |last=Rouaud |first=Mathieu |title=Probability, Statistics and Estimation|year=2013 |page=60 |url=http://www.incertitudes.fr/book.pdf }}</ref>]] Regression models '''''predict''''' a value of the ''Y'' variable given known values of the ''X'' variables. Prediction {{em|within}} the range of values in the dataset used for model-fitting is known informally as ''[[interpolation]]''. Prediction {{em|outside}} this range of the data is known as ''[[extrapolation]]''. Performing extrapolation relies strongly on the regression assumptions. The further the extrapolation goes outside the data, the more room there is for the model to fail due to differences between the assumptions and the sample data or the true values. A ''[[prediction interval]]'' that represents the uncertainty may accompany the point prediction. Such intervals tend to expand rapidly as the values of the independent variable(s) moved outside the range covered by the observed data. For such reasons and others, some tend to say that it might be unwise to undertake extrapolation.<ref>Chiang, C.L, (2003) ''Statistical methods of analysis'', World Scientific. {{isbn|981-238-310-7}} - [https://books.google.com/books?id=BuPNIbaN5v4C&dq=regression+extrapolation&pg=PA274 page 274 section 9.7.4 "interpolation vs extrapolation"]</ref> ===Model selection=== {{Further|Model selection}} The assumption of a particular form for the relation between ''Y'' and ''X'' is another source of uncertainty. A properly conducted regression analysis will include an assessment of how well the assumed form is matched by the observed data, but it can only do so within the range of values of the independent variables actually available. This means that any extrapolation is particularly reliant on the assumptions being made about the structural form of the regression relationship. If this knowledge includes the fact that the dependent variable cannot go outside a certain range of values, this can be made use of in selecting the model – even if the observed dataset has no values particularly near such bounds. The implications of this step of choosing an appropriate functional form for the regression can be great when extrapolation is considered. At a minimum, it can ensure that any extrapolation arising from a fitted model is "realistic" (or in accord with what is known). ==Power and sample size calculations== There are no generally agreed methods for relating the number of observations versus the number of independent variables in the model. One method conjectured by Good and Hardin is <math>N=m^n</math>, where <math>N</math> is the sample size, <math>n</math> is the number of independent variables and <math>m</math> is the number of observations needed to reach the desired precision if the model had only one independent variable.<ref>{{cite book |last1=Good |first1=P. I. |author1-link=Phillip Good|last2=Hardin |first2=J. W. |title=Common Errors in Statistics (And How to Avoid Them)|publisher=Wiley|edition=3rd|location=Hoboken, New Jersey|year=2009|page=211|isbn=978-0-470-45798-6}}</ref> For example, a researcher is building a linear regression model using a dataset that contains 1000 patients (<math>N</math>). If the researcher decides that five observations are needed to precisely define a straight line (<math>m</math>), then the maximum number of independent variables (<math>n</math>) the model can support is 4, because : <math>\frac{\log 1000}{\log5}\approx4.29 </math>. ==Other methods== Although the parameters of a regression model are usually estimated using the method of least squares, other methods which have been used include: * [[Bayesian method]]s, e.g. [[Bayesian linear regression]] * Percentage regression, for situations where reducing ''percentage'' errors is deemed more appropriate.<ref>{{cite journal| ssrn=1406472 |title=Least Squares Percentage Regression |last=Tofallis |first=C. |journal=Journal of Modern Applied Statistical Methods |volume=7 |year=2009 |pages=526–534| doi=10.2139/ssrn.1406472|url=https://digitalcommons.wayne.edu/cgi/viewcontent.cgi?article=1466&context=jmasm |hdl=2299/965 |hdl-access=free }}</ref> * [[Least absolute deviations]], which is more robust in the presence of outliers, leading to [[quantile regression]] * [[Nonparametric regression]], requires a large number of observations and is computationally intensive * [[Scenario optimization]], leading to [[interval predictor model]]s == Software == {{Main list|List of statistical software}} All major statistical software packages perform [[least squares]] regression analysis and inference. [[Simple linear regression]] and multiple regression using least squares can be done in some [[spreadsheet]] applications and on some calculators. While many statistical software packages can perform various types of nonparametric and robust regression, these methods are less standardized. Different software packages implement different methods, and a method with a given name may be implemented differently in different packages. Specialized regression software has been developed for use in fields such as survey analysis and neuroimaging. == See also == {{Portal|Mathematics}} {{Div col}} * [[Anscombe's quartet]] * [[Curve fitting]] * [[Estimation theory]] * [[Forecasting]] * [[Fraction of variance unexplained]] * [[Function approximation]] * [[Generalized linear model]] * [[Kriging]] (a linear least squares estimation algorithm) * [[Local regression]] * [[Modifiable areal unit problem]] * [[Multivariate adaptive regression spline]] * [[Multivariate normal distribution]] * [[Pearson correlation coefficient]] * [[Quasi-variance]] * [[Prediction interval]] * [[Regression validation]] * [[Robust regression]] * [[Segmented regression]] * [[Signal processing]] * [[Stepwise regression]] * [[Taxicab geometry]] * [[Linear trend estimation]] {{Div col end}} == References == {{Reflist}} ==Further reading== * [[William Kruskal|William H. Kruskal]] and [[Judith Tanur|Judith M. Tanur]], ed. (1978), "Linear Hypotheses," ''International Encyclopedia of Statistics''. Free Press, v. 1, :Evan J. Williams, "I. Regression," pp. 523–41. :[[Julian C. Stanley]], "II. Analysis of Variance," pp. 541–554. * [[D.V. Lindley|Lindley, D.V.]] (1987). "Regression and correlation analysis," [[New Palgrave: A Dictionary of Economics]], v. 4, pp. 120–23. * Birkes, David and [[Yadolah Dodge|Dodge, Y.]], ''Alternative Methods of Regression''. {{isbn|0-471-56881-3}} * Chatfield, C. (1993) "[https://amstat.tandfonline.com/doi/abs/10.1080/07350015.1993.10509938 Calculating Interval Forecasts]," ''Journal of Business and Economic Statistics,'' '''11'''. pp. 121–135. * {{cite book |title = Applied Regression Analysis |edition = 3rd |last1= Draper |first1=N.R. |last2=Smith |first2=H. |publisher = John Wiley |year = 1998 |isbn = 978-0-471-17082-2}} * Fox, J. (1997). ''Applied Regression Analysis, Linear Models and Related Methods.'' Sage * Hardle, W., ''Applied Nonparametric Regression'' (1990), {{isbn|0-521-42950-1}} * {{cite journal|doi=10.1002/for.3980140502|title=Prediction intervals for growth curve forecasts|journal=Journal of Forecasting|volume=14|issue=5|pages=413–430|year=1995|last1=Meade|first1=Nigel|last2=Islam|first2=Towhidul}} * A. Sen, M. Srivastava, ''Regression Analysis — Theory, Methods, and Applications'', Springer-Verlag, Berlin, 2011 (4th printing). * T. Strutz: ''Data Fitting and Uncertainty (A practical introduction to weighted least squares and beyond)''. Vieweg+Teubner, {{isbn|978-3-8348-1022-9}}. * Stulp, Freek, and Olivier Sigaud. ''Many Regression Algorithms, One Unified Model: A Review.'' Neural Networks, vol. 69, Sept. 2015, pp. 60–79. https://doi.org/10.1016/j.neunet.2015.05.005. * Malakooti, B. (2013). [https://books.google.com/books?id=tvc8AgAAQBAJ&q=%22regression+analysis%22 Operations and Production Systems with Multiple Objectives]. John Wiley & Sons. * {{cite journal | doi=10.7717/peerj-cs.623| title= The coefficient of determination R-squared is more informative than SMAPE, MAE, MAPE, MSE and RMSE in regression analysis evaluation| year=2021 | last1= Chicco | first1=Davide | last2= Warrens | first2=Matthijs J. | first3=Giuseppe| last3=Jurman| journal= PeerJ Computer Science | volume=7 | issue=e623 | pages=e623| pmid= 34307865| pmc= 8279135| doi-access = free}} ==External links== {{Commons category|Regression analysis}} * {{springer|title=Regression analysis|id=p/r080620}} * [http://jeff560.tripod.com/r.html Earliest Uses: Regression] – basic history and references * [https://spss-tutor.com/multiple-regressions.php What is multiple regression used for?] – Multiple regression * [http://www.vias.org/simulations/simusoft_regrot.html Regression of Weakly Correlated Data] – how linear regression mistakes can appear when Y-range is much smaller than X-range {{Artificial intelligence navbox}} {{least squares and regression analysis}} {{Statistics|correlation|state=collapsed}} {{Quantitative forecasting methods}} {{Public health}} {{Authority control}} {{DEFAULTSORT:Regression Analysis}} [[Category:Regression analysis| ]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Anchor
(
edit
)
Template:Artificial intelligence navbox
(
edit
)
Template:Authority control
(
edit
)
Template:Category see also
(
edit
)
Template:Cite arXiv
(
edit
)
Template:Cite book
(
edit
)
Template:Cite journal
(
edit
)
Template:Commons category
(
edit
)
Template:Div col
(
edit
)
Template:Div col end
(
edit
)
Template:Em
(
edit
)
Template:Further
(
edit
)
Template:Hatnote
(
edit
)
Template:Isbn
(
edit
)
Template:Least squares and regression analysis
(
edit
)
Template:Machine learning
(
edit
)
Template:Main
(
edit
)
Template:Main list
(
edit
)
Template:More citations needed section
(
edit
)
Template:Portal
(
edit
)
Template:Public health
(
edit
)
Template:Quantitative forecasting methods
(
edit
)
Template:Reflist
(
edit
)
Template:Regression bar
(
edit
)
Template:Short description
(
edit
)
Template:Springer
(
edit
)
Template:Statistics
(
edit
)