При множественной линейной регрессии я могу понять, что корреляции между остатком и предикторами равны нулю, но какова ожидаемая корреляция между остатком и переменной критерия? Должно ли оно быть нулевым или сильно коррелированным? Что это значит?
regression
residuals
Jfly
источник
источник
Ответы:
В регрессионной модели:
обычное предположение о том , что(yi,xi,ui) , i=1,...,n представляет собой образец IID. При допущениях, что Exiui=0 и E(xix′i) имеет полный ранг, обыкновенная оценка наименьших квадратов:
является последовательным и асимптотически нормальным. Ожидаемая ковариация между невязкой и переменной отклика тогда равна:
Если мы , кроме того , предположим , что и Е ( U 2 я | х 1 , . . . , Х п ) = σ 2 , можно вычислить ожидаемую ковариации между у я и его регрессия остаточного:Е( тыя| Икс1, . , , , хN) = 0 Е( ты2я| Икс1, . , , , хN) = σ2 Yя
Теперь , чтобы получить корреляцию , мы должны вычислить и Var ( у я ) . Оказывается, чтоVar(yi) Var(u^i)
следовательно
Now the termx′i(∑nj=1xjx′j)−1xi comes from diagonal of the hat matrix H=X(X′X)−1X′ , where X=[xi,...,xN]′ . The matrix H is idempotent, hence it satisfies a following property
wherehii is the diagonal term of H . The rank(H) is the number of linearly independent variables in xi , which is usually the number of variables. Let us call it p . The number of hii is the sample size N . So we have N nonnegative terms which should sum up to p . Usually N is much bigger than p , hence a lot of hii would be close to the zero, meaning that the correlation between the residual and the response variable would be close to 1 for the bigger part of observations.
The termhii is also used in various regression diagnostics for determining influential observations.
источник
The correlation depends on theR2 . If R2 is high, it means that much of variation in your dependent variable can be attributed to variation in your independent variables, and NOT your error term.
However, ifR2 is low, then it means that much of the variation in your dependent variable is unrelated to variation in your independent variables, and thus must be related to the error term.
Consider the following model:
Assuming sufficient regularity conditions for the CLT to hold.
Holding all else fixed, increasing theR2 will decrease the correlation between the error an the dependent. A strong correlation is not necessarily cause for alarm. This may simply means the underlying process is noisy. However, a low R2 (and hence high correlation between error and dependent) may be due to model misspecification.
источник
I find this topic quite interesting and current answers are unfortunately incomplete or partly misleading - despite the relevance and high popularity of this question.
By definition of classical OLS framework there should be no relationship betweenŷ and u^ , since the residuals obtained are per construction uncorrelated with ŷ when deriving the OLS estimator. The variance minimizing property under homoskedasticity ensures that the residual error are randomly spread around the fitted values. This can be formally shown by:
WhereM and P are idempotent matrices defined as: P=X(X′X)X′ and M=I−P .
This result is based on strict exogeneity and homoskedasticity, and practically holds in large samples. The intuition for their uncorrelatedness is the following: The fitted valuesŷ conditional on X are centered around û , which are thought as independently and identically distributed. However, any deviation from the strict exogeneity and homoskedasticity assumption could cause the explanatory variables to be endogenous and spur a latent correlation between û and ŷ .
Now the correlation between the residualsû and the "original" y is a completely different story:
Some checking in the theory and we know that this covariance matrix is identical to the covariance matrix of the residualu^ itself (proof omitted). We have:
If we would like to calculate the (scalar) covariance betweeny and u^ as requested by the OP, we obtain:
(= by summing up of the diagonal entries of the covariance matrix and divide by N)
The above formula indicates an interesting point. If we test the relationship by regressingy on the residuals u^ (+constant), the slope coefficient βu^,y=1 , which can be easily derived when we divide the above expression by the Var(û |X) .
On the other hand, the correlation is the standardized covariance by the respective standard deviations. Now, the variance matrix of the residuals isσ2M , while the variance of y is σ2I . The correlation Corr(y,û ) becomes therefore:
This is the core result which ought to hold in a linear regression. The intuition is that theCorr(y,û ) expresses the error between the true variance of the error term and a proxy for the variance based on residuals. Notice that the variance of y is equal to the variance of y^ plus the variance of the residuals u^ . So it can be more intuitively rewritten as:
The are two forces here at work. If we have a great fit of the regression line, the correlation is expected to be low due toVar(û )≈0 . On the other hand, Var(y^) is a bit of a fudge to esteem as it is unconditional and a line in parameter space. Comparing an unconditional and conditional variances within a ratio may not be an appropriate indicator after all. Perhaps, that's why it rarely done in practice.
An attempt conclude the question: The correlation betweeny and û is positive and relates to the ratio of the variance of the residuals and the variance of the true error term, proxied by the unconditional variance in y . Hence, it is a bit of a misleading indicator.
Notwithstanding this exercise may give us some intuition on the workings and inherent theoretical assumptions of an OLS regression, we rarely evaluate the correlation betweeny and û . There are certainly more established tests for checking properties of the true error term. Secondly, keep in mind that the residuals are not the error term, and tests on residuals û that make predictions of the characteristics on the true error term u are limited and their validity need to be handled with utmost care.
For example, I would like to point out a statement made by a previous poster here. It is said that,
I think that may not be entirely valid in this context. Believe it or not, but the OLS residualsû are by construction made to be uncorrelated with the independent variable xk . To see this, consider:
However, you may have heard claims that an explanatory variable is correlated with the error term. Notice that such claims are based on assumptions about the whole population with a true underlying regression model, that we do not observe first hand. Consequently, checking the correlation betweeny and û seems pointless in a linear OLS framework. However, when testing for heteroskedasticity, we take here into account the second conditional moment, for example, we regress the squared residuals on X or a function of X , as it is often the case with FGSL estimators. This is different from evaluating the plain correlation. I hope this helps to make matters more clear.
источник
The Adam's answer is wrong. Even with a model that fits data perfectly, you can still get high correlation between residuals and dependent variable. That's the reason no regression book asks you to check this correlation. You can find the answer on Dr. Draper's "Applied Regression Analysis" book.
источник
So, the residuals are your unexplained variance, the difference between your model's predictions and the actual outcome you're modeling. In practice, few models produced through linear regression will have all residuals close to zero unless linear regression is being used to analyze a mechanical or fixed process.
Ideally, the residuals from your model should be random, meaning they should not be correlated with either your independent or dependent variables (what you term the criterion variable). In linear regression, your error term is normally distributed, so your residuals should also be normally distributed as well. If you have significant outliers, or If your residuals are correlated with either your dependent variable or your independent variables, then you have a problem with your model.
If you have significant outliers and non-normal distribution of your residuals, then the outliers may be skewing your weights (Betas), and I would suggest calculating DFBETAS to check the influence of your observations on your weights. If your residuals are correlated with your dependent variable, then there is a significantly large amount of unexplained variance that you are not accounting for. You may also see this if you're analyzing repeated observations of the same thing, due to autocorrelation. This can be checked for by seeing if your residuals are correlated with your time or index variable. If your residuals are correlated with your independent variables, then your model is heteroskedastic (see: http://en.wikipedia.org/wiki/Heteroscedasticity). You should check (if you haven't already) if your input variables are normally distributed, and if not, then you should consider scaling or transforming your data (the most common kinds are log and square-root) in order to make it more normalized.
In the case of both, your residuals, and your independent variables, you should take a QQ-Plot, as well as perform a Kolmogorov-Smirnov test (this particular implementation is sometimes referred to as the Lilliefors test) to make sure that your values fit a normal distribution.
Three things that are quick and may be helpful in dealing with this problem, are examining the median of your residuals, it should be as close to zero as possible (the mean will almost always be zero as a result of how the error term is fitted in linear regression), a Durbin-Watson test for autocorrelation in your residuals (especially as I mentioned before, if you are looking at multiple observations of the same things), and performing a partial residual plot will help you look for heteroscedasticity and outliers.
источник