Contrast Results after t_test summary broken for 1 parameter #1323

Closed
josef-pkt opened this Issue Jan 22, 2014 · 0 comments

Projects

None yet

1 participant

@josef-pkt
Member

Check what ndim we should have in result of t_test, f_test, ...
f_test returns a single value as ndim=2
pvalues for t_test doesn't have the same ndim, shape as the tvalues

>>> import numpy as np
>>> import statsmodels.api as sm
>>> nobs=100
>>> x = 1 + np.random.randn(nobs)
>>> w = np.random.chisquare(5, size=nobs)
>>> res = sm.WLS(x, np.ones(nobs), weights=w).fit()


>>> tt = res.t_test(r_matrix=[1], q_matrix=[1])
>>> print tt.summary()
Traceback (most recent call last):
  File "<pyshell#42>", line 1, in <module>
    print tt.summary()
  File "e:\josef\eclipsegworkspace\statsmodels-git\statsmodels-all-new2_py27\statsmodels\statsmodels\stats\contrast.py", line 101, in summary
    title=title)
  File "e:\josef\eclipsegworkspace\statsmodels-git\statsmodels-all-new2_py27\statsmodels\statsmodels\iolib\summary.py", line 498, in summary_params
    ["%#6.3f" % (pvalues[i]) for i in exog_idx],
IndexError: 0-d arrays can't be indexed
@josef-pkt josef-pkt added the prio-high label May 17, 2014
@josef-pkt josef-pkt added a commit to josef-pkt/statsmodels that referenced this issue Jun 18, 2014
@josef-pkt josef-pkt TST: add test for t_test with 1 restriction see #1323 c7e3de5
@josef-pkt josef-pkt referenced this issue Jun 18, 2014
Merged

Fix ttest 1d #1769

@josef-pkt josef-pkt closed this in #1769 Jun 18, 2014
@PierreBdR PierreBdR pushed a commit to PierreBdR/statsmodels that referenced this issue Sep 2, 2014
@josef-pkt josef-pkt TST: add test for t_test with 1 restriction see #1323 0106bb6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment