some new features

This commit is contained in:
ilgazca
2025-07-30 17:09:11 +03:00
parent db5d46760a
commit 8019bd3b7c
20616 changed files with 4375466 additions and 8 deletions

View File

@ -0,0 +1,15 @@
"""
Tests corresponding to sandbox.stats.multicomp
"""
import numpy as np
from numpy.testing import assert_almost_equal
from statsmodels.sandbox.stats.multicomp import tukey_pvalues
def test_tukey_pvalues():
# TODO: testcase with 3 is not good because all pairs
# has also 3*(3-1)/2=3 elements
res = tukey_pvalues(3.649, 3, 16)
assert_almost_equal(0.05, res[0], 3)
assert_almost_equal(0.05*np.ones(3), res[1], 3)

View File

@ -0,0 +1,29 @@
"""
Tests corresponding to sandbox.stats.runs
"""
from numpy.testing import assert_almost_equal
from statsmodels.sandbox.stats.runs import runstest_1samp
def test_mean_cutoff():
x = [1] * 5 + [2] * 6 + [3] * 8
cutoff = "mean"
expected = (-4.007095978613213, 6.146988816717466e-05)
results = runstest_1samp(x, cutoff=cutoff, correction=False)
assert_almost_equal(expected, results)
def test_median_cutoff():
x = [1] * 5 + [2] * 6 + [3] * 8
cutoff = "median"
expected = (-3.944254410803499, 8.004864125547193e-05)
results = runstest_1samp(x, cutoff=cutoff, correction=False)
assert_almost_equal(expected, results)
def test_numeric_cutoff():
x = [1] * 5 + [2] * 6 + [3] * 8
cutoff = 2
expected = (-3.944254410803499, 8.004864125547193e-05)
results = runstest_1samp(x, cutoff=cutoff, correction=False)
assert_almost_equal(expected, results)