def momentcondquant(distfn, params, mom2, quantile=None, shape=None):
 if (len(params) == 2):
  (loc, scale) = params
 elif (len(params) == 3):
  (shape, loc, scale) = params
 else:
  pass
 (pq, xq) = quantile
 cdfdiff = (distfn.cdf(xq, *params) - pq)
 return cdfdiff

def momentcondquant ( distfn , params , mom2 , quantile = None , shape = None ) : if ( len ( params ) == 2 ) : ( loc , scale ) = params elif ( len ( params ) == 3 ) : ( shape , loc , scale ) = params else : pass ( pq , xq ) = quantile cdfdiff = ( distfn . cdf ( xq , * params ) - pq ) return cdfdiff
moment conditions for estimating distribution parameters by matching quantiles .