def fisher_population_correlation(corrcoefs, sample_sizes):
 tmp_rs = array(corrcoefs)
 tmp_ns = array(sample_sizes)
 rs = tmp_rs[(~ isnan(tmp_rs))]
 ns = tmp_ns[(~ isnan(tmp_rs))]
 if (not (ns > 3).all()):
  return (nan, nan)
 if (not (len(ns) > 1)):
  return (nan, nan)
 if (rs >= 1.0).any():
  raise ValueError("A correlation coefficient >= 1 was passed. This is a non real valured correlation coefficient and it's Fisher Z transform cannot be computed.")
 zs = array([fisher_z_transform(float(i)) for i in rs])
 z_bar = ((zs * (ns - 3)).sum() / float((ns - 3).sum()))
 rho = inverse_fisher_z_transform(z_bar)
 x_2 = ((ns - 3) * ((zs - z_bar) ** 2)).sum()
 h_val = chi2prob(x_2, (len(ns) - 1), direction='high')
 return (rho, h_val)

def fisher_population_correlation ( corrcoefs , sample_sizes ) : tmp_rs = array ( corrcoefs ) tmp_ns = array ( sample_sizes ) rs = tmp_rs [ ( ~ isnan ( tmp_rs ) ) ] ns = tmp_ns [ ( ~ isnan ( tmp_rs ) ) ] if ( not ( ns > 3 ) . all ( ) ) : return ( nan , nan ) if ( not ( len ( ns ) > 1 ) ) : return ( nan , nan ) if ( rs >= 1.0 ) . any ( ) : raise ValueError ( "A correlation coefficient >= 1 was passed. This is a non real valured correlation coefficient and it's Fisher Z transform cannot be computed." ) zs = array ( [ fisher_z_transform ( float ( i ) ) for i in rs ] ) z_bar = ( ( zs * ( ns - 3 ) ) . sum ( ) / float ( ( ns - 3 ) . sum ( ) ) ) rho = inverse_fisher_z_transform ( z_bar ) x_2 = ( ( ns - 3 ) * ( ( zs - z_bar ) ** 2 ) ) . sum ( ) h_val = chi2prob ( x_2 , ( len ( ns ) - 1 ) , direction = 'high' ) return ( rho , h_val )
calculate population rho .