#NEWLINE# def __init__( self , statistic , distribution , dist_args , table = None , pvalues = None ) : #NEWLINE# #INDENT# self . table = table #NEWLINE# self . distribution = distribution #NEWLINE# self . statistic = statistic #NEWLINE# self . dist_args = dist_args #NEWLINE# if ( table is not None ) : #NEWLINE# #INDENT# self . statistic = table [ 'statistic' ] . values #NEWLINE# self . pvalues = table [ 'pvalue' ] . values #NEWLINE# self . df_constraints = table [ 'df_constraint' ] . values #NEWLINE# if ( self . distribution == 'F' ) : #NEWLINE# #INDENT# self . df_denom = table [ 'df_denom' ] . values #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . distribution is 'chi2' ) : #NEWLINE# #INDENT# self . dist = stats . chi2 #NEWLINE# self . df_constraints = self . dist_args [ 0 ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . distribution is 'F' ) : #NEWLINE# #INDENT# self . dist = stats . f #NEWLINE# ( self . df_constraints , self . df_denom ) = self . dist_args #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( 'only F and chi2 are possible distribution' ) #NEWLINE# #UNINDENT# #UNINDENT# if ( pvalues is None ) : #NEWLINE# #INDENT# self . pvalues = self . dist . sf ( np . abs ( statistic ) , * dist_args ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . pvalues = pvalues