def varcorrection_unequal(var_all, nobs_all, df_all):
 var_all = np.asarray(var_all)
 var_over_n = ((var_all * 1.0) / nobs_all)
 varjoint = var_over_n.sum()
 dfjoint = ((varjoint ** 2) / ((var_over_n ** 2) * df_all).sum())
 return (varjoint, dfjoint)

def varcorrection_unequal ( var_all , nobs_all , df_all ) : var_all = np . asarray ( var_all ) var_over_n = ( ( var_all * 1.0 ) / nobs_all ) varjoint = var_over_n . sum ( ) dfjoint = ( ( varjoint ** 2 ) / ( ( var_over_n ** 2 ) * df_all ) . sum ( ) ) return ( varjoint , dfjoint )
return joint variance from samples with unequal variances and unequal sample sizes something is wrong parameters var_all : array_like the variance for each sample nobs_all : array_like the number of observations for each sample df_all : array_like degrees of freedom for each sample returns varjoint : float joint variance .