Skip to content

Commit

Permalink
BUG: proportions_chisquare_allpairs, fix hardcode pairs closes statsm…
Browse files Browse the repository at this point in the history
  • Loading branch information
josef-pkt committed Apr 20, 2014
1 parent e7e018a commit 4bc72a9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion statsmodels/stats/proportion.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ def proportions_chisquare_allpairs(count, nobs, multitest_method='hs'):
Yates continuity correction is not available.
'''
#all_pairs = lmap(list, lzip(*np.triu_indices(4, 1)))
all_pairs = lzip(*np.triu_indices(4, 1))
all_pairs = lzip(*np.triu_indices(len(count), 1))
pvals = [proportions_chisquare(count[list(pair)], nobs[list(pair)])[1]
for pair in all_pairs]
return AllPairsResults(pvals, all_pairs, multitest_method=multitest_method)
Expand Down
11 changes: 11 additions & 0 deletions statsmodels/stats/tests/test_proportion.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,17 @@ def test_pairwiseproptest(self):
assert_almost_equal(pptd.pvals_raw, ppt.pvals_raw[:len(self.nobs) - 1],
decimal=13)


def test_number_pairs_1493(self):
ppt = smprop.proportions_chisquare_allpairs(self.n_success[:3],
self.nobs[:3],
multitest_method=None)

assert_equal(len(ppt.pvals_raw), 3)
idx = [0, 1, 3]
assert_almost_equal(ppt.pvals_raw, self.res_ppt_pvals_raw[idx])


class TestProportion(CheckProportionMixin):
def setup(self):
self.n_success = np.array([ 73, 90, 114, 75])
Expand Down

0 comments on commit 4bc72a9

Please sign in to comment.