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
>>> mlogit_res.t_test(np.ones(mlogit_res._results.cov_params().shape[0]))
Traceback (most recent call last):
File "<pyshell#15>", line 1, in <module>
mlogit_res.t_test(np.ones(mlogit_res._results.cov_params().shape[0]))
File "e:\josef\eclipsegworkspace\statsmodels-git\statsmodels-all-new\statsmodels\statsmodels\base\model.py", line 1133, in t_test
LC = DesignInfo(self.model.exog_names).linear_constraint(r_matrix)
File "e:\josef\eclipsegworkspace\charlton\patsy\patsy\design_info.py", line 220, in linear_constraint
return linear_constraint(constraint_likes, self.column_names)
File "e:\josef\eclipsegworkspace\charlton\patsy\patsy\constraint.py", line 395, in linear_constraint
return LinearConstraint(variable_names, coefs)
File "e:\josef\eclipsegworkspace\charlton\patsy\patsy\constraint.py", line 52, in __init__
raise ValueError("wrong shape for coefs")
ValueError: wrong shape for coefs
I thought we had fixed t_test during L1 merge, but I'm not sure.
It's not as bad as I thought.
in t_test patsy.DesignInfo is getting the param_names as an argument, and params itself is used later in a dot product.
So, AFAICS, we just need two extra methods, get_param_names_full, ravel_params or get_params_flat (or some names like that). get_params_flat and get_param_names_full need to know whether to ravel with order="F" or order="C". MNLogit uses "F".
MultinomialResults already has _get_endog_name
wald_test works in essentially the same way as t_test
AFAIK, we don't have 2-D params with extra params (like multinomial)
unittests for this are actually easy to add, I think.
We have generic test comparing t_test with t_values, pvalues, conf_int, and those already exist for MNLogit. statsmodels\base\tests\test_generic_methods.py does not yet have MNLogit included.
identity = np.eye(len(result.params))
....
for col, name in enumerate(result.model.exog_names)
constraint_matrix = identity[col]
So we need to adjust the names and the shape of the constraint matrices early on in the method.
At the end it delegates to wald_test to compute the test results.
Bonus: We should get test for a row over all columns of params, or on a column over all rows essentially for free. e.g. test whether one exog/term is irrelevant in all endog/equations.
(This doesn't address what happens in the formula path. That's messier.)
Activity
josef-pkt commentedon Feb 17, 2013
issue #457 is still open, so there is still the problem even without patsy
josef-pkt commentedon Jun 15, 2013
do we have a test case for the new NegativeBinomial which has also an extra parameter?
josef-pkt commentedon Jun 15, 2013
NegativeBinomial appends the extra parameter in
__init__self.exog_names.append('alpha')josef-pkt commentedon May 9, 2017
I looked at the names for 2-D params in #3651 (comment)
It's not as bad as I thought.
in t_test patsy.DesignInfo is getting the param_names as an argument, and
paramsitself is used later in a dot product.So, AFAICS, we just need two extra methods,
get_param_names_full,ravel_paramsorget_params_flat(or some names like that).get_params_flatandget_param_names_fullneed to know whether to ravel withorder="F"ororder="C". MNLogit uses "F".MultinomialResultsalready has_get_endog_namewald_testworks in essentially the same way ast_testAFAIK, we don't have 2-D params with extra params (like multinomial)
josef-pkt commentedon May 9, 2017
unittests for this are actually easy to add, I think.
We have generic test comparing t_test with t_values, pvalues, conf_int, and those already exist for MNLogit.
statsmodels\base\tests\test_generic_methods.pydoes not yet have MNLogit included.I don't remember the details about VAR.
josef-pkt commentedon May 9, 2017
one more Wald:
wald_test_termsif the model didn't use formulas, then it uses
So we need to adjust the names and the shape of the constraint matrices early on in the method.
At the end it delegates to
wald_testto compute the test results.Bonus: We should get test for a row over all columns of params, or on a column over all rows essentially for free. e.g. test whether one exog/term is irrelevant in all endog/equations.
(This doesn't address what happens in the formula path. That's messier.)