#NEWLINE# def hypothesis_test_table( results , title , null_hyp ) : #NEWLINE# #INDENT# fmt = dict ( _default_table_fmt , data_fmts = [ '%#15.6F' , '%#15.6F' , '%#15.3F' , '%s' ] ) #NEWLINE# buf = StringIO ( ) #NEWLINE# table = SimpleTable ( [ [ results [ 'statistic' ] , results [ 'crit_value' ] , results [ 'pvalue' ] , str ( results [ 'df' ] ) ] ] , [ 'Test statistic' , 'Critical Value' , 'p-value' , 'df' ] , [ '' ] , title = None , txt_fmt = fmt ) #NEWLINE# buf . write ( ( title + '\n' ) ) #NEWLINE# buf . write ( ( str ( table ) + '\n' ) ) #NEWLINE# buf . write ( ( null_hyp + '\n' ) ) #NEWLINE# buf . write ( ( 'Conclusion: %s H_0' % results [ 'conclusion' ] ) ) #NEWLINE# buf . write ( ( ' at %.2f%% significance level' % ( results [ 'signif' ] * 100 ) ) ) #NEWLINE# return buf . getvalue ( )