def momentcondunbound(distfn, params, mom2, quantile=None):
 (shape, loc, scale) = params
 mom2diff = (np.array(distfn.stats(shape, loc, scale)) - mom2)
 if (not (quantile is None)):
  (pq, xq) = quantile
  cdfdiff = (distfn.cdf(xq, shape, loc, scale) - pq)
  return np.concatenate([mom2diff, cdfdiff[:1]])
 return mom2diff

def momentcondunbound ( distfn , params , mom2 , quantile = None ) : ( shape , loc , scale ) = params mom2diff = ( np . array ( distfn . stats ( shape , loc , scale ) ) - mom2 ) if ( not ( quantile is None ) ) : ( pq , xq ) = quantile cdfdiff = ( distfn . cdf ( xq , shape , loc , scale ) - pq ) return np . concatenate ( [ mom2diff , cdfdiff [ : 1 ] ] ) return mom2diff
moment conditions for estimating distribution parameters using method of moments .