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

Issue 3376 : stats f_oneway needs floats #3416

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion scipy/stats/stats.py
Expand Up @@ -2370,7 +2370,8 @@ def f_oneway(*args):
.. [2] Heiman, G.W. Research Methods in Statistics. 2002.

"""
args = list(map(np.asarray, args)) # convert to an numpy array
# convert to an numpy array
args = [np.asarray(arg, dtype=float) for arg in args]
na = len(args) # ANOVA on 'na' groups, each in it's own array
alldata = np.concatenate(args)
bign = len(alldata)
Expand Down
8 changes: 8 additions & 0 deletions scipy/stats/tests/test_stats.py
Expand Up @@ -2660,6 +2660,14 @@ def test_basic(self):
# result in F being exactly 2.0.
assert_equal(F, 2.0)

def test_large_integer_array(self):
# A test of stats.f_oneway on an array of type np.uint16, with large
# integer values
a = np.array([655, 788], dtype=np.uint16)
b = np.array([789, 772], dtype=np.uint16)
F, p = stats.f_oneway(a, b)
assert_almost_equal(F, 0.77450216931805538)


class TestKruskal(TestCase):

Expand Down