1
$\begingroup$

I am using WLS in statsmodels to perform weighted least squares. The weights parameter is set to 1/Variance of my observations

When using wls_prediction_std as e.g. here I can include the weights as used with WLS, and this affects the prediction intervals at the in-sample data points. However, if I am using out-of-sample prediction, I do not have variance / weights for my exogenous variables as they are not observations. I can use arbitrary weights, but again the value used affects the prediction intervals.

My question is therefore: is there a robust or rule-of-thumb method to set the weights for out-of-sample prediction using WLS?

I am not wedded to either statsmodels or wls_prediction_std by any means, but any (pointers towards) solutions using Python (libraries) would be preferred.

$\endgroup$

1 Answer 1

2
$\begingroup$

The weights in WLS are used to efficiently estimate the model parameters (i.e. to efficiently fit or train the model). Weights are generally not used when making predictions based on the fitted model, at least not for making point predictions.

If the weights are 1/variance, and "variance" here refers to the variance of a heteroscedastic error process, then you are correct that the prediction interval's width (but not the point that it is centered around) would depend on the variance of the error process.

If you want to incorporate heteroscedastic residual errors into your prediction analysis, then you would need to have independent knowledge of the error variance at each point where you want to make a prediction.

If your "test points", where you want to make predictions, are well represented by your training points, you might be able to smooth out the observed variance values at the training points to produce an estimate of the variance values at your test points.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.