#NEWLINE# def main( ) : #NEWLINE# #INDENT# thinkstats2 . RandomSeed ( 17 ) #NEWLINE# ct = CoinTest ( ( 140 , 110 ) ) #NEWLINE# pvalue = ct . PValue ( ) #NEWLINE# print ( 'coin test p-value' , pvalue ) #NEWLINE# print ( '\nprglngth' ) #NEWLINE# ( live , firsts , others ) = first . MakeFrames ( ) #NEWLINE# data = ( firsts . prglngth . values , others . prglngth . values ) #NEWLINE# RunTests ( data ) #NEWLINE# print ( '\nbirth weight' ) #NEWLINE# data = ( firsts . totalwgt_lb . dropna ( ) . values , others . totalwgt_lb . dropna ( ) . values ) #NEWLINE# ht = DiffMeansPermute ( neg_rate ) #NEWLINE# p_value = ht . PValue ( iters = 1000 ) #NEWLINE# print ( 'means permute two-sided' ) #NEWLINE# PrintTest ( p_value , ht ) #NEWLINE# live2 = live . dropna ( subset = [ 'agepreg' , 'totalwgt_lb' ] ) #NEWLINE# data = ( live2 . agepreg . values , live2 . totalwgt_lb . values ) #NEWLINE# ht = CorrelationPermute ( data ) #NEWLINE# p_value = ht . PValue ( ) #NEWLINE# print ( '\nage weight correlation' ) #NEWLINE# print ( 'n=' , len ( live2 ) ) #NEWLINE# PrintTest ( p_value , ht ) #NEWLINE# RunDiceTest ( ) #NEWLINE# data = ( firsts . prglngth . values , others . prglngth . values ) #NEWLINE# ht = PregLengthTest ( data ) #NEWLINE# p_value = ht . PValue ( ) #NEWLINE# print ( '\npregnancy length chi-squared' ) #NEWLINE# PrintTest ( p_value , ht ) #NEWLINE# data = ( firsts . prglngth . values , others . prglngth . values ) #NEWLINE# neg_rate = FalseNegRate ( data ) #NEWLINE# print ( 'false neg rate' , neg_rate ) #NEWLINE# ReplicateTests ( )