Mathematical background of statsmodels wls_prediction_std

非 Y 不嫁゛ 提交于 2019-12-05 13:00:12

There should be a variation on this in any textbook, without the weights.

For OLS, Greene (5th edition, which I used) has

se = s^2 (1 + x (X'X)^{-1} x')

where s^2 is the estimate of the residual variance, x is vector or explanatory variables for which we want to predict and X are the explanatory variables used in the estimation.

This is the standard error for an observation, the second part alone is the standard error for the predicted mean y_predicted = x beta_estimated.

wls_prediction_std uses the variance of the parameter estimate directly.

Assuming x is fixed, then y_predicted is just a linear transformation of the random variable beta_estimated, so the variance of y_predicted is just

x Cov(beta_estimated) x'

To this we still need to add the estimate of the error variance.

As far as I remember, there are estimates that have better small sample properties.

I added the weights, but never managed to verify them, so the function has remained in the sandbox for years. (Stata doesn't return prediction errors with weights.)

Aside:

Using the covariance of the parameter estimate should also be correct if we use a sandwich robust covariance estimator, while Greene's formula above is only correct if we don't have any misspecified heteroscedasticity.

What wls_prediction_std doesn't take into account is that, if we have a model for the heteroscedasticity, then the error variance could also depend on the explanatory variables, i.e. on x.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!