#NEWLINE# def compute_statistic( self , keys = None , **kwargs ) : #NEWLINE# #INDENT# if ( keys is None ) : #NEWLINE# #INDENT# keys = ( list ( chain ( self . keys , self . groups ) ) or [ ] ) #NEWLINE# #UNINDENT# data = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for key in keys : #NEWLINE# #INDENT# key_data = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if ( not self . complete_key ( key ) ) : #NEWLINE# #INDENT# self . run_model ( key ) #NEWLINE# #UNINDENT# if ( isinstance ( key , Iterable ) and ( not ( type ( key ) is str ) ) and ( key in self . keys ) ) : #NEWLINE# #INDENT# applicable_statistics = { k : v for ( k , v ) in self . statistics . items ( ) if v . pairwise } #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# applicable_statistics = { k : v for ( k , v ) in self . statistics . items ( ) if v . individual } #NEWLINE# #UNINDENT# for ( name , statistic ) in applicable_statistics . items ( ) : #NEWLINE# #INDENT# key_data [ name ] = statistic ( key ) #NEWLINE# if statistic . is_distribution : #NEWLINE# #INDENT# key_data [ ( '95_CI %s' % name ) ] = self . compute_interval ( key_data [ name ] , 0.05 ) #NEWLINE# #UNINDENT# if ( statistic . is_estimate and statistic . is_distribution ) : #NEWLINE# #INDENT# key_data [ ( 'estimate %s' % name ) ] = statistic . estimate_function ( key_data [ name ] ) #NEWLINE# #UNINDENT# #UNINDENT# data [ key ] = key_data #NEWLINE# #UNINDENT# return data