Skip to content
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

Contrast Results after t_test summary broken for 1 parameter #1323

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

Comments

Projects
None yet
1 participant
@josef-pkt
Copy link
Member

commented Jan 22, 2014

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.