def varcorrection_pairs_unbalanced(nobs_all, srange=False):
 (n1, n2) = np.meshgrid(nobs_all, nobs_all)
 if (not srange):
  return ((1.0 / n1) + (1.0 / n2))
 else:
  return (((1.0 / n1) + (1.0 / n2)) / 2.0)

def varcorrection_pairs_unbalanced ( nobs_all , srange = False ) : ( n1 , n2 ) = np . meshgrid ( nobs_all , nobs_all ) if ( not srange ) : return ( ( 1.0 / n1 ) + ( 1.0 / n2 ) ) else : return ( ( ( 1.0 / n1 ) + ( 1.0 / n2 ) ) / 2.0 )
correction factor for variance with unequal sample sizes for all pairs this is just a harmonic mean parameters nobs_all : array_like the number of observations for each sample srange : bool if true .