I'm not sure what you mean here.
In the example, I specifically mean to optionally replace the use of
Results.cov_params by HC or Newey-West like pandas. This wouldn't
change any other assumptions or definitions in the model.
> On the practical side you need
> two lines of code when it is more explicit to with one line (then
> again complex vs simple and other Python Zen's may conflict).
>
> This is also a problem of design because I do not understand " [t]he
> alternative would require additional keywords in many places." So
> perhaps you are trying to get to many options into a single function.
> For example, why is res.ttest(...) a function? Everything about it is
> determined by the data, the model and the subsequent fit. All that you
> can really do is change the degrees of freedom and error term -
> perhaps the term being tested. I would suggest that the robust
> estimators are probably a method of the results or summary class if
> the use the same model fit. If not then these are a separate class.
t_test and f_test are very flexible to test any kind of linear
restriction on the parameters, ttest for a single constraint, and
ftest for e.g. a contrast matrix.
it's the main tool to run for example anova type tests on the
significance of the coefficients of several dummy variables
for example from example_ols_tftest.py
R3 = np.eye(ncat)[:-1,:]
Ftest = res2.f_test(R3)
print repr((Ftest.fvalue, Ftest.pvalue))
R3 = np.atleast_2d([0, 1, -1, 2])
Ftest = res2.f_test(R3)
print repr((Ftest.fvalue, Ftest.pvalue))
print 'simultaneous t-test for zero effects'
R4 = np.eye(ncat)[:-1,:]
ttest = res2.t_test(R4)
print repr((ttest.tvalue, ttest.pvalue))
Currently these tests only use the standard parameter covariance from
the model, but in practice in econometrics, it is now more common to
use robust estimators of the covariance, variations on White or
Newey-West sandwich estimators.
we could add a keyword like t_test(...., usecov='HC1')
f_test has a keyword invcov=None but I'm not sure what this is used for.
BTW:
I thought f_test tests also linear restrictions R*beta = r and not
just R*beta = 0, with R the restriction matrix, but I haven't looked
at this end of last summer.
Josef