Você está confundindo dois tipos de termo "erro". A Wikipedia, na verdade, tem um artigo dedicado a essa distinção entre erros e resíduos .
Em uma regressão OLS, os resíduos (as estimativas do termo de erro ou estão de fato garantidos para ser não correlacionadas com as variáveis de previsão, assumindo a regressão contém um termo de intercepto.ε^
Mas os erros "verdadeiros" podem muito bem estar correlacionados com eles, e é isso que conta como endogeneidade.ε
Para simplificar, considere o modelo de regressão (você pode ver isso descrito como o " processo de geração de dados " ou "DGP" subjacente , o modelo teórico que assumimos para gerar o valor de ):y
yi=β1+β2xi+εi
Não há razão, em princípio, por que não possa ser correlacionado com ε em nosso modelo, por mais que preferimos não violar as premissas OLS padrão dessa maneira. Por exemplo, pode ser que y dependa de outra variável omitida do nosso modelo, e isso tenha sido incorporado ao termo de perturbação (o ε é onde agrupamos todas as outras coisas além de x que afetam y ). Se essa variável omitida também estiver correlacionada com x , então ε será correlacionado com x e teremos endogeneidade (em particular, viés da variável omitida ).xεyεxyxεx
Quando você estima seu modelo de regressão com os dados disponíveis, obtemos
yi=β^1+β^2xi+ε^i
Devido à forma como MQO obras *, os resíduos ε será uncorrelated com x . Mas isso não significa que nós temos endogeneidade evitado - Significa apenas que nós não podemos detectá-lo através da análise da correlação entre ε e x , que será (até erro numérico) zero. E como as suposições do OLS foram violadas, não temos mais garantia de boas propriedades, como imparcialidade, gostamos muito do OLS. A nossa estimativa β 2 vai ser tendencioso.ε^xε^xβ^2
O fato de que ε não está correlacionada com x segue imediatamente a partir das "equações normais" que usamos para escolher nossas melhores estimativas para os coeficientes.(∗)ε^x
Se você não está acostumado à configuração da matriz, e eu continuo com o modelo bivariado usado no meu exemplo acima, a soma dos resíduos quadráticos é e para encontrar a melhor b 1 = β 1 e b 2 =S(b1,b2)=∑ni=1ε2i=∑ni=1(yi−b1−b2xi)2b1=β^1b2=β^2 that minimise this we find the normal equations, firstly the first-order condition for the estimated intercept:
∂S∂b1=∑i=1n−2(yi−b1−b2xi)=−2∑i=1nε^i=0
which shows that the sum (and hence mean) of the residuals is zero, so the formula for the covariance between ε^ and any variable x then reduces to 1n−1∑ni=1xiε^i. We see this is zero by considering the first-order condition for the estimated slope, which is that
∂S∂b2=∑i=1n−2xi(yi−b1−b2xi)=−2∑i=1nxiε^i=0
If you are used to working with matrices, we can generalise this to multiple regression by defining S(b)=ε′ε=(y−Xb)′(y−Xb); the first-order condition to minimise S(b) at optimal b=β^ is:
dSdb(β^)=ddb(y′y−b′X′y−y′Xb+b′X′Xb)∣∣∣b=β^=−2X′y+2X′Xβ^=−2X′(y−Xβ^)=−2X′ε^=0
This implies each row of X′, and hence each column of X, is orthogonal to ε^. Then if the design matrix X has a column of ones (which happens if your model has an intercept term), we must have ∑ni=1ε^i=0 so the residuals have zero sum and zero mean. The covariance between ε^ and any variable x is again 1n−1∑ni=1xiε^i and for any variable x included in our model we know this sum is zero, because ε^ is orthogonal to every column of the design matrix. Hence there is zero covariance, and zero correlation, between ε^ and any predictor variable x.
If you prefer a more geometric view of things, our desire that y^ lies as close as possible to y in a Pythagorean kind of way, and the fact that y^ is constrained to the column space of the design matrix X, dictate that y^ should be the orthogonal projection of the observed y onto that column space. Hence the vector of residuals ε^=y−y^ is orthogonal to every column of X, including the vector of ones 1n if an intercept term is included in the model. As before, this implies the sum of residuals is zero, whence the residual vector's orthogonality with the other columns of X ensures it is uncorrelated with each of those predictors.

But nothing we have done here says anything about the true errors ε. Assuming there is an intercept term in our model, the residuals ε^ are only uncorrelated with x as a mathematical consequence of the manner in which we chose to estimate regression coefficients β^. The way we selected our β^ affects our predicted values y^ and hence our residuals ε^=y−y^. If we choose β^ by OLS, we must solve the normal equations and these enforce that our estimated residuals ε^ are uncorrelated with x. Our choice of β^ affects y^ but not E(y) and hence imposes no conditions on the true errors ε=y−E(y). It would be a mistake to think that ε^ has somehow "inherited" its uncorrelatedness with x from the OLS assumption that ε should be uncorrelated with x. The uncorrelatedness arises from the normal equations.