本文整理汇总了Python中pyvttbl.DataFrame.chisquare2way方法的典型用法代码示例。如果您正苦于以下问题:Python DataFrame.chisquare2way方法的具体用法?Python DataFrame.chisquare2way怎么用?Python DataFrame.chisquare2way使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyvttbl.DataFrame
的用法示例。
在下文中一共展示了DataFrame.chisquare2way方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test0
# 需要导入模块: from pyvttbl import DataFrame [as 别名]
# 或者: from pyvttbl.DataFrame import chisquare2way [as 别名]
def test0(self):
R = """\
Chi-Square: two Factor
SUMMARY
Guilty NotGuilty Total
=====================================
High 105 76 181
(130.441) (50.559)
Low 153 24 177
(127.559) (49.441)
=====================================
Total 258 100 358
SYMMETRIC MEASURES
Value Approx.
Sig.
===========================================
Cramer's V 0.317 8.686e-10
Contingency Coefficient 0.302 5.510e-09
N of Valid Cases 358
CHI-SQUARE TESTS
Value df P
===============================================
Pearson Chi-Square 35.930 1 2.053e-09
Continuity Correction 34.532 1 4.201e-09
Likelihood Ratio 37.351 1 0
N of Valid Cases 358
CHI-SQUARE POST-HOC POWER
Measure
==============================
Effect size w 0.317
Non-centrality lambda 35.930
Critical Chi-Square 3.841
Power 1.000 """
df = DataFrame()
df["FAULTS"] = list(Counter(Low=177, High=181).elements())
df["FAULTS"] = df["FAULTS"][::-1] # reverse 'FAULT' data
df["VERDICT"] = list(Counter(Guilty=153, NotGuilty=24).elements()) + list(
Counter(Guilty=105, NotGuilty=76).elements()
)
x2 = df.chisquare2way("FAULTS", "VERDICT")
self.assertEqual(str(x2), R)
示例2: test0
# 需要导入模块: from pyvttbl import DataFrame [as 别名]
# 或者: from pyvttbl.DataFrame import chisquare2way [as 别名]
def test0(self):
R="""Chi-Square: two Factor
SUMMARY
Guilty NotGuilty Total
=====================================
High 105 76 181
(130.441) (50.559)
Low 153 24 177
(127.559) (49.441)
=====================================
Total 258 100 358
SYMMETRIC MEASURES
Value Approx.
Sig.
===========================================
Cramer's V 0.317 8.686e-10
Contingency Coefficient 0.302 5.510e-09
N of Valid Cases 358
CHI-SQUARE TESTS
Value df P
===============================================
Pearson Chi-Square 35.930 1 2.053e-09
Continuity Correction 34.532 1 4.201e-09
Likelihood Ratio 37.351 1 0
N of Valid Cases 358 """
df=DataFrame()
df['FAULTS']=list(Counter(Low=177,High=181).elements())
df['FAULTS'].reverse()
df['VERDICT']=list(Counter(Guilty=153, NotGuilty=24).elements())
df['VERDICT'].extend(list(Counter(Guilty=105, NotGuilty=76).elements()))
x2= df.chisquare2way('FAULTS','VERDICT')
self.assertEqual(str(x2), R)