예제 #1
0
    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
0
    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)
예제 #3
0
    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)
예제 #4
0
파일: test_stats.py 프로젝트: flavour/cert
    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)