本文整理汇总了Python中scipy.special.fdtrc方法的典型用法代码示例。如果您正苦于以下问题:Python special.fdtrc方法的具体用法?Python special.fdtrc怎么用?Python special.fdtrc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scipy.special
的用法示例。
在下文中一共展示了special.fdtrc方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: f_oneway
# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import fdtrc [as 别名]
def f_oneway(*args):
"""
Performs a 1-way ANOVA, returning an F-value and probability given
any number of groups. From Heiman, pp.394-7.
Usage: ``f_oneway(*args)``, where ``*args`` is 2 or more arrays,
one per treatment group.
Returns
-------
statistic : float
The computed F-value of the test.
pvalue : float
The associated p-value from the F-distribution.
"""
# Construct a single array of arguments: each row is a group
data = argstoarray(*args)
ngroups = len(data)
ntot = data.count()
sstot = (data**2).sum() - (data.sum())**2/float(ntot)
ssbg = (data.count(-1) * (data.mean(-1)-data.mean())**2).sum()
sswg = sstot-ssbg
dfbg = ngroups-1
dfwg = ntot - ngroups
msb = ssbg/float(dfbg)
msw = sswg/float(dfwg)
f = msb/msw
prob = special.fdtrc(dfbg, dfwg, f) # equivalent to stats.f.sf
return F_onewayResult(f, prob)
示例2: _sf
# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import fdtrc [as 别名]
def _sf(self, x, dfn, dfd):
return sc.fdtrc(dfn, dfd, x)