本文整理汇总了Python中statsmodels.stats.libqsturng.qsturng函数的典型用法代码示例。如果您正苦于以下问题:Python qsturng函数的具体用法?Python qsturng怎么用?Python qsturng使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qsturng函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_qstrung
def test_qstrung():
rows = [ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 24, 30, 40, 60, 120, 9999]
cols = np.arange(2,11)
for alpha in [0.01, 0.05]:
for k in cols:
c1 = get_tukeyQcrit(k, rows, alpha=alpha)
c2 = qsturng(1-alpha, k, rows)
assert_almost_equal(c1, c2, decimal=2)
#roundtrip
assert_almost_equal(psturng(qsturng(1-alpha, k, rows), k, rows), alpha, 5)
开发者ID:0ceangypsy,项目名称:statsmodels,代码行数:12,代码来源:test_qsturng.py
示例2: test_10000_to_ch
def test_10000_to_ch(self):
import os
curdir = os.path.dirname(os.path.abspath(__file__))
ps, rs, vs, qs = read_ch(curdir + '/bootleg.dat') # <- generated by qtukey in R
qs = np.array(qs)
errors = np.abs(qs-qsturng(ps,rs,vs))/qs
assert_equal(np.array([]), np.where(errors > .03)[0])
开发者ID:Code-fish,项目名称:statsmodels,代码行数:7,代码来源:test_qsturng.py
示例3: test_handful_to_tbl
def test_handful_to_tbl(self):
cases = [
(0.75, 30.0, 12.0, 5.01973488482),
(0.975, 15.0, 18.0, 6.00428263999),
(0.1, 8.0, 11.0, 1.76248712658),
(0.995, 6.0, 17.0, 6.13684839819),
(0.85, 15.0, 18.0, 4.65007986215),
(0.75, 17.0, 18.0, 4.33179650607),
(0.75, 60.0, 16.0, 5.50520795792),
(0.99, 100.0, 2.0, 50.3860723433),
(0.9, 2.0, 40.0, 2.38132493732),
(0.8, 12.0, 20.0, 4.15361239056),
(0.675, 8.0, 14.0, 3.35011529943),
(0.75, 30.0, 24.0, 4.77976803574),
(0.75, 2.0, 18.0, 1.68109190167),
(0.99, 7.0, 120.0, 5.00525918406),
(0.8, 19.0, 15.0, 4.70694373713),
(0.8, 15.0, 8.0, 4.80392205906),
(0.5, 12.0, 11.0, 3.31672775449),
(0.85, 30.0, 2.0, 10.2308503607),
(0.675, 20.0, 18.0, 4.23706426096),
(0.1, 60.0, 60.0, 3.69215469278),
]
for p, r, v, q in cases:
assert_almost_equal(q, qsturng(p, r, v), 5)
开发者ID:JerWatson,项目名称:statsmodels,代码行数:26,代码来源:test_qsturng.py
示例4: test_handful_to_ch
def test_handful_to_ch(self):
cases = [
(0.8699908, 10.0, 465.4956, 3.997799075635331),
(0.8559087, 43.0, 211.7474, 5.1348419692951675),
(0.6019187, 11.0, 386.5556, 3.3383101487698821),
(0.658888, 51.0, 74.652, 4.8108880483153733),
(0.6183604, 77.0, 479.8493, 4.9864059321732874),
(0.9238978, 77.0, 787.5278, 5.7871053003022936),
(0.8408322, 7.0, 227.3483, 3.5555798311413578),
(0.5930279, 60.0, 325.3461, 4.7658023123882396),
(0.6236158, 61.0, 657.5285, 4.8207812755987867),
(0.9344575, 72.0, 846.4138, 5.8014341329259107),
(0.8761198, 56.0, 677.8171, 5.362460718311719),
(0.7901517, 41.0, 131.525, 4.9222831341950544),
(0.6396423, 44.0, 624.3828, 4.6015127250083152),
(0.8085966, 14.0, 251.4224, 4.0793058424719746),
(0.716179, 45.0, 136.7055, 4.8055498089340087),
(0.8204, 6.0, 290.9876, 3.3158771384085597),
(0.8705345, 83.0, 759.6216, 5.5969334564485376),
(0.8249085, 18.0, 661.9321, 4.3283725986180395),
(0.9503, 2.0, 4.434, 3.7871158594867262),
(0.7276132, 95.0, 91.43983, 5.4100384868499889),
]
for p, r, v, q in cases:
assert_almost_equal(q, qsturng(p, r, v), 5)
开发者ID:JerWatson,项目名称:statsmodels,代码行数:26,代码来源:test_qsturng.py
示例5: test_vector
def test_vector(self):
"vector input -> vector output"
assert_array_almost_equal(np.array([3.98832389,
4.56835318,
6.26400894]),
qsturng([.8932, .9345,.9827],
[4, 4, 4],
[6, 6, 6]),
5)
开发者ID:Code-fish,项目名称:statsmodels,代码行数:9,代码来源:test_qsturng.py
示例6: get_thsd
def get_thsd(mci):
var_ = np.var(mci.groupstats.groupdemean(), ddof=len(mci.groupsunique))
means = mci.groupstats.groupmean
nobs = mci.groupstats.groupnobs
resi = tukeyhsd(means, nobs, var_, df=None, alpha=0.05, q_crit=qsturng(0.95, len(means), (nobs-1).sum()))
print(resi[4])
var2 = (mci.groupstats.groupvarwithin() * (nobs - 1)).sum() \
/ (nobs - 1).sum()
assert_almost_equal(var_, var2, decimal=14)
return resi
开发者ID:ChadFulton,项目名称:statsmodels,代码行数:10,代码来源:try_tukey_hsd.py
示例7: test_10000_to_ch
def test_10000_to_ch(self):
import os
curdir = os.path.dirname(os.path.abspath(__file__))
#ps, rs, vs, qs = read_ch(curdir + '/bootleg.dat') # <- generated by qtukey in R
# work around problem getting libqsturng.tests.bootleg.dat installed
ps, rs, vs, qs = read_ch(os.path.split(os.path.split(curdir)[0])[0]
+ '/tests/results/bootleg.csv')
qs = np.array(qs)
errors = np.abs(qs-qsturng(ps,rs,vs))/qs
assert_equal(np.array([]), np.where(errors > .03)[0])
开发者ID:SuperXrooT,项目名称:statsmodels,代码行数:10,代码来源:test_qsturng.py
示例8: test_100_random_values
def test_100_random_values(self):
n = 100
ps = np.random.random(n)*(.999 - .1) + .1
rs = np.random.random_integers(2, 100, n)
vs = np.random.random(n)*998. + 2.
qs = qsturng(ps, rs, vs)
estimates = psturng(qs, rs, vs)
actuals = 1. - ps
errors = estimates - actuals
assert_equal(np.array([]), np.where(errors > 1e-5)[0])
开发者ID:Code-fish,项目名称:statsmodels,代码行数:11,代码来源:test_qsturng.py
示例9: test_100_random_values
def test_100_random_values(self, reset_randomstate):
n = 100
random_state = np.random.RandomState(12345)
ps = random_state.random_sample(n)*(.999 - .1) + .1
rs = random_state.randint(2, 101, n)
vs = random_state.random_sample(n)*998. + 2.
qs = qsturng(ps, rs, vs)
estimates = psturng(qs, rs, vs)
actuals = 1. - ps
errors = estimates - actuals
assert_equal(np.array([]), np.where(errors > 1e-5)[0])
开发者ID:bashtage,项目名称:statsmodels,代码行数:12,代码来源:test_qsturng.py
示例10: test_all_to_tbl
def test_all_to_tbl(self):
ps, rs, vs, qs = [], [], [], []
for p in T:
for v in T[p]:
for r in R.keys():
ps.append(p)
vs.append(v)
rs.append(r)
qs.append(T[p][v][R[r]])
qs = np.array(qs)
errors = np.abs(qs-qsturng(ps,rs,vs))/qs
assert_equal(np.array([]), np.where(errors > .03)[0])
开发者ID:KenHollandWHY,项目名称:statsmodels,代码行数:13,代码来源:test_qsturng.py
示例11: t_est_all_to_tbl
def t_est_all_to_tbl(self):
from statsmodels.stats.libqsturng.make_tbls import T,R
ps, rs, vs, qs = [], [], [], []
for p in T:
for v in T[p]:
for r in R.keys():
ps.append(p)
vs.append(v)
rs.append(r)
qs.append(T[p][v][R[r]])
qs = np.array(qs)
errors = np.abs(qs-qsturng(ps,rs,vs))/qs
assert_equal(np.array([]), np.where(errors > .03)[0])
开发者ID:Code-fish,项目名称:statsmodels,代码行数:14,代码来源:test_qsturng.py
示例12: test_scalar
def test_scalar(self):
"scalar input -> scalar output"
assert_almost_equal(4.43645545899562, qsturng(.9,5,6), 5)
开发者ID:Code-fish,项目名称:statsmodels,代码行数:3,代码来源:test_qsturng.py
注:本文中的statsmodels.stats.libqsturng.qsturng函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论