Skip to content

Commit

Permalink
REF: use generic f_test, it works
Browse files Browse the repository at this point in the history
  • Loading branch information
josef-pkt committed Oct 6, 2012
1 parent f5b9a42 commit 9f44860
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion statsmodels/discrete/discrete_model.py
Expand Up @@ -2205,7 +2205,7 @@ def aic_(self):
def bic_(self):
return -2*self.llf + np.log(self.nobs)*self.nnz_params

def f_test(self, r_matrix, q_matrix=None, cov_p=None, scale=1.0,
def f_test_(self, r_matrix, q_matrix=None, cov_p=None, scale=1.0,
invcov=None):
if invcov is None:
invcov = self.invcov()
Expand Down
8 changes: 7 additions & 1 deletion statsmodels/discrete/tests/test_discrete.py
Expand Up @@ -568,7 +568,7 @@ def test_l1_compatability_probit(self):
alpha = np.array([0, 0, 0, 10])
res_reg = Probit(self.data.endog, self.data.exog).fit_regularized(
method="l1", alpha=alpha, disp=0, acc=1e-15, maxiter=2000,
trim_mode='off')
trim_mode='auto') #'off')
# Actually drop the last columnand do an unregularized fit
exog_no_PSI = self.data.exog[:, :3]
res_unreg = Probit(self.data.endog, exog_no_PSI).fit(disp=0, tol=1e-15)
Expand All @@ -583,6 +583,12 @@ def test_l1_compatability_probit(self):
assert_equal(res_unreg.df_model, res_reg.df_model)
assert_equal(res_unreg.df_resid, res_reg.df_resid)

# Test f_test
f_unreg = res_unreg.f_test(np.eye(3))
f_reg = res_reg.f_test(np.eye(4)[:3])
assert_almost_equal(f_unreg.fvalue, f_reg.fvalue, DECIMAL_3)
assert_almost_equal(f_unreg.pvalue, f_reg.pvalue, DECIMAL_3)



class CompareL1(object):
Expand Down

0 comments on commit 9f44860

Please sign in to comment.