New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Robust covariances: integrate with models, normal based Wald tests #1189
Conversation
error |
The import works when I type it in python 3.3, so maybe a problem with 2to3 (need to start toxing across versions again) |
Ok, the last commit fixed the import for python 3 |
One thing I don't quite get is the use of Once this gets in, my PR will need some further work as there is some overlap. |
@bashtage t_test can then also be used for multiple testing (but is not connected to the p-value corrections yet) I still need to get unit tests for cluster-robust covariances, then we should merge your PRs and this one, so we have a common code base again. |
As a followup to this: I'm starting to like the idea of putting the selection of the robust or non-robust The method in this PR is still useful when we want to switch cov_type without reestimating the model. |
I see that now. Might be useful to allow one-sided t-tests eventually, something like |
Yes, I thought about adding one-sided when I was working on the basic t-test. |
strange observation needs checking: with cluster robust standard errors, I match Stata's bse, but for the confidence interval, it looks like Stata uses 9 dof, instead of 197, ivreg2 produces the same result with option
Grunfeld data
edit just saw f-statistic uses df F(2, 9) while non-cluster robust is F(2, 197) |
regression results summary has use_t=True still hardcoded, |
TODO: We should also add 'non-robust' as an option |
This is looking close. I have been thinking about "nonrobust" as the name for the standard estimator, and an wondering if standard or classic might be better. I was thinking that in (Q)MLE models, the classic estimator is the inverse hessian, while the robust estimator is a sandwich, and so it is unclear what these names should be. |
Yes, I thought of stopping here and merge this so I can go back to other PR's I did a lot of reading in the last weeks and have now a much better idea where to go from here, and have opened a large number of new issues. About "nonrobust": I didn't see any generally applicable name in Stata for nonrobust/classic. The name is not used much because it's the default without giving any special arguments. Difficult example for finding names: Poisson
"nonrobust" also sounds a bit negative, which might be good for educational purposes. |
I'm planning to merge this today. So far it's (almost ?) completely backwards compatible, largely new methods. |
Sounds good. Then I can go back to my PR. |
merged after rebase in a14d989 |
first round of integrating robust covariances into the models, and make the cov_type handling more consistent across models.
plus
add_t
normal distribution based Wald statisticschanges behavior of RLMResults, see #1164
currently after OLS only, still needs to be extended to other models. (might currently be wrongly inherited by WLS/GLS)
OLS robust covariance integration tested against Stata, especially ivreg2
WIP: there is a lot more to do, but should be merged soonish, so it can be merged with @bashtage 's PRs
main discussion and list of issues is in #1158
(need TravisCI to check because I'm not always running the full test suite, made mistake in RLM)
for changelog
t_test
and the newwald_test
in LikelihoodModelResults now can now also use normal resp. chisquare distribution.The results instances can use a
use_t
boolean attribute to indicate whether the t or the normal distribution is used int_test
and whether F or chisquare distribution is used inwald_test
.use_t
also determines the distribution inpvalues
andconf_int
of a model.The default
use_t
corresponds to the previous use of the t or normal distribution inpvalues
, all models except for the linear models, OLS, WLS and GLS, use the normal distribution by default.TODO: some models (RLM, ...) still use hardcoded normal distribution
get_robustcov_results
was added as a method to RegressionResults that creates and returns a new result instance that uses the requested robust covariance for all inferential statistics and tests, pvalues, conf_int, f_test, t_test.refactoring:
bcov_scaled
.