You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ENH: diagnostics for WLS, and WLS version of GLM #3743
(while looking at Stata's linktest #1479 documentation and our diagnostics)
two issues
weights in regression diagnostic auxiliary regression
I guess the OLS based auxiliary regression are consistent but not efficient if we have weights
variable addition or score tests would use the weights from WLS in the score equations
GLM has the WLS of the final step of the irls
I think it should work to use resid_working and weights to reconstruct a WLS that corresponds to the final local approximation, and we can use WLS based tests for diagnostics, variable addition, link/nonlinearity test
this would be different (?) but asymptotically equivalent to using conditional moment and score tests directly, or tests using resid_pearson.
to the second main point above:
PR #4021 adds the undocumented fit option attach_wls to attach the final WLS results to the GLMResults instance
If reusing it works well, then we can add it a general option and make it available also with fit_gradient, or as a lazy cached attribute.
specific to WLS:
It looks to me like het_breuschpagan can be applied to wresid without changes, e.g. we can test whether there is heteroscedasticity left over, after using WLS to correct for some (parametric) heteroscedasticity.
I'm not sure of what interpretation we get if we use wresid (based on var_weights) for other specification tests.
e.g. acorr: We want to know if acorr is left in the residuals. In auxiliary regression we compare residuals at different lags. For auxiliary OLS, it would likely not make much sense to have wresid in endog and lagged wresid (based on different weights which are for other time points) in exog.
Using resid in endog and exog and then using weights/WLS in an auxiliary regression might make more sense. e.g. acorr_breusch_godfrey acorr_breusch_godfrey has results instance as argument and takes results.resid. So user doesn't have a choice about which residuals are used.
check literature, I don't remember those articles: heteroscedasticity robust tests for autocorrelation.
Using cov_type in the auxiliary OLS regression is the easiest, but it doesn't take advantage of available var_weights.
Activity
josef-pkt commentedon Oct 11, 2017
to the second main point above:
PR #4021 adds the undocumented fit option
attach_wlsto attach the final WLS results to the GLMResults instanceIf reusing it works well, then we can add it a general option and make it available also with fit_gradient, or as a lazy cached attribute.
josef-pkt commentedon Oct 11, 2017
see also #2050 Gauss-Newton Regression
(I'm not sure yet which results we get with the different WLS local approximations.)
josef-pkt commentedon Jan 14, 2020
specific to WLS:
It looks to me like
het_breuschpagancan be applied towresidwithout changes, e.g. we can test whether there is heteroscedasticity left over, after using WLS to correct for some (parametric) heteroscedasticity.I'm not sure of what interpretation we get if we use
wresid(based on var_weights) for other specification tests.e.g.
acorr: We want to know if acorr is left in the residuals. In auxiliary regression we compare residuals at different lags. For auxiliary OLS, it would likely not make much sense to havewresidinendogand laggedwresid(based on different weights which are for other time points) inexog.Using resid in endog and exog and then using weights/WLS in an auxiliary regression might make more sense. e.g.
acorr_breusch_godfreyacorr_breusch_godfreyhas results instance as argument and takesresults.resid. So user doesn't have a choice about which residuals are used.check literature, I don't remember those articles: heteroscedasticity robust tests for autocorrelation.
Using cov_type in the auxiliary OLS regression is the easiest, but it doesn't take advantage of available
var_weights.