<s> from __future__ import division , print_function , absolute_import <EOL> import warnings <EOL> from scipy . special import comb <EOL> from scipy . misc . doccer import inherit_docstring_from <EOL> from scipy import special <EOL> from scipy import optimize <EOL> from scipy import integrate <EOL> from scipy . special import ( gammaln as gamln , gamma as gam , boxcox , boxcox1p , <EOL> inv_boxcox , inv_boxcox1p , erfc , chndtr , chndtrix , <EOL> i0 , i1 , ndtr as _norm_cdf , log_ndtr as _norm_logcdf ) <EOL> from numpy import ( where , arange , putmask , ravel , shape , <EOL> log , sqrt , exp , arctanh , tan , sin , arcsin , arctan , <EOL> tanh , cos , cosh , sinh ) <EOL> from numpy import polyval , place , extract , asarray , nan , inf , pi <EOL> import numpy as np <EOL> from . import _stats <EOL> from . _tukeylambda_stats import ( tukeylambda_variance as _tlvar , <EOL> tukeylambda_kurtosis as _tlkurt ) <EOL> from . _distn_infrastructure import ( <EOL> rv_continuous , valarray , _skew , _kurtosis , _lazywhere , <EOL> _ncx2_log_pdf , _ncx2_pdf , _ncx2_cdf , get_distribution_names , <EOL> ) <EOL> from . _constants import _XMIN , _EULER , _ZETA3 , _XMAX , _LOGXMAX <EOL> class ksone_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _cdf ( self , x , n ) : <EOL> return <NUM_LIT:1.0> - special . smirnov ( n , x ) <EOL> def _ppf ( self , q , n ) : <EOL> return special . smirnovi ( n , <NUM_LIT:1.0> - q ) <EOL> ksone = ksone_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class kstwobign_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _cdf ( self , x ) : <EOL> return <NUM_LIT:1.0> - special . kolmogorov ( x ) <EOL> def _sf ( self , x ) : <EOL> return special . kolmogorov ( x ) <EOL> def _ppf ( self , q ) : <EOL> return special . kolmogi ( <NUM_LIT:1.0> - q ) <EOL> kstwobign = kstwobign_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> _norm_pdf_C = np . sqrt ( <NUM_LIT:2> * pi ) <EOL> _norm_pdf_logC = np . log ( _norm_pdf_C ) <EOL> def _norm_pdf ( x ) : <EOL> return exp ( - x ** <NUM_LIT:2> / <NUM_LIT> ) / _norm_pdf_C <EOL> def _norm_logpdf ( x ) : <EOL> return - x ** <NUM_LIT:2> / <NUM_LIT> - _norm_pdf_logC <EOL> def _norm_ppf ( q ) : <EOL> return special . ndtri ( q ) <EOL> def _norm_sf ( x ) : <EOL> return _norm_cdf ( - x ) <EOL> def _norm_logsf ( x ) : <EOL> return _norm_logcdf ( - x ) <EOL> def _norm_isf ( q ) : <EOL> return - special . ndtri ( q ) <EOL> class norm_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _rvs ( self ) : <EOL> return self . _random_state . standard_normal ( self . _size ) <EOL> def _pdf ( self , x ) : <EOL> return _norm_pdf ( x ) <EOL> def _logpdf ( self , x ) : <EOL> return _norm_logpdf ( x ) <EOL> def _cdf ( self , x ) : <EOL> return _norm_cdf ( x ) <EOL> def _logcdf ( self , x ) : <EOL> return _norm_logcdf ( x ) <EOL> def _sf ( self , x ) : <EOL> return _norm_sf ( x ) <EOL> def _logsf ( self , x ) : <EOL> return _norm_logsf ( x ) <EOL> def _ppf ( self , q ) : <EOL> return _norm_ppf ( q ) <EOL> def _isf ( self , q ) : <EOL> return _norm_isf ( q ) <EOL> def _stats ( self ) : <EOL> return <NUM_LIT:0.0> , <NUM_LIT:1.0> , <NUM_LIT:0.0> , <NUM_LIT:0.0> <EOL> def _entropy ( self ) : <EOL> return <NUM_LIT:0.5> * ( log ( <NUM_LIT:2> * pi ) + <NUM_LIT:1> ) <EOL> @ inherit_docstring_from ( rv_continuous ) <EOL> def fit ( self , data , ** kwds ) : <EOL> """<STR_LIT>""" <EOL> floc = kwds . get ( '<STR_LIT>' , None ) <EOL> fscale = kwds . get ( '<STR_LIT>' , None ) <EOL> if floc is not None and fscale is not None : <EOL> raise ValueError ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> data = np . asarray ( data ) <EOL> if floc is None : <EOL> loc = data . mean ( ) <EOL> else : <EOL> loc = floc <EOL> if fscale is None : <EOL> scale = np . sqrt ( ( ( data - loc ) ** <NUM_LIT:2> ) . mean ( ) ) <EOL> else : <EOL> scale = fscale <EOL> return loc , scale <EOL> norm = norm_gen ( name = '<STR_LIT>' ) <EOL> class alpha_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x , a ) : <EOL> return <NUM_LIT:1.0> / ( x ** <NUM_LIT:2> ) / _norm_cdf ( a ) * _norm_pdf ( a - <NUM_LIT:1.0> / x ) <EOL> def _logpdf ( self , x , a ) : <EOL> return - <NUM_LIT:2> * log ( x ) + _norm_logpdf ( a - <NUM_LIT:1.0> / x ) - log ( _norm_cdf ( a ) ) <EOL> def _cdf ( self , x , a ) : <EOL> return _norm_cdf ( a - <NUM_LIT:1.0> / x ) / _norm_cdf ( a ) <EOL> def _ppf ( self , q , a ) : <EOL> return <NUM_LIT:1.0> / asarray ( a - special . ndtri ( q * special . ndtr ( a ) ) ) <EOL> def _stats ( self , a ) : <EOL> return [ inf ] * <NUM_LIT:2> + [ nan ] * <NUM_LIT:2> <EOL> alpha = alpha_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class anglit_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x ) : <EOL> return cos ( <NUM_LIT:2> * x ) <EOL> def _cdf ( self , x ) : <EOL> return sin ( x + pi / <NUM_LIT:4> ) ** <NUM_LIT> <EOL> def _ppf ( self , q ) : <EOL> return ( arcsin ( sqrt ( q ) ) - pi / <NUM_LIT:4> ) <EOL> def _stats ( self ) : <EOL> return <NUM_LIT:0.0> , pi * pi / <NUM_LIT:16> - <NUM_LIT:0.5> , <NUM_LIT:0.0> , - <NUM_LIT:2> * ( pi ** <NUM_LIT:4> - <NUM_LIT> ) / ( pi * pi - <NUM_LIT:8> ) ** <NUM_LIT:2> <EOL> def _entropy ( self ) : <EOL> return <NUM_LIT:1> - log ( <NUM_LIT:2> ) <EOL> anglit = anglit_gen ( a = - pi / <NUM_LIT:4> , b = pi / <NUM_LIT:4> , name = '<STR_LIT>' ) <EOL> class arcsine_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x ) : <EOL> return <NUM_LIT:1.0> / pi / sqrt ( x * ( <NUM_LIT:1> - x ) ) <EOL> def _cdf ( self , x ) : <EOL> return <NUM_LIT> / pi * arcsin ( sqrt ( x ) ) <EOL> def _ppf ( self , q ) : <EOL> return sin ( pi / <NUM_LIT> * q ) ** <NUM_LIT> <EOL> def _stats ( self ) : <EOL> mu = <NUM_LIT:0.5> <EOL> mu2 = <NUM_LIT:1.0> / <NUM_LIT:8> <EOL> g1 = <NUM_LIT:0> <EOL> g2 = - <NUM_LIT> / <NUM_LIT> <EOL> return mu , mu2 , g1 , g2 <EOL> def _entropy ( self ) : <EOL> return - <NUM_LIT> <EOL> arcsine = arcsine_gen ( a = <NUM_LIT:0.0> , b = <NUM_LIT:1.0> , name = '<STR_LIT>' ) <EOL> class FitDataError ( ValueError ) : <EOL> def __init__ ( self , distr , lower , upper ) : <EOL> self . args = ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" . format ( <EOL> distr = distr , lower = lower , upper = upper ) , <EOL> ) <EOL> class FitSolverError ( RuntimeError ) : <EOL> def __init__ ( self , mesg ) : <EOL> emsg = "<STR_LIT>" <EOL> emsg += mesg . replace ( '<STR_LIT:\n>' , '<STR_LIT>' ) <EOL> self . args = ( emsg , ) <EOL> def _beta_mle_a ( a , b , n , s1 ) : <EOL> psiab = special . psi ( a + b ) <EOL> func = s1 - n * ( - psiab + special . psi ( a ) ) <EOL> return func <EOL> def _beta_mle_ab ( theta , n , s1 , s2 ) : <EOL> a , b = theta <EOL> psiab = special . psi ( a + b ) <EOL> func = [ s1 - n * ( - psiab + special . psi ( a ) ) , <EOL> s2 - n * ( - psiab + special . psi ( b ) ) ] <EOL> return func <EOL> class beta_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _rvs ( self , a , b ) : <EOL> return self . _random_state . beta ( a , b , self . _size ) <EOL> def _pdf ( self , x , a , b ) : <EOL> return np . exp ( self . _logpdf ( x , a , b ) ) <EOL> def _logpdf ( self , x , a , b ) : <EOL> lPx = special . xlog1py ( b - <NUM_LIT:1.0> , - x ) + special . xlogy ( a - <NUM_LIT:1.0> , x ) <EOL> lPx -= special . betaln ( a , b ) <EOL> return lPx <EOL> def _cdf ( self , x , a , b ) : <EOL> return special . btdtr ( a , b , x ) <EOL> def _ppf ( self , q , a , b ) : <EOL> return special . btdtri ( a , b , q ) <EOL> def _stats ( self , a , b ) : <EOL> mn = a * <NUM_LIT:1.0> / ( a + b ) <EOL> var = ( a * b * <NUM_LIT:1.0> ) / ( a + b + <NUM_LIT:1.0> ) / ( a + b ) ** <NUM_LIT> <EOL> g1 = <NUM_LIT> * ( b - a ) * sqrt ( ( <NUM_LIT:1.0> + a + b ) / ( a * b ) ) / ( <NUM_LIT:2> + a + b ) <EOL> g2 = <NUM_LIT> * ( a ** <NUM_LIT:3> + a ** <NUM_LIT:2> * ( <NUM_LIT:1> - <NUM_LIT:2> * b ) + b ** <NUM_LIT:2> * ( <NUM_LIT:1> + b ) - <NUM_LIT:2> * a * b * ( <NUM_LIT:2> + b ) ) <EOL> g2 /= a * b * ( a + b + <NUM_LIT:2> ) * ( a + b + <NUM_LIT:3> ) <EOL> return mn , var , g1 , g2 <EOL> def _fitstart ( self , data ) : <EOL> g1 = _skew ( data ) <EOL> g2 = _kurtosis ( data ) <EOL> def func ( x ) : <EOL> a , b = x <EOL> sk = <NUM_LIT:2> * ( b - a ) * sqrt ( a + b + <NUM_LIT:1> ) / ( a + b + <NUM_LIT:2> ) / sqrt ( a * b ) <EOL> ku = a ** <NUM_LIT:3> - a ** <NUM_LIT:2> * ( <NUM_LIT:2> * b - <NUM_LIT:1> ) + b ** <NUM_LIT:2> * ( b + <NUM_LIT:1> ) - <NUM_LIT:2> * a * b * ( b + <NUM_LIT:2> ) <EOL> ku /= a * b * ( a + b + <NUM_LIT:2> ) * ( a + b + <NUM_LIT:3> ) <EOL> ku *= <NUM_LIT:6> <EOL> return [ sk - g1 , ku - g2 ] <EOL> a , b = optimize . fsolve ( func , ( <NUM_LIT:1.0> , <NUM_LIT:1.0> ) ) <EOL> return super ( beta_gen , self ) . _fitstart ( data , args = ( a , b ) ) <EOL> @ inherit_docstring_from ( rv_continuous ) <EOL> def fit ( self , data , * args , ** kwds ) : <EOL> """<STR_LIT>""" <EOL> f0 = ( kwds . get ( '<STR_LIT>' , None ) or kwds . get ( '<STR_LIT>' , None ) or <EOL> kwds . get ( '<STR_LIT>' , None ) ) <EOL> f1 = ( kwds . get ( '<STR_LIT>' , None ) or kwds . get ( '<STR_LIT>' , None ) or <EOL> kwds . get ( '<STR_LIT>' , None ) ) <EOL> floc = kwds . get ( '<STR_LIT>' , None ) <EOL> fscale = kwds . get ( '<STR_LIT>' , None ) <EOL> if floc is None or fscale is None : <EOL> return super ( beta_gen , self ) . fit ( data , * args , ** kwds ) <EOL> if f0 is not None and f1 is not None : <EOL> raise ValueError ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> data = ( ravel ( data ) - floc ) / fscale <EOL> if np . any ( data <= <NUM_LIT:0> ) or np . any ( data >= <NUM_LIT:1> ) : <EOL> raise FitDataError ( "<STR_LIT>" , lower = floc , upper = floc + fscale ) <EOL> xbar = data . mean ( ) <EOL> if f0 is not None or f1 is not None : <EOL> if f0 is not None : <EOL> b = f0 <EOL> data = <NUM_LIT:1> - data <EOL> xbar = <NUM_LIT:1> - xbar <EOL> else : <EOL> b = f1 <EOL> a = b * xbar / ( <NUM_LIT:1> - xbar ) <EOL> theta , info , ier , mesg = optimize . fsolve ( <EOL> _beta_mle_a , a , <EOL> args = ( b , len ( data ) , np . log ( data ) . sum ( ) ) , <EOL> full_output = True <EOL> ) <EOL> if ier != <NUM_LIT:1> : <EOL> raise FitSolverError ( mesg = mesg ) <EOL> a = theta [ <NUM_LIT:0> ] <EOL> if f0 is not None : <EOL> a , b = b , a <EOL> else : <EOL> s1 = np . log ( data ) . sum ( ) <EOL> s2 = np . log ( <NUM_LIT:1> - data ) . sum ( ) <EOL> fac = xbar * ( <NUM_LIT:1> - xbar ) / data . var ( ddof = <NUM_LIT:0> ) - <NUM_LIT:1> <EOL> a = xbar * fac <EOL> b = ( <NUM_LIT:1> - xbar ) * fac <EOL> theta , info , ier , mesg = optimize . fsolve ( <EOL> _beta_mle_ab , [ a , b ] , <EOL> args = ( len ( data ) , s1 , s2 ) , <EOL> full_output = True <EOL> ) <EOL> if ier != <NUM_LIT:1> : <EOL> raise FitSolverError ( mesg = mesg ) <EOL> a , b = theta <EOL> return a , b , floc , fscale <EOL> beta = beta_gen ( a = <NUM_LIT:0.0> , b = <NUM_LIT:1.0> , name = '<STR_LIT>' ) <EOL> class betaprime_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _rvs ( self , a , b ) : <EOL> sz , rndm = self . _size , self . _random_state <EOL> u1 = gamma . rvs ( a , size = sz , random_state = rndm ) <EOL> u2 = gamma . rvs ( b , size = sz , random_state = rndm ) <EOL> return ( u1 / u2 ) <EOL> def _pdf ( self , x , a , b ) : <EOL> return np . exp ( self . _logpdf ( x , a , b ) ) <EOL> def _logpdf ( self , x , a , b ) : <EOL> return ( special . xlogy ( a - <NUM_LIT:1.0> , x ) - special . xlog1py ( a + b , x ) - <EOL> special . betaln ( a , b ) ) <EOL> def _cdf ( self , x , a , b ) : <EOL> return special . betainc ( a , b , x / ( <NUM_LIT:1.> + x ) ) <EOL> def _munp ( self , n , a , b ) : <EOL> if ( n == <NUM_LIT:1.0> ) : <EOL> return where ( b > <NUM_LIT:1> , a / ( b - <NUM_LIT:1.0> ) , inf ) <EOL> elif ( n == <NUM_LIT> ) : <EOL> return where ( b > <NUM_LIT:2> , a * ( a + <NUM_LIT:1.0> ) / ( ( b - <NUM_LIT> ) * ( b - <NUM_LIT:1.0> ) ) , inf ) <EOL> elif ( n == <NUM_LIT> ) : <EOL> return where ( b > <NUM_LIT:3> , a * ( a + <NUM_LIT:1.0> ) * ( a + <NUM_LIT> ) / ( ( b - <NUM_LIT> ) * ( b - <NUM_LIT> ) * ( b - <NUM_LIT:1.0> ) ) , <EOL> inf ) <EOL> elif ( n == <NUM_LIT> ) : <EOL> return where ( b > <NUM_LIT:4> , <EOL> a * ( a + <NUM_LIT:1.0> ) * ( a + <NUM_LIT> ) * ( a + <NUM_LIT> ) / ( ( b - <NUM_LIT> ) * ( b - <NUM_LIT> ) <EOL> * ( b - <NUM_LIT> ) * ( b - <NUM_LIT:1.0> ) ) , inf ) <EOL> else : <EOL> raise NotImplementedError <EOL> betaprime = betaprime_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class bradford_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x , c ) : <EOL> return c / ( c * x + <NUM_LIT:1.0> ) / log ( <NUM_LIT:1.0> + c ) <EOL> def _cdf ( self , x , c ) : <EOL> return log ( <NUM_LIT:1.0> + c * x ) / log ( c + <NUM_LIT:1.0> ) <EOL> def _ppf ( self , q , c ) : <EOL> return ( ( <NUM_LIT:1.0> + c ) ** q - <NUM_LIT:1> ) / c <EOL> def _stats ( self , c , moments = '<STR_LIT>' ) : <EOL> k = log ( <NUM_LIT:1.0> + c ) <EOL> mu = ( c - k ) / ( c * k ) <EOL> mu2 = ( ( c + <NUM_LIT> ) * k - <NUM_LIT> * c ) / ( <NUM_LIT:2> * c * k * k ) <EOL> g1 = None <EOL> g2 = None <EOL> if '<STR_LIT:s>' in moments : <EOL> g1 = sqrt ( <NUM_LIT:2> ) * ( <NUM_LIT:12> * c * c - <NUM_LIT:9> * c * k * ( c + <NUM_LIT:2> ) + <NUM_LIT:2> * k * k * ( c * ( c + <NUM_LIT:3> ) + <NUM_LIT:3> ) ) <EOL> g1 /= sqrt ( c * ( c * ( k - <NUM_LIT:2> ) + <NUM_LIT:2> * k ) ) * ( <NUM_LIT:3> * c * ( k - <NUM_LIT:2> ) + <NUM_LIT:6> * k ) <EOL> if '<STR_LIT:k>' in moments : <EOL> g2 = ( c ** <NUM_LIT:3> * ( k - <NUM_LIT:3> ) * ( k * ( <NUM_LIT:3> * k - <NUM_LIT:16> ) + <NUM_LIT> ) + <NUM_LIT:12> * k * c * c * ( k - <NUM_LIT:4> ) * ( k - <NUM_LIT:3> ) <EOL> + <NUM_LIT:6> * c * k * k * ( <NUM_LIT:3> * k - <NUM_LIT> ) + <NUM_LIT:12> * k ** <NUM_LIT:3> ) <EOL> g2 /= <NUM_LIT:3> * c * ( c * ( k - <NUM_LIT:2> ) + <NUM_LIT:2> * k ) ** <NUM_LIT:2> <EOL> return mu , mu2 , g1 , g2 <EOL> def _entropy ( self , c ) : <EOL> k = log ( <NUM_LIT:1> + c ) <EOL> return k / <NUM_LIT> - log ( c / k ) <EOL> bradford = bradford_gen ( a = <NUM_LIT:0.0> , b = <NUM_LIT:1.0> , name = '<STR_LIT>' ) <EOL> class burr_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x , c , d ) : <EOL> return c * d * ( x ** ( - c - <NUM_LIT:1.0> ) ) * ( ( <NUM_LIT:1> + x ** ( - c ) ) ** ( - d - <NUM_LIT:1.0> ) ) <EOL> def _cdf ( self , x , c , d ) : <EOL> return ( <NUM_LIT:1> + x ** ( - c ) ) ** ( - d ) <EOL> def _ppf ( self , q , c , d ) : <EOL> return ( q ** ( - <NUM_LIT:1.0> / d ) - <NUM_LIT:1> ) ** ( - <NUM_LIT:1.0> / c ) <EOL> def _munp ( self , n , c , d ) : <EOL> nc = <NUM_LIT:1.> * n / c <EOL> return d * special . beta ( <NUM_LIT:1.0> - nc , d + nc ) <EOL> burr = burr_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class burr12_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x , c , d ) : <EOL> return np . exp ( self . _logpdf ( x , c , d ) ) <EOL> def _logpdf ( self , x , c , d ) : <EOL> return log ( c ) + log ( d ) + special . xlogy ( c - <NUM_LIT:1> , x ) + special . xlog1py ( - d - <NUM_LIT:1> , x ** c ) <EOL> def _cdf ( self , x , c , d ) : <EOL> return <NUM_LIT:1> - self . _sf ( x , c , d ) <EOL> def _logcdf ( self , x , c , d ) : <EOL> return special . log1p ( - ( <NUM_LIT:1> + x ** c ) ** ( - d ) ) <EOL> def _sf ( self , x , c , d ) : <EOL> return np . exp ( self . _logsf ( x , c , d ) ) <EOL> def _logsf ( self , x , c , d ) : <EOL> return special . xlog1py ( - d , x ** c ) <EOL> def _ppf ( self , q , c , d ) : <EOL> return ( ( <NUM_LIT:1> - q ) ** ( - <NUM_LIT:1.0> / d ) - <NUM_LIT:1> ) ** ( <NUM_LIT:1.0> / c ) <EOL> def _munp ( self , n , c , d ) : <EOL> nc = <NUM_LIT:1.> * n / c <EOL> return d * special . beta ( <NUM_LIT:1.0> + nc , d - nc ) <EOL> burr12 = burr12_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class fisk_gen ( burr_gen ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x , c ) : <EOL> return burr_gen . _pdf ( self , x , c , <NUM_LIT:1.0> ) <EOL> def _cdf ( self , x , c ) : <EOL> return burr_gen . _cdf ( self , x , c , <NUM_LIT:1.0> ) <EOL> def _ppf ( self , x , c ) : <EOL> return burr_gen . _ppf ( self , x , c , <NUM_LIT:1.0> ) <EOL> def _munp ( self , n , c ) : <EOL> return burr_gen . _munp ( self , n , c , <NUM_LIT:1.0> ) <EOL> def _entropy ( self , c ) : <EOL> return <NUM_LIT:2> - log ( c ) <EOL> fisk = fisk_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class cauchy_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x ) : <EOL> return <NUM_LIT:1.0> / pi / ( <NUM_LIT:1.0> + x * x ) <EOL> def _cdf ( self , x ) : <EOL> return <NUM_LIT:0.5> + <NUM_LIT:1.0> / pi * arctan ( x ) <EOL> def _ppf ( self , q ) : <EOL> return tan ( pi * q - pi / <NUM_LIT> ) <EOL> def _sf ( self , x ) : <EOL> return <NUM_LIT:0.5> - <NUM_LIT:1.0> / pi * arctan ( x ) <EOL> def _isf ( self , q ) : <EOL> return tan ( pi / <NUM_LIT> - pi * q ) <EOL> def _stats ( self ) : <EOL> return nan , nan , nan , nan <EOL> def _entropy ( self ) : <EOL> return log ( <NUM_LIT:4> * pi ) <EOL> def _fitstart ( self , data , args = None ) : <EOL> p25 , p50 , p75 = np . percentile ( data , [ <NUM_LIT> , <NUM_LIT:50> , <NUM_LIT> ] ) <EOL> return p50 , ( p75 - p25 ) / <NUM_LIT:2> <EOL> cauchy = cauchy_gen ( name = '<STR_LIT>' ) <EOL> class chi_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _rvs ( self , df ) : <EOL> sz , rndm = self . _size , self . _random_state <EOL> return sqrt ( chi2 . rvs ( df , size = sz , random_state = rndm ) ) <EOL> def _pdf ( self , x , df ) : <EOL> return np . exp ( self . _logpdf ( x , df ) ) <EOL> def _logpdf ( self , x , df ) : <EOL> l = np . log ( <NUM_LIT:2> ) - <NUM_LIT> * np . log ( <NUM_LIT:2> ) * df - special . gammaln ( <NUM_LIT> * df ) <EOL> return l + special . xlogy ( df - <NUM_LIT:1.> , x ) - <NUM_LIT> * x ** <NUM_LIT:2> <EOL> def _cdf ( self , x , df ) : <EOL> return special . gammainc ( <NUM_LIT> * df , <NUM_LIT> * x ** <NUM_LIT:2> ) <EOL> def _ppf ( self , q , df ) : <EOL> return sqrt ( <NUM_LIT:2> * special . gammaincinv ( <NUM_LIT> * df , q ) ) <EOL> def _stats ( self , df ) : <EOL> mu = sqrt ( <NUM_LIT:2> ) * special . gamma ( df / <NUM_LIT> + <NUM_LIT:0.5> ) / special . gamma ( df / <NUM_LIT> ) <EOL> mu2 = df - mu * mu <EOL> g1 = ( <NUM_LIT:2> * mu ** <NUM_LIT> + mu * ( <NUM_LIT:1> - <NUM_LIT:2> * df ) ) / asarray ( np . power ( mu2 , <NUM_LIT> ) ) <EOL> g2 = <NUM_LIT:2> * df * ( <NUM_LIT:1.0> - df ) - <NUM_LIT:6> * mu ** <NUM_LIT:4> + <NUM_LIT:4> * mu ** <NUM_LIT:2> * ( <NUM_LIT:2> * df - <NUM_LIT:1> ) <EOL> g2 /= asarray ( mu2 ** <NUM_LIT> ) <EOL> return mu , mu2 , g1 , g2 <EOL> chi = chi_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class chi2_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _rvs ( self , df ) : <EOL> return self . _random_state . chisquare ( df , self . _size ) <EOL> def _pdf ( self , x , df ) : <EOL> return exp ( self . _logpdf ( x , df ) ) <EOL> def _logpdf ( self , x , df ) : <EOL> return special . xlogy ( df / <NUM_LIT> - <NUM_LIT:1> , x ) - x / <NUM_LIT> - gamln ( df / <NUM_LIT> ) - ( log ( <NUM_LIT:2> ) * df ) / <NUM_LIT> <EOL> def _cdf ( self , x , df ) : <EOL> return special . chdtr ( df , x ) <EOL> def _sf ( self , x , df ) : <EOL> return special . chdtrc ( df , x ) <EOL> def _isf ( self , p , df ) : <EOL> return special . chdtri ( df , p ) <EOL> def _ppf ( self , p , df ) : <EOL> return self . _isf ( <NUM_LIT:1.0> - p , df ) <EOL> def _stats ( self , df ) : <EOL> mu = df <EOL> mu2 = <NUM_LIT:2> * df <EOL> g1 = <NUM_LIT:2> * sqrt ( <NUM_LIT> / df ) <EOL> g2 = <NUM_LIT> / df <EOL> return mu , mu2 , g1 , g2 <EOL> chi2 = chi2_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class cosine_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x ) : <EOL> return <NUM_LIT:1.0> / <NUM_LIT:2> / pi * ( <NUM_LIT:1> + cos ( x ) ) <EOL> def _cdf ( self , x ) : <EOL> return <NUM_LIT:1.0> / <NUM_LIT:2> / pi * ( pi + x + sin ( x ) ) <EOL> def _stats ( self ) : <EOL> return <NUM_LIT:0.0> , pi * pi / <NUM_LIT> - <NUM_LIT> , <NUM_LIT:0.0> , - <NUM_LIT> * ( pi ** <NUM_LIT:4> - <NUM_LIT> ) / ( <NUM_LIT> * ( pi * pi - <NUM_LIT:6> ) ** <NUM_LIT:2> ) <EOL> def _entropy ( self ) : <EOL> return log ( <NUM_LIT:4> * pi ) - <NUM_LIT:1.0> <EOL> cosine = cosine_gen ( a = - pi , b = pi , name = '<STR_LIT>' ) <EOL> class dgamma_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _rvs ( self , a ) : <EOL> sz , rndm = self . _size , self . _random_state <EOL> u = rndm . random_sample ( size = sz ) <EOL> gm = gamma . rvs ( a , size = sz , random_state = rndm ) <EOL> return gm * where ( u >= <NUM_LIT:0.5> , <NUM_LIT:1> , - <NUM_LIT:1> ) <EOL> def _pdf ( self , x , a ) : <EOL> ax = abs ( x ) <EOL> return <NUM_LIT:1.0> / ( <NUM_LIT:2> * special . gamma ( a ) ) * ax ** ( a - <NUM_LIT:1.0> ) * exp ( - ax ) <EOL> def _logpdf ( self , x , a ) : <EOL> ax = abs ( x ) <EOL> return special . xlogy ( a - <NUM_LIT:1.0> , ax ) - ax - log ( <NUM_LIT:2> ) - gamln ( a ) <EOL> def _cdf ( self , x , a ) : <EOL> fac = <NUM_LIT:0.5> * special . gammainc ( a , abs ( x ) ) <EOL> return where ( x > <NUM_LIT:0> , <NUM_LIT:0.5> + fac , <NUM_LIT:0.5> - fac ) <EOL> def _sf ( self , x , a ) : <EOL> fac = <NUM_LIT:0.5> * special . gammainc ( a , abs ( x ) ) <EOL> return where ( x > <NUM_LIT:0> , <NUM_LIT:0.5> - fac , <NUM_LIT:0.5> + fac ) <EOL> def _ppf ( self , q , a ) : <EOL> fac = special . gammainccinv ( a , <NUM_LIT:1> - abs ( <NUM_LIT:2> * q - <NUM_LIT:1> ) ) <EOL> return where ( q > <NUM_LIT:0.5> , fac , - fac ) <EOL> def _stats ( self , a ) : <EOL> mu2 = a * ( a + <NUM_LIT:1.0> ) <EOL> return <NUM_LIT:0.0> , mu2 , <NUM_LIT:0.0> , ( a + <NUM_LIT> ) * ( a + <NUM_LIT> ) / mu2 - <NUM_LIT> <EOL> dgamma = dgamma_gen ( name = '<STR_LIT>' ) <EOL> class dweibull_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _rvs ( self , c ) : <EOL> sz , rndm = self . _size , self . _random_state <EOL> u = rndm . random_sample ( size = sz ) <EOL> w = weibull_min . rvs ( c , size = sz , random_state = rndm ) <EOL> return w * ( where ( u >= <NUM_LIT:0.5> , <NUM_LIT:1> , - <NUM_LIT:1> ) ) <EOL> def _pdf ( self , x , c ) : <EOL> ax = abs ( x ) <EOL> Px = c / <NUM_LIT> * ax ** ( c - <NUM_LIT:1.0> ) * exp ( - ax ** c ) <EOL> return Px <EOL> def _logpdf ( self , x , c ) : <EOL> ax = abs ( x ) <EOL> return log ( c ) - log ( <NUM_LIT> ) + special . xlogy ( c - <NUM_LIT:1.0> , ax ) - ax ** c <EOL> def _cdf ( self , x , c ) : <EOL> Cx1 = <NUM_LIT:0.5> * exp ( - abs ( x ) ** c ) <EOL> return where ( x > <NUM_LIT:0> , <NUM_LIT:1> - Cx1 , Cx1 ) <EOL> def _ppf ( self , q , c ) : <EOL> fac = <NUM_LIT> * where ( q <= <NUM_LIT:0.5> , q , <NUM_LIT:1.> - q ) <EOL> fac = np . power ( - log ( fac ) , <NUM_LIT:1.0> / c ) <EOL> return where ( q > <NUM_LIT:0.5> , fac , - fac ) <EOL> def _munp ( self , n , c ) : <EOL> return ( <NUM_LIT:1> - ( n % <NUM_LIT:2> ) ) * special . gamma ( <NUM_LIT:1.0> + <NUM_LIT:1.0> * n / c ) <EOL> def _stats ( self , c ) : <EOL> return <NUM_LIT:0> , None , <NUM_LIT:0> , None <EOL> dweibull = dweibull_gen ( name = '<STR_LIT>' ) <EOL> class expon_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _rvs ( self ) : <EOL> return self . _random_state . standard_exponential ( self . _size ) <EOL> def _pdf ( self , x ) : <EOL> return exp ( - x ) <EOL> def _logpdf ( self , x ) : <EOL> return - x <EOL> def _cdf ( self , x ) : <EOL> return - special . expm1 ( - x ) <EOL> def _ppf ( self , q ) : <EOL> return - special . log1p ( - q ) <EOL> def _sf ( self , x ) : <EOL> return exp ( - x ) <EOL> def _logsf ( self , x ) : <EOL> return - x <EOL> def _isf ( self , q ) : <EOL> return - log ( q ) <EOL> def _stats ( self ) : <EOL> return <NUM_LIT:1.0> , <NUM_LIT:1.0> , <NUM_LIT> , <NUM_LIT> <EOL> def _entropy ( self ) : <EOL> return <NUM_LIT:1.0> <EOL> expon = expon_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class exponnorm_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _rvs ( self , K ) : <EOL> expval = self . _random_state . standard_exponential ( self . _size ) * K <EOL> gval = self . _random_state . standard_normal ( self . _size ) <EOL> return expval + gval <EOL> def _pdf ( self , x , K ) : <EOL> invK = <NUM_LIT:1.0> / K <EOL> exparg = <NUM_LIT:0.5> * invK ** <NUM_LIT:2> - invK * x <EOL> expval = _lazywhere ( exparg < _LOGXMAX , ( exparg , ) , exp , _XMAX ) <EOL> return <NUM_LIT:0.5> * invK * expval * erfc ( - ( x - invK ) / sqrt ( <NUM_LIT:2> ) ) <EOL> def _logpdf ( self , x , K ) : <EOL> invK = <NUM_LIT:1.0> / K <EOL> exparg = <NUM_LIT:0.5> * invK ** <NUM_LIT:2> - invK * x <EOL> return exparg + log ( <NUM_LIT:0.5> * invK * erfc ( - ( x - invK ) / sqrt ( <NUM_LIT:2> ) ) ) <EOL> def _cdf ( self , x , K ) : <EOL> invK = <NUM_LIT:1.0> / K <EOL> expval = invK * ( <NUM_LIT:0.5> * invK - x ) <EOL> return _norm_cdf ( x ) - exp ( expval ) * _norm_cdf ( x - invK ) <EOL> def _sf ( self , x , K ) : <EOL> invK = <NUM_LIT:1.0> / K <EOL> expval = invK * ( <NUM_LIT:0.5> * invK - x ) <EOL> return _norm_cdf ( - x ) + exp ( expval ) * _norm_cdf ( x - invK ) <EOL> def _stats ( self , K ) : <EOL> K2 = K * K <EOL> opK2 = <NUM_LIT:1.0> + K2 <EOL> skw = <NUM_LIT:2> * K ** <NUM_LIT:3> * opK2 ** ( - <NUM_LIT> ) <EOL> krt = <NUM_LIT> * K2 * K2 * opK2 ** ( - <NUM_LIT:2> ) <EOL> return K , opK2 , skw , krt <EOL> exponnorm = exponnorm_gen ( name = '<STR_LIT>' ) <EOL> class exponweib_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x , a , c ) : <EOL> return exp ( self . _logpdf ( x , a , c ) ) <EOL> def _logpdf ( self , x , a , c ) : <EOL> negxc = - x ** c <EOL> exm1c = - special . expm1 ( negxc ) <EOL> logp = ( log ( a ) + log ( c ) + special . xlogy ( a - <NUM_LIT:1.0> , exm1c ) + <EOL> negxc + special . xlogy ( c - <NUM_LIT:1.0> , x ) ) <EOL> return logp <EOL> def _cdf ( self , x , a , c ) : <EOL> exm1c = - special . expm1 ( - x ** c ) <EOL> return exm1c ** a <EOL> def _ppf ( self , q , a , c ) : <EOL> return ( - special . log1p ( - q ** ( <NUM_LIT:1.0> / a ) ) ) ** asarray ( <NUM_LIT:1.0> / c ) <EOL> exponweib = exponweib_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class exponpow_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x , b ) : <EOL> return exp ( self . _logpdf ( x , b ) ) <EOL> def _logpdf ( self , x , b ) : <EOL> xb = x ** b <EOL> f = <NUM_LIT:1> + log ( b ) + special . xlogy ( b - <NUM_LIT:1.0> , x ) + xb - exp ( xb ) <EOL> return f <EOL> def _cdf ( self , x , b ) : <EOL> return - special . expm1 ( - special . expm1 ( x ** b ) ) <EOL> def _sf ( self , x , b ) : <EOL> return exp ( - special . expm1 ( x ** b ) ) <EOL> def _isf ( self , x , b ) : <EOL> return ( special . log1p ( - log ( x ) ) ) ** ( <NUM_LIT:1.> / b ) <EOL> def _ppf ( self , q , b ) : <EOL> return pow ( special . log1p ( - special . log1p ( - q ) ) , <NUM_LIT:1.0> / b ) <EOL> exponpow = exponpow_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class fatiguelife_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _rvs ( self , c ) : <EOL> z = self . _random_state . standard_normal ( self . _size ) <EOL> x = <NUM_LIT:0.5> * c * z <EOL> x2 = x * x <EOL> t = <NUM_LIT:1.0> + <NUM_LIT:2> * x2 + <NUM_LIT:2> * x * sqrt ( <NUM_LIT:1> + x2 ) <EOL> return t <EOL> def _pdf ( self , x , c ) : <EOL> return np . exp ( self . _logpdf ( x , c ) ) <EOL> def _logpdf ( self , x , c ) : <EOL> return ( log ( x + <NUM_LIT:1> ) - ( x - <NUM_LIT:1> ) ** <NUM_LIT:2> / ( <NUM_LIT> * x * c ** <NUM_LIT:2> ) - log ( <NUM_LIT:2> * c ) - <EOL> <NUM_LIT:0.5> * ( log ( <NUM_LIT:2> * pi ) + <NUM_LIT:3> * log ( x ) ) ) <EOL> def _cdf ( self , x , c ) : <EOL> return _norm_cdf ( <NUM_LIT:1.0> / c * ( sqrt ( x ) - <NUM_LIT:1.0> / sqrt ( x ) ) ) <EOL> def _ppf ( self , q , c ) : <EOL> tmp = c * special . ndtri ( q ) <EOL> return <NUM_LIT> * ( tmp + sqrt ( tmp ** <NUM_LIT:2> + <NUM_LIT:4> ) ) ** <NUM_LIT:2> <EOL> def _stats ( self , c ) : <EOL> c2 = c * c <EOL> mu = c2 / <NUM_LIT> + <NUM_LIT:1.0> <EOL> den = <NUM_LIT> * c2 + <NUM_LIT> <EOL> mu2 = c2 * den / <NUM_LIT> <EOL> g1 = <NUM_LIT:4> * c * ( <NUM_LIT:11> * c2 + <NUM_LIT> ) / np . power ( den , <NUM_LIT> ) <EOL> g2 = <NUM_LIT:6> * c2 * ( <NUM_LIT> * c2 + <NUM_LIT> ) / den ** <NUM_LIT> <EOL> return mu , mu2 , g1 , g2 <EOL> fatiguelife = fatiguelife_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class foldcauchy_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _rvs ( self , c ) : <EOL> return abs ( cauchy . rvs ( loc = c , size = self . _size , <EOL> random_state = self . _random_state ) ) <EOL> def _pdf ( self , x , c ) : <EOL> return <NUM_LIT:1.0> / pi * ( <NUM_LIT:1.0> / ( <NUM_LIT:1> + ( x - c ) ** <NUM_LIT:2> ) + <NUM_LIT:1.0> / ( <NUM_LIT:1> + ( x + c ) ** <NUM_LIT:2> ) ) <EOL> def _cdf ( self , x , c ) : <EOL> return <NUM_LIT:1.0> / pi * ( arctan ( x - c ) + arctan ( x + c ) ) <EOL> def _stats ( self , c ) : <EOL> return inf , inf , nan , nan <EOL> foldcauchy = foldcauchy_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class f_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _rvs ( self , dfn , dfd ) : <EOL> return self . _random_state . f ( dfn , dfd , self . _size ) <EOL> def _pdf ( self , x , dfn , dfd ) : <EOL> return exp ( self . _logpdf ( x , dfn , dfd ) ) <EOL> def _logpdf ( self , x , dfn , dfd ) : <EOL> n = <NUM_LIT:1.0> * dfn <EOL> m = <NUM_LIT:1.0> * dfd <EOL> lPx = m / <NUM_LIT:2> * log ( m ) + n / <NUM_LIT:2> * log ( n ) + ( n / <NUM_LIT:2> - <NUM_LIT:1> ) * log ( x ) <EOL> lPx -= ( ( n + m ) / <NUM_LIT:2> ) * log ( m + n * x ) + special . betaln ( n / <NUM_LIT:2> , m / <NUM_LIT:2> ) <EOL> return lPx <EOL> def _cdf ( self , x , dfn , dfd ) : <EOL> return special . fdtr ( dfn , dfd , x ) <EOL> def _sf ( self , x , dfn , dfd ) : <EOL> return special . fdtrc ( dfn , dfd , x ) <EOL> def _ppf ( self , q , dfn , dfd ) : <EOL> return special . fdtri ( dfn , dfd , q ) <EOL> def _stats ( self , dfn , dfd ) : <EOL> v1 , v2 = <NUM_LIT:1.> * dfn , <NUM_LIT:1.> * dfd <EOL> v2_2 , v2_4 , v2_6 , v2_8 = v2 - <NUM_LIT> , v2 - <NUM_LIT> , v2 - <NUM_LIT> , v2 - <NUM_LIT> <EOL> mu = _lazywhere ( <EOL> v2 > <NUM_LIT:2> , ( v2 , v2_2 ) , <EOL> lambda v2 , v2_2 : v2 / v2_2 , <EOL> np . inf ) <EOL> mu2 = _lazywhere ( <EOL> v2 > <NUM_LIT:4> , ( v1 , v2 , v2_2 , v2_4 ) , <EOL> lambda v1 , v2 , v2_2 , v2_4 : <EOL> <NUM_LIT:2> * v2 * v2 * ( v1 + v2_2 ) / ( v1 * v2_2 ** <NUM_LIT:2> * v2_4 ) , <EOL> np . inf ) <EOL> g1 = _lazywhere ( <EOL> v2 > <NUM_LIT:6> , ( v1 , v2_2 , v2_4 , v2_6 ) , <EOL> lambda v1 , v2_2 , v2_4 , v2_6 : <EOL> ( <NUM_LIT:2> * v1 + v2_2 ) / v2_6 * sqrt ( v2_4 / ( v1 * ( v1 + v2_2 ) ) ) , <EOL> np . nan ) <EOL> g1 *= np . sqrt ( <NUM_LIT> ) <EOL> g2 = _lazywhere ( <EOL> v2 > <NUM_LIT:8> , ( g1 , v2_6 , v2_8 ) , <EOL> lambda g1 , v2_6 , v2_8 : ( <NUM_LIT:8> + g1 * g1 * v2_6 ) / v2_8 , <EOL> np . nan ) <EOL> g2 *= <NUM_LIT> / <NUM_LIT> <EOL> return mu , mu2 , g1 , g2 <EOL> f = f_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT:f>' ) <EOL> class foldnorm_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _argcheck ( self , c ) : <EOL> return ( c >= <NUM_LIT:0> ) <EOL> def _rvs ( self , c ) : <EOL> return abs ( self . _random_state . standard_normal ( self . _size ) + c ) <EOL> def _pdf ( self , x , c ) : <EOL> return _norm_pdf ( x + c ) + _norm_pdf ( x - c ) <EOL> def _cdf ( self , x , c ) : <EOL> return _norm_cdf ( x - c ) + _norm_cdf ( x + c ) - <NUM_LIT:1.0> <EOL> def _stats ( self , c ) : <EOL> c2 = c * c <EOL> expfac = np . exp ( - <NUM_LIT:0.5> * c2 ) / np . sqrt ( <NUM_LIT> * pi ) <EOL> mu = <NUM_LIT> * expfac + c * special . erf ( c / sqrt ( <NUM_LIT:2> ) ) <EOL> mu2 = c2 + <NUM_LIT:1> - mu * mu <EOL> g1 = <NUM_LIT> * ( mu * mu * mu - c2 * mu - expfac ) <EOL> g1 /= np . power ( mu2 , <NUM_LIT> ) <EOL> g2 = c2 * ( c2 + <NUM_LIT> ) + <NUM_LIT:3> + <NUM_LIT> * expfac * mu <EOL> g2 += ( <NUM_LIT> * ( c2 - <NUM_LIT> ) - <NUM_LIT> * mu ** <NUM_LIT:2> ) * mu ** <NUM_LIT:2> <EOL> g2 = g2 / mu2 ** <NUM_LIT> - <NUM_LIT> <EOL> return mu , mu2 , g1 , g2 <EOL> foldnorm = foldnorm_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class frechet_r_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x , c ) : <EOL> return c * pow ( x , c - <NUM_LIT:1> ) * exp ( - pow ( x , c ) ) <EOL> def _logpdf ( self , x , c ) : <EOL> return log ( c ) + ( c - <NUM_LIT:1> ) * log ( x ) - pow ( x , c ) <EOL> def _cdf ( self , x , c ) : <EOL> return - special . expm1 ( - pow ( x , c ) ) <EOL> def _ppf ( self , q , c ) : <EOL> return pow ( - special . log1p ( - q ) , <NUM_LIT:1.0> / c ) <EOL> def _munp ( self , n , c ) : <EOL> return special . gamma ( <NUM_LIT:1.0> + n * <NUM_LIT:1.0> / c ) <EOL> def _entropy ( self , c ) : <EOL> return - _EULER / c - log ( c ) + _EULER + <NUM_LIT:1> <EOL> frechet_r = frechet_r_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> weibull_min = frechet_r_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class frechet_l_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x , c ) : <EOL> return c * pow ( - x , c - <NUM_LIT:1> ) * exp ( - pow ( - x , c ) ) <EOL> def _cdf ( self , x , c ) : <EOL> return exp ( - pow ( - x , c ) ) <EOL> def _ppf ( self , q , c ) : <EOL> return - pow ( - log ( q ) , <NUM_LIT:1.0> / c ) <EOL> def _munp ( self , n , c ) : <EOL> val = special . gamma ( <NUM_LIT:1.0> + n * <NUM_LIT:1.0> / c ) <EOL> if ( int ( n ) % <NUM_LIT:2> ) : <EOL> sgn = - <NUM_LIT:1> <EOL> else : <EOL> sgn = <NUM_LIT:1> <EOL> return sgn * val <EOL> def _entropy ( self , c ) : <EOL> return - _EULER / c - log ( c ) + _EULER + <NUM_LIT:1> <EOL> frechet_l = frechet_l_gen ( b = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> weibull_max = frechet_l_gen ( b = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class genlogistic_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x , c ) : <EOL> return exp ( self . _logpdf ( x , c ) ) <EOL> def _logpdf ( self , x , c ) : <EOL> return log ( c ) - x - ( c + <NUM_LIT:1.0> ) * special . log1p ( exp ( - x ) ) <EOL> def _cdf ( self , x , c ) : <EOL> Cx = ( <NUM_LIT:1> + exp ( - x ) ) ** ( - c ) <EOL> return Cx <EOL> def _ppf ( self , q , c ) : <EOL> vals = - log ( pow ( q , - <NUM_LIT:1.0> / c ) - <NUM_LIT:1> ) <EOL> return vals <EOL> def _stats ( self , c ) : <EOL> zeta = special . zeta <EOL> mu = _EULER + special . psi ( c ) <EOL> mu2 = pi * pi / <NUM_LIT> + zeta ( <NUM_LIT:2> , c ) <EOL> g1 = - <NUM_LIT:2> * zeta ( <NUM_LIT:3> , c ) + <NUM_LIT:2> * _ZETA3 <EOL> g1 /= np . power ( mu2 , <NUM_LIT> ) <EOL> g2 = pi ** <NUM_LIT:4> / <NUM_LIT> + <NUM_LIT:6> * zeta ( <NUM_LIT:4> , c ) <EOL> g2 /= mu2 ** <NUM_LIT> <EOL> return mu , mu2 , g1 , g2 <EOL> genlogistic = genlogistic_gen ( name = '<STR_LIT>' ) <EOL> class genpareto_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _argcheck ( self , c ) : <EOL> c = asarray ( c ) <EOL> self . b = _lazywhere ( c < <NUM_LIT:0> , ( c , ) , <EOL> lambda c : - <NUM_LIT:1.> / c , np . inf ) <EOL> return True <EOL> def _pdf ( self , x , c ) : <EOL> return np . exp ( self . _logpdf ( x , c ) ) <EOL> def _logpdf ( self , x , c ) : <EOL> return _lazywhere ( ( x == x ) & ( c != <NUM_LIT:0> ) , ( x , c ) , <EOL> lambda x , c : - special . xlog1py ( c + <NUM_LIT:1.> , c * x ) / c , <EOL> - x ) <EOL> def _cdf ( self , x , c ) : <EOL> return - inv_boxcox1p ( - x , - c ) <EOL> def _sf ( self , x , c ) : <EOL> return inv_boxcox ( - x , - c ) <EOL> def _logsf ( self , x , c ) : <EOL> return _lazywhere ( ( x == x ) & ( c != <NUM_LIT:0> ) , ( x , c ) , <EOL> lambda x , c : - special . log1p ( c * x ) / c , <EOL> - x ) <EOL> def _ppf ( self , q , c ) : <EOL> return - boxcox1p ( - q , - c ) <EOL> def _isf ( self , q , c ) : <EOL> return - boxcox ( q , - c ) <EOL> def _munp ( self , n , c ) : <EOL> def __munp ( n , c ) : <EOL> val = <NUM_LIT:0.0> <EOL> k = arange ( <NUM_LIT:0> , n + <NUM_LIT:1> ) <EOL> for ki , cnk in zip ( k , comb ( n , k ) ) : <EOL> val = val + cnk * ( - <NUM_LIT:1> ) ** ki / ( <NUM_LIT:1.0> - c * ki ) <EOL> return where ( c * n < <NUM_LIT:1> , val * ( - <NUM_LIT:1.0> / c ) ** n , inf ) <EOL> return _lazywhere ( c != <NUM_LIT:0> , ( c , ) , <EOL> lambda c : __munp ( n , c ) , <EOL> gam ( n + <NUM_LIT:1> ) ) <EOL> def _entropy ( self , c ) : <EOL> return <NUM_LIT:1.> + c <EOL> genpareto = genpareto_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class genexpon_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x , a , b , c ) : <EOL> return ( a + b * ( - special . expm1 ( - c * x ) ) ) * exp ( ( - a - b ) * x + <EOL> b * ( - special . expm1 ( - c * x ) ) / c ) <EOL> def _cdf ( self , x , a , b , c ) : <EOL> return - special . expm1 ( ( - a - b ) * x + b * ( - special . expm1 ( - c * x ) ) / c ) <EOL> def _logpdf ( self , x , a , b , c ) : <EOL> return np . log ( a + b * ( - special . expm1 ( - c * x ) ) ) + ( - a - b ) * x + b * ( - special . expm1 ( - c * x ) ) / c <EOL> genexpon = genexpon_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class genextreme_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _argcheck ( self , c ) : <EOL> min = np . minimum <EOL> max = np . maximum <EOL> self . b = where ( c > <NUM_LIT:0> , <NUM_LIT:1.0> / max ( c , _XMIN ) , inf ) <EOL> self . a = where ( c < <NUM_LIT:0> , <NUM_LIT:1.0> / min ( c , - _XMIN ) , - inf ) <EOL> return where ( abs ( c ) == inf , <NUM_LIT:0> , <NUM_LIT:1> ) <EOL> def _pdf ( self , x , c ) : <EOL> cx = c * x <EOL> logex2 = where ( ( c == <NUM_LIT:0> ) * ( x == x ) , <NUM_LIT:0.0> , special . log1p ( - cx ) ) <EOL> logpex2 = where ( ( c == <NUM_LIT:0> ) * ( x == x ) , - x , logex2 / c ) <EOL> pex2 = exp ( logpex2 ) <EOL> logpdf = where ( ( cx == <NUM_LIT:1> ) | ( cx == - inf ) , - inf , - pex2 + logpex2 - logex2 ) <EOL> putmask ( logpdf , ( c == <NUM_LIT:1> ) & ( x == <NUM_LIT:1> ) , <NUM_LIT:0.0> ) <EOL> return exp ( logpdf ) <EOL> def _cdf ( self , x , c ) : <EOL> loglogcdf = where ( ( c == <NUM_LIT:0> ) * ( x == x ) , - x , special . log1p ( - c * x ) / c ) <EOL> return exp ( - exp ( loglogcdf ) ) <EOL> def _ppf ( self , q , c ) : <EOL> x = - log ( - log ( q ) ) <EOL> return where ( ( c == <NUM_LIT:0> ) * ( x == x ) , x , - special . expm1 ( - c * x ) / c ) <EOL> def _stats ( self , c ) : <EOL> g = lambda n : gam ( n * c + <NUM_LIT:1> ) <EOL> g1 = g ( <NUM_LIT:1> ) <EOL> g2 = g ( <NUM_LIT:2> ) <EOL> g3 = g ( <NUM_LIT:3> ) <EOL> g4 = g ( <NUM_LIT:4> ) <EOL> g2mg12 = where ( abs ( c ) < <NUM_LIT> , ( c * pi ) ** <NUM_LIT> / <NUM_LIT> , g2 - g1 ** <NUM_LIT> ) <EOL> gam2k = where ( abs ( c ) < <NUM_LIT> , pi ** <NUM_LIT> / <NUM_LIT> , <EOL> special . expm1 ( gamln ( <NUM_LIT> * c + <NUM_LIT:1.0> ) - <NUM_LIT:2> * gamln ( c + <NUM_LIT:1.0> ) ) / c ** <NUM_LIT> ) <EOL> eps = <NUM_LIT> <EOL> gamk = where ( abs ( c ) < eps , - _EULER , special . expm1 ( gamln ( c + <NUM_LIT:1> ) ) / c ) <EOL> m = where ( c < - <NUM_LIT:1.0> , nan , - gamk ) <EOL> v = where ( c < - <NUM_LIT:0.5> , nan , g1 ** <NUM_LIT> * gam2k ) <EOL> sk1 = where ( c < - <NUM_LIT:1.> / <NUM_LIT:3> , nan , <EOL> np . sign ( c ) * ( - g3 + ( g2 + <NUM_LIT:2> * g2mg12 ) * g1 ) / ( ( g2mg12 ) ** ( <NUM_LIT> / <NUM_LIT> ) ) ) <EOL> sk = where ( abs ( c ) <= eps ** <NUM_LIT> , <NUM_LIT:12> * sqrt ( <NUM_LIT:6> ) * _ZETA3 / pi ** <NUM_LIT:3> , sk1 ) <EOL> ku1 = where ( c < - <NUM_LIT:1.> / <NUM_LIT:4> , nan , <EOL> ( g4 + ( - <NUM_LIT:4> * g3 + <NUM_LIT:3> * ( g2 + g2mg12 ) * g1 ) * g1 ) / ( ( g2mg12 ) ** <NUM_LIT:2> ) ) <EOL> ku = where ( abs ( c ) <= ( eps ) ** <NUM_LIT> , <NUM_LIT> / <NUM_LIT> , ku1 - <NUM_LIT> ) <EOL> return m , v , sk , ku <EOL> def _fitstart ( self , data ) : <EOL> g = _skew ( data ) <EOL> if g < <NUM_LIT:0> : <EOL> a = <NUM_LIT:0.5> <EOL> else : <EOL> a = - <NUM_LIT:0.5> <EOL> return super ( genextreme_gen , self ) . _fitstart ( data , args = ( a , ) ) <EOL> def _munp ( self , n , c ) : <EOL> k = arange ( <NUM_LIT:0> , n + <NUM_LIT:1> ) <EOL> vals = <NUM_LIT:1.0> / c ** n * np . sum ( <EOL> comb ( n , k ) * ( - <NUM_LIT:1> ) ** k * special . gamma ( c * k + <NUM_LIT:1> ) , <EOL> axis = <NUM_LIT:0> ) <EOL> return where ( c * n > - <NUM_LIT:1> , vals , inf ) <EOL> def _entropy ( self , c ) : <EOL> return _EULER * ( <NUM_LIT:1> - c ) + <NUM_LIT:1> <EOL> genextreme = genextreme_gen ( name = '<STR_LIT>' ) <EOL> def _digammainv ( y ) : <EOL> _em = <NUM_LIT> <EOL> func = lambda x : special . digamma ( x ) - y <EOL> if y > - <NUM_LIT> : <EOL> x0 = exp ( y ) + <NUM_LIT:0.5> <EOL> if y < <NUM_LIT:10> : <EOL> value = optimize . newton ( func , x0 , tol = <NUM_LIT> ) <EOL> return value <EOL> elif y > - <NUM_LIT:3> : <EOL> x0 = exp ( y / <NUM_LIT> ) + <NUM_LIT> <EOL> else : <EOL> x0 = <NUM_LIT:1.0> / ( - y - _em ) <EOL> value , info , ier , mesg = optimize . fsolve ( func , x0 , xtol = <NUM_LIT> , <EOL> full_output = True ) <EOL> if ier != <NUM_LIT:1> : <EOL> raise RuntimeError ( "<STR_LIT>" % y ) <EOL> return value [ <NUM_LIT:0> ] <EOL> class gamma_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _rvs ( self , a ) : <EOL> return self . _random_state . standard_gamma ( a , self . _size ) <EOL> def _pdf ( self , x , a ) : <EOL> return exp ( self . _logpdf ( x , a ) ) <EOL> def _logpdf ( self , x , a ) : <EOL> return special . xlogy ( a - <NUM_LIT:1.0> , x ) - x - gamln ( a ) <EOL> def _cdf ( self , x , a ) : <EOL> return special . gammainc ( a , x ) <EOL> def _sf ( self , x , a ) : <EOL> return special . gammaincc ( a , x ) <EOL> def _ppf ( self , q , a ) : <EOL> return special . gammaincinv ( a , q ) <EOL> def _stats ( self , a ) : <EOL> return a , a , <NUM_LIT> / sqrt ( a ) , <NUM_LIT> / a <EOL> def _entropy ( self , a ) : <EOL> return special . psi ( a ) * ( <NUM_LIT:1> - a ) + a + gamln ( a ) <EOL> def _fitstart ( self , data ) : <EOL> a = <NUM_LIT:4> / ( <NUM_LIT> + _skew ( data ) ** <NUM_LIT:2> ) <EOL> return super ( gamma_gen , self ) . _fitstart ( data , args = ( a , ) ) <EOL> @ inherit_docstring_from ( rv_continuous ) <EOL> def fit ( self , data , * args , ** kwds ) : <EOL> f0 = ( kwds . get ( '<STR_LIT>' , None ) or kwds . get ( '<STR_LIT>' , None ) or <EOL> kwds . get ( '<STR_LIT>' , None ) ) <EOL> floc = kwds . get ( '<STR_LIT>' , None ) <EOL> fscale = kwds . get ( '<STR_LIT>' , None ) <EOL> if floc is None : <EOL> return super ( gamma_gen , self ) . fit ( data , * args , ** kwds ) <EOL> if f0 is not None and fscale is not None : <EOL> raise ValueError ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> data = np . asarray ( data ) <EOL> if np . any ( data <= floc ) : <EOL> raise FitDataError ( "<STR_LIT>" , lower = floc , upper = np . inf ) <EOL> if floc != <NUM_LIT:0> : <EOL> data = data - floc <EOL> xbar = data . mean ( ) <EOL> if fscale is None : <EOL> if f0 is not None : <EOL> a = f0 <EOL> else : <EOL> s = log ( xbar ) - log ( data ) . mean ( ) <EOL> func = lambda a : log ( a ) - special . digamma ( a ) - s <EOL> aest = ( <NUM_LIT:3> - s + np . sqrt ( ( s - <NUM_LIT:3> ) ** <NUM_LIT:2> + <NUM_LIT> * s ) ) / ( <NUM_LIT:12> * s ) <EOL> xa = aest * ( <NUM_LIT:1> - <NUM_LIT> ) <EOL> xb = aest * ( <NUM_LIT:1> + <NUM_LIT> ) <EOL> a = optimize . brentq ( func , xa , xb , disp = <NUM_LIT:0> ) <EOL> scale = xbar / a <EOL> else : <EOL> c = log ( data ) . mean ( ) - log ( fscale ) <EOL> a = _digammainv ( c ) <EOL> scale = fscale <EOL> return a , floc , scale <EOL> gamma = gamma_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class erlang_gen ( gamma_gen ) : <EOL> """<STR_LIT>""" <EOL> def _argcheck ( self , a ) : <EOL> allint = np . all ( np . floor ( a ) == a ) <EOL> allpos = np . all ( a > <NUM_LIT:0> ) <EOL> if not allint : <EOL> warnings . warn ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' % ( a , ) , <EOL> RuntimeWarning ) <EOL> return allpos <EOL> def _fitstart ( self , data ) : <EOL> a = int ( <NUM_LIT> / ( <NUM_LIT> + _skew ( data ) ** <NUM_LIT:2> ) ) <EOL> return super ( gamma_gen , self ) . _fitstart ( data , args = ( a , ) ) <EOL> def fit ( self , data , * args , ** kwds ) : <EOL> return super ( erlang_gen , self ) . fit ( data , * args , ** kwds ) <EOL> if fit . __doc__ is not None : <EOL> fit . __doc__ = ( rv_continuous . fit . __doc__ + <EOL> """<STR_LIT>""" ) <EOL> erlang = erlang_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class gengamma_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _argcheck ( self , a , c ) : <EOL> return ( a > <NUM_LIT:0> ) & ( c != <NUM_LIT:0> ) <EOL> def _pdf ( self , x , a , c ) : <EOL> return np . exp ( self . _logpdf ( x , a , c ) ) <EOL> def _logpdf ( self , x , a , c ) : <EOL> return np . log ( abs ( c ) ) + special . xlogy ( c * a - <NUM_LIT:1> , x ) - x ** c - special . gammaln ( a ) <EOL> def _cdf ( self , x , a , c ) : <EOL> xc = x ** c <EOL> val1 = special . gammainc ( a , xc ) <EOL> val2 = special . gammaincc ( a , xc ) <EOL> return np . where ( c > <NUM_LIT:0> , val1 , val2 ) <EOL> def _sf ( self , x , a , c ) : <EOL> xc = x ** c <EOL> val1 = special . gammainc ( a , xc ) <EOL> val2 = special . gammaincc ( a , xc ) <EOL> return np . where ( c > <NUM_LIT:0> , val2 , val1 ) <EOL> def _ppf ( self , q , a , c ) : <EOL> val1 = special . gammaincinv ( a , q ) <EOL> val2 = special . gammainccinv ( a , q ) <EOL> return np . where ( c > <NUM_LIT:0> , val1 , val2 ) ** ( <NUM_LIT:1.0> / c ) <EOL> def _isf ( self , q , a , c ) : <EOL> val1 = special . gammaincinv ( a , q ) <EOL> val2 = special . gammainccinv ( a , q ) <EOL> return np . where ( c > <NUM_LIT:0> , val2 , val1 ) ** ( <NUM_LIT:1.0> / c ) <EOL> def _munp ( self , n , a , c ) : <EOL> return special . poch ( a , n * <NUM_LIT:1.0> / c ) <EOL> def _entropy ( self , a , c ) : <EOL> val = special . psi ( a ) <EOL> return a * ( <NUM_LIT:1> - val ) + <NUM_LIT:1.0> / c * val + special . gammaln ( a ) - np . log ( abs ( c ) ) <EOL> gengamma = gengamma_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class genhalflogistic_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _argcheck ( self , c ) : <EOL> self . b = <NUM_LIT:1.0> / c <EOL> return ( c > <NUM_LIT:0> ) <EOL> def _pdf ( self , x , c ) : <EOL> limit = <NUM_LIT:1.0> / c <EOL> tmp = asarray ( <NUM_LIT:1> - c * x ) <EOL> tmp0 = tmp ** ( limit - <NUM_LIT:1> ) <EOL> tmp2 = tmp0 * tmp <EOL> return <NUM_LIT:2> * tmp0 / ( <NUM_LIT:1> + tmp2 ) ** <NUM_LIT:2> <EOL> def _cdf ( self , x , c ) : <EOL> limit = <NUM_LIT:1.0> / c <EOL> tmp = asarray ( <NUM_LIT:1> - c * x ) <EOL> tmp2 = tmp ** ( limit ) <EOL> return ( <NUM_LIT:1.0> - tmp2 ) / ( <NUM_LIT:1> + tmp2 ) <EOL> def _ppf ( self , q , c ) : <EOL> return <NUM_LIT:1.0> / c * ( <NUM_LIT:1> - ( ( <NUM_LIT:1.0> - q ) / ( <NUM_LIT:1.0> + q ) ) ** c ) <EOL> def _entropy ( self , c ) : <EOL> return <NUM_LIT:2> - ( <NUM_LIT:2> * c + <NUM_LIT:1> ) * log ( <NUM_LIT:2> ) <EOL> genhalflogistic = genhalflogistic_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class gompertz_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x , c ) : <EOL> return exp ( self . _logpdf ( x , c ) ) <EOL> def _logpdf ( self , x , c ) : <EOL> return log ( c ) + x - c * special . expm1 ( x ) <EOL> def _cdf ( self , x , c ) : <EOL> return - special . expm1 ( - c * special . expm1 ( x ) ) <EOL> def _ppf ( self , q , c ) : <EOL> return special . log1p ( - <NUM_LIT:1.0> / c * special . log1p ( - q ) ) <EOL> def _entropy ( self , c ) : <EOL> return <NUM_LIT:1.0> - log ( c ) - exp ( c ) * special . expn ( <NUM_LIT:1> , c ) <EOL> gompertz = gompertz_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class gumbel_r_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x ) : <EOL> return exp ( self . _logpdf ( x ) ) <EOL> def _logpdf ( self , x ) : <EOL> return - x - exp ( - x ) <EOL> def _cdf ( self , x ) : <EOL> return exp ( - exp ( - x ) ) <EOL> def _logcdf ( self , x ) : <EOL> return - exp ( - x ) <EOL> def _ppf ( self , q ) : <EOL> return - log ( - log ( q ) ) <EOL> def _stats ( self ) : <EOL> return _EULER , pi * pi / <NUM_LIT> , <NUM_LIT:12> * sqrt ( <NUM_LIT:6> ) / pi ** <NUM_LIT:3> * _ZETA3 , <NUM_LIT> / <NUM_LIT:5> <EOL> def _entropy ( self ) : <EOL> return _EULER + <NUM_LIT:1.> <EOL> gumbel_r = gumbel_r_gen ( name = '<STR_LIT>' ) <EOL> class gumbel_l_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x ) : <EOL> return exp ( self . _logpdf ( x ) ) <EOL> def _logpdf ( self , x ) : <EOL> return x - exp ( x ) <EOL> def _cdf ( self , x ) : <EOL> return <NUM_LIT:1.0> - exp ( - exp ( x ) ) <EOL> def _ppf ( self , q ) : <EOL> return log ( - log ( <NUM_LIT:1> - q ) ) <EOL> def _stats ( self ) : <EOL> return - _EULER , pi * pi / <NUM_LIT> , - <NUM_LIT:12> * sqrt ( <NUM_LIT:6> ) / pi ** <NUM_LIT:3> * _ZETA3 , <NUM_LIT> / <NUM_LIT:5> <EOL> def _entropy ( self ) : <EOL> return _EULER + <NUM_LIT:1.> <EOL> gumbel_l = gumbel_l_gen ( name = '<STR_LIT>' ) <EOL> class halfcauchy_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x ) : <EOL> return <NUM_LIT> / pi / ( <NUM_LIT:1.0> + x * x ) <EOL> def _logpdf ( self , x ) : <EOL> return np . log ( <NUM_LIT> / pi ) - special . log1p ( x * x ) <EOL> def _cdf ( self , x ) : <EOL> return <NUM_LIT> / pi * arctan ( x ) <EOL> def _ppf ( self , q ) : <EOL> return tan ( pi / <NUM_LIT:2> * q ) <EOL> def _stats ( self ) : <EOL> return inf , inf , nan , nan <EOL> def _entropy ( self ) : <EOL> return log ( <NUM_LIT:2> * pi ) <EOL> halfcauchy = halfcauchy_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class halflogistic_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x ) : <EOL> return exp ( self . _logpdf ( x ) ) <EOL> def _logpdf ( self , x ) : <EOL> return log ( <NUM_LIT:2> ) - x - <NUM_LIT> * special . log1p ( exp ( - x ) ) <EOL> def _cdf ( self , x ) : <EOL> return tanh ( x / <NUM_LIT> ) <EOL> def _ppf ( self , q ) : <EOL> return <NUM_LIT:2> * arctanh ( q ) <EOL> def _munp ( self , n ) : <EOL> if n == <NUM_LIT:1> : <EOL> return <NUM_LIT:2> * log ( <NUM_LIT:2> ) <EOL> if n == <NUM_LIT:2> : <EOL> return pi * pi / <NUM_LIT> <EOL> if n == <NUM_LIT:3> : <EOL> return <NUM_LIT:9> * _ZETA3 <EOL> if n == <NUM_LIT:4> : <EOL> return <NUM_LIT:7> * pi ** <NUM_LIT:4> / <NUM_LIT> <EOL> return <NUM_LIT:2> * ( <NUM_LIT:1> - pow ( <NUM_LIT> , <NUM_LIT:1> - n ) ) * special . gamma ( n + <NUM_LIT:1> ) * special . zeta ( n , <NUM_LIT:1> ) <EOL> def _entropy ( self ) : <EOL> return <NUM_LIT:2> - log ( <NUM_LIT:2> ) <EOL> halflogistic = halflogistic_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class halfnorm_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _rvs ( self ) : <EOL> return abs ( self . _random_state . standard_normal ( size = self . _size ) ) <EOL> def _pdf ( self , x ) : <EOL> return sqrt ( <NUM_LIT> / pi ) * exp ( - x * x / <NUM_LIT> ) <EOL> def _logpdf ( self , x ) : <EOL> return <NUM_LIT:0.5> * np . log ( <NUM_LIT> / pi ) - x * x / <NUM_LIT> <EOL> def _cdf ( self , x ) : <EOL> return _norm_cdf ( x ) * <NUM_LIT:2> - <NUM_LIT:1.0> <EOL> def _ppf ( self , q ) : <EOL> return special . ndtri ( ( <NUM_LIT:1> + q ) / <NUM_LIT> ) <EOL> def _stats ( self ) : <EOL> return ( sqrt ( <NUM_LIT> / pi ) , <NUM_LIT:1> - <NUM_LIT> / pi , sqrt ( <NUM_LIT:2> ) * ( <NUM_LIT:4> - pi ) / ( pi - <NUM_LIT:2> ) ** <NUM_LIT> , <EOL> <NUM_LIT:8> * ( pi - <NUM_LIT:3> ) / ( pi - <NUM_LIT:2> ) ** <NUM_LIT:2> ) <EOL> def _entropy ( self ) : <EOL> return <NUM_LIT:0.5> * log ( pi / <NUM_LIT> ) + <NUM_LIT:0.5> <EOL> halfnorm = halfnorm_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class hypsecant_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x ) : <EOL> return <NUM_LIT:1.0> / ( pi * cosh ( x ) ) <EOL> def _cdf ( self , x ) : <EOL> return <NUM_LIT> / pi * arctan ( exp ( x ) ) <EOL> def _ppf ( self , q ) : <EOL> return log ( tan ( pi * q / <NUM_LIT> ) ) <EOL> def _stats ( self ) : <EOL> return <NUM_LIT:0> , pi * pi / <NUM_LIT:4> , <NUM_LIT:0> , <NUM_LIT:2> <EOL> def _entropy ( self ) : <EOL> return log ( <NUM_LIT:2> * pi ) <EOL> hypsecant = hypsecant_gen ( name = '<STR_LIT>' ) <EOL> class gausshyper_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _argcheck ( self , a , b , c , z ) : <EOL> return ( a > <NUM_LIT:0> ) & ( b > <NUM_LIT:0> ) & ( c == c ) & ( z == z ) <EOL> def _pdf ( self , x , a , b , c , z ) : <EOL> Cinv = gam ( a ) * gam ( b ) / gam ( a + b ) * special . hyp2f1 ( c , a , a + b , - z ) <EOL> return <NUM_LIT:1.0> / Cinv * x ** ( a - <NUM_LIT:1.0> ) * ( <NUM_LIT:1.0> - x ) ** ( b - <NUM_LIT:1.0> ) / ( <NUM_LIT:1.0> + z * x ) ** c <EOL> def _munp ( self , n , a , b , c , z ) : <EOL> fac = special . beta ( n + a , b ) / special . beta ( a , b ) <EOL> num = special . hyp2f1 ( c , a + n , a + b + n , - z ) <EOL> den = special . hyp2f1 ( c , a , a + b , - z ) <EOL> return fac * num / den <EOL> gausshyper = gausshyper_gen ( a = <NUM_LIT:0.0> , b = <NUM_LIT:1.0> , name = '<STR_LIT>' ) <EOL> class invgamma_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x , a ) : <EOL> return exp ( self . _logpdf ( x , a ) ) <EOL> def _logpdf ( self , x , a ) : <EOL> return ( - ( a + <NUM_LIT:1> ) * log ( x ) - gamln ( a ) - <NUM_LIT:1.0> / x ) <EOL> def _cdf ( self , x , a ) : <EOL> return <NUM_LIT:1.0> - special . gammainc ( a , <NUM_LIT:1.0> / x ) <EOL> def _ppf ( self , q , a ) : <EOL> return <NUM_LIT:1.0> / special . gammaincinv ( a , <NUM_LIT:1.> - q ) <EOL> def _stats ( self , a , moments = '<STR_LIT>' ) : <EOL> m1 = _lazywhere ( a > <NUM_LIT:1> , ( a , ) , lambda x : <NUM_LIT:1.> / ( x - <NUM_LIT:1.> ) , np . inf ) <EOL> m2 = _lazywhere ( a > <NUM_LIT:2> , ( a , ) , lambda x : <NUM_LIT:1.> / ( x - <NUM_LIT:1.> ) ** <NUM_LIT:2> / ( x - <NUM_LIT> ) , <EOL> np . inf ) <EOL> g1 , g2 = None , None <EOL> if '<STR_LIT:s>' in moments : <EOL> g1 = _lazywhere ( <EOL> a > <NUM_LIT:3> , ( a , ) , <EOL> lambda x : <NUM_LIT> * np . sqrt ( x - <NUM_LIT> ) / ( x - <NUM_LIT> ) , np . nan ) <EOL> if '<STR_LIT:k>' in moments : <EOL> g2 = _lazywhere ( <EOL> a > <NUM_LIT:4> , ( a , ) , <EOL> lambda x : <NUM_LIT> * ( <NUM_LIT> * x - <NUM_LIT> ) / ( x - <NUM_LIT> ) / ( x - <NUM_LIT> ) , np . nan ) <EOL> return m1 , m2 , g1 , g2 <EOL> def _entropy ( self , a ) : <EOL> return a - ( a + <NUM_LIT:1.0> ) * special . psi ( a ) + gamln ( a ) <EOL> invgamma = invgamma_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class invgauss_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _rvs ( self , mu ) : <EOL> return self . _random_state . wald ( mu , <NUM_LIT:1.0> , size = self . _size ) <EOL> def _pdf ( self , x , mu ) : <EOL> return <NUM_LIT:1.0> / sqrt ( <NUM_LIT:2> * pi * x ** <NUM_LIT> ) * exp ( - <NUM_LIT:1.0> / ( <NUM_LIT:2> * x ) * ( ( x - mu ) / mu ) ** <NUM_LIT:2> ) <EOL> def _logpdf ( self , x , mu ) : <EOL> return - <NUM_LIT:0.5> * log ( <NUM_LIT:2> * pi ) - <NUM_LIT> * log ( x ) - ( ( x - mu ) / mu ) ** <NUM_LIT:2> / ( <NUM_LIT:2> * x ) <EOL> def _cdf ( self , x , mu ) : <EOL> fac = sqrt ( <NUM_LIT:1.0> / x ) <EOL> C1 = _norm_cdf ( fac * ( x - mu ) / mu ) <EOL> C1 += exp ( <NUM_LIT:1.0> / mu ) * _norm_cdf ( - fac * ( x + mu ) / mu ) * exp ( <NUM_LIT:1.0> / mu ) <EOL> return C1 <EOL> def _stats ( self , mu ) : <EOL> return mu , mu ** <NUM_LIT> , <NUM_LIT:3> * sqrt ( mu ) , <NUM_LIT:15> * mu <EOL> invgauss = invgauss_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class invweibull_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x , c ) : <EOL> xc1 = np . power ( x , - c - <NUM_LIT:1.0> ) <EOL> xc2 = np . power ( x , - c ) <EOL> xc2 = exp ( - xc2 ) <EOL> return c * xc1 * xc2 <EOL> def _cdf ( self , x , c ) : <EOL> xc1 = np . power ( x , - c ) <EOL> return exp ( - xc1 ) <EOL> def _ppf ( self , q , c ) : <EOL> return np . power ( - log ( q ) , - <NUM_LIT:1.0> / c ) <EOL> def _munp ( self , n , c ) : <EOL> return special . gamma ( <NUM_LIT:1> - n / c ) <EOL> def _entropy ( self , c ) : <EOL> return <NUM_LIT:1> + _EULER + _EULER / c - log ( c ) <EOL> invweibull = invweibull_gen ( a = <NUM_LIT:0> , name = '<STR_LIT>' ) <EOL> class johnsonsb_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _argcheck ( self , a , b ) : <EOL> return ( b > <NUM_LIT:0> ) & ( a == a ) <EOL> def _pdf ( self , x , a , b ) : <EOL> trm = _norm_pdf ( a + b * log ( x / ( <NUM_LIT:1.0> - x ) ) ) <EOL> return b * <NUM_LIT:1.0> / ( x * ( <NUM_LIT:1> - x ) ) * trm <EOL> def _cdf ( self , x , a , b ) : <EOL> return _norm_cdf ( a + b * log ( x / ( <NUM_LIT:1.0> - x ) ) ) <EOL> def _ppf ( self , q , a , b ) : <EOL> return <NUM_LIT:1.0> / ( <NUM_LIT:1> + exp ( - <NUM_LIT:1.0> / b * ( _norm_ppf ( q ) - a ) ) ) <EOL> johnsonsb = johnsonsb_gen ( a = <NUM_LIT:0.0> , b = <NUM_LIT:1.0> , name = '<STR_LIT>' ) <EOL> class johnsonsu_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _argcheck ( self , a , b ) : <EOL> return ( b > <NUM_LIT:0> ) & ( a == a ) <EOL> def _pdf ( self , x , a , b ) : <EOL> x2 = x * x <EOL> trm = _norm_pdf ( a + b * log ( x + sqrt ( x2 + <NUM_LIT:1> ) ) ) <EOL> return b * <NUM_LIT:1.0> / sqrt ( x2 + <NUM_LIT:1.0> ) * trm <EOL> def _cdf ( self , x , a , b ) : <EOL> return _norm_cdf ( a + b * log ( x + sqrt ( x * x + <NUM_LIT:1> ) ) ) <EOL> def _ppf ( self , q , a , b ) : <EOL> return sinh ( ( _norm_ppf ( q ) - a ) / b ) <EOL> johnsonsu = johnsonsu_gen ( name = '<STR_LIT>' ) <EOL> class laplace_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _rvs ( self ) : <EOL> return self . _random_state . laplace ( <NUM_LIT:0> , <NUM_LIT:1> , size = self . _size ) <EOL> def _pdf ( self , x ) : <EOL> return <NUM_LIT:0.5> * exp ( - abs ( x ) ) <EOL> def _cdf ( self , x ) : <EOL> return where ( x > <NUM_LIT:0> , <NUM_LIT:1.0> - <NUM_LIT:0.5> * exp ( - x ) , <NUM_LIT:0.5> * exp ( x ) ) <EOL> def _ppf ( self , q ) : <EOL> return where ( q > <NUM_LIT:0.5> , - log ( <NUM_LIT:2> * ( <NUM_LIT:1> - q ) ) , log ( <NUM_LIT:2> * q ) ) <EOL> def _stats ( self ) : <EOL> return <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:0> , <NUM_LIT:3> <EOL> def _entropy ( self ) : <EOL> return log ( <NUM_LIT:2> ) + <NUM_LIT:1> <EOL> laplace = laplace_gen ( name = '<STR_LIT>' ) <EOL> class levy_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x ) : <EOL> return <NUM_LIT:1> / sqrt ( <NUM_LIT:2> * pi * x ) / x * exp ( - <NUM_LIT:1> / ( <NUM_LIT:2> * x ) ) <EOL> def _cdf ( self , x ) : <EOL> return special . erfc ( sqrt ( <NUM_LIT:0.5> / x ) ) <EOL> def _ppf ( self , q ) : <EOL> val = - special . ndtri ( q / <NUM_LIT:2> ) <EOL> return <NUM_LIT:1.0> / ( val * val ) <EOL> def _stats ( self ) : <EOL> return inf , inf , nan , nan <EOL> levy = levy_gen ( a = <NUM_LIT:0.0> , name = "<STR_LIT>" ) <EOL> class levy_l_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x ) : <EOL> ax = abs ( x ) <EOL> return <NUM_LIT:1> / sqrt ( <NUM_LIT:2> * pi * ax ) / ax * exp ( - <NUM_LIT:1> / ( <NUM_LIT:2> * ax ) ) <EOL> def _cdf ( self , x ) : <EOL> ax = abs ( x ) <EOL> return <NUM_LIT:2> * _norm_cdf ( <NUM_LIT:1> / sqrt ( ax ) ) - <NUM_LIT:1> <EOL> def _ppf ( self , q ) : <EOL> val = _norm_ppf ( ( q + <NUM_LIT:1.0> ) / <NUM_LIT:2> ) <EOL> return - <NUM_LIT:1.0> / ( val * val ) <EOL> def _stats ( self ) : <EOL> return inf , inf , nan , nan <EOL> levy_l = levy_l_gen ( b = <NUM_LIT:0.0> , name = "<STR_LIT>" ) <EOL> class levy_stable_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _rvs ( self , alpha , beta ) : <EOL> sz = self . _size <EOL> TH = uniform . rvs ( loc = - pi / <NUM_LIT> , scale = pi , size = sz ) <EOL> W = expon . rvs ( size = sz ) <EOL> if alpha == <NUM_LIT:1> : <EOL> return <NUM_LIT:2> / pi * ( pi / <NUM_LIT:2> + beta * TH ) * tan ( TH ) - beta * log ( ( pi / <NUM_LIT:2> * W * cos ( TH ) ) / ( pi / <NUM_LIT:2> + beta * TH ) ) <EOL> ialpha = <NUM_LIT:1.0> / alpha <EOL> aTH = alpha * TH <EOL> if beta == <NUM_LIT:0> : <EOL> return W / ( cos ( TH ) / tan ( aTH ) + sin ( TH ) ) * ( ( cos ( aTH ) + sin ( aTH ) * tan ( TH ) ) / W ) ** ialpha <EOL> val0 = beta * tan ( pi * alpha / <NUM_LIT:2> ) <EOL> th0 = arctan ( val0 ) / alpha <EOL> val3 = W / ( cos ( TH ) / tan ( alpha * ( th0 + TH ) ) + sin ( TH ) ) <EOL> res3 = val3 * ( ( cos ( aTH ) + sin ( aTH ) * tan ( TH ) - val0 * ( sin ( aTH ) - cos ( aTH ) * tan ( TH ) ) ) / W ) ** ialpha <EOL> return res3 <EOL> def _argcheck ( self , alpha , beta ) : <EOL> if beta == - <NUM_LIT:1> : <EOL> self . b = <NUM_LIT:0.0> <EOL> elif beta == <NUM_LIT:1> : <EOL> self . a = <NUM_LIT:0.0> <EOL> return ( alpha > <NUM_LIT:0> ) & ( alpha <= <NUM_LIT:2> ) & ( beta <= <NUM_LIT:1> ) & ( beta >= - <NUM_LIT:1> ) <EOL> def _pdf ( self , x , alpha , beta ) : <EOL> raise NotImplementedError <EOL> levy_stable = levy_stable_gen ( name = '<STR_LIT>' ) <EOL> class logistic_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _rvs ( self ) : <EOL> return self . _random_state . logistic ( size = self . _size ) <EOL> def _pdf ( self , x ) : <EOL> return exp ( self . _logpdf ( x ) ) <EOL> def _logpdf ( self , x ) : <EOL> return - x - <NUM_LIT> * special . log1p ( exp ( - x ) ) <EOL> def _cdf ( self , x ) : <EOL> return special . expit ( x ) <EOL> def _ppf ( self , q ) : <EOL> return - log ( <NUM_LIT:1.0> / q - <NUM_LIT:1> ) <EOL> def _stats ( self ) : <EOL> return <NUM_LIT:0> , pi * pi / <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT> / <NUM_LIT> <EOL> def _entropy ( self ) : <EOL> return <NUM_LIT> <EOL> logistic = logistic_gen ( name = '<STR_LIT>' ) <EOL> class loggamma_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _rvs ( self , c ) : <EOL> return log ( self . _random_state . gamma ( c , size = self . _size ) ) <EOL> def _pdf ( self , x , c ) : <EOL> return exp ( c * x - exp ( x ) - gamln ( c ) ) <EOL> def _cdf ( self , x , c ) : <EOL> return special . gammainc ( c , exp ( x ) ) <EOL> def _ppf ( self , q , c ) : <EOL> return log ( special . gammaincinv ( c , q ) ) <EOL> def _stats ( self , c ) : <EOL> mean = special . digamma ( c ) <EOL> var = special . polygamma ( <NUM_LIT:1> , c ) <EOL> skewness = special . polygamma ( <NUM_LIT:2> , c ) / np . power ( var , <NUM_LIT> ) <EOL> excess_kurtosis = special . polygamma ( <NUM_LIT:3> , c ) / ( var * var ) <EOL> return mean , var , skewness , excess_kurtosis <EOL> loggamma = loggamma_gen ( name = '<STR_LIT>' ) <EOL> class loglaplace_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x , c ) : <EOL> cd2 = c / <NUM_LIT> <EOL> c = where ( x < <NUM_LIT:1> , c , - c ) <EOL> return cd2 * x ** ( c - <NUM_LIT:1> ) <EOL> def _cdf ( self , x , c ) : <EOL> return where ( x < <NUM_LIT:1> , <NUM_LIT:0.5> * x ** c , <NUM_LIT:1> - <NUM_LIT:0.5> * x ** ( - c ) ) <EOL> def _ppf ( self , q , c ) : <EOL> return where ( q < <NUM_LIT:0.5> , ( <NUM_LIT> * q ) ** ( <NUM_LIT:1.0> / c ) , ( <NUM_LIT:2> * ( <NUM_LIT:1.0> - q ) ) ** ( - <NUM_LIT:1.0> / c ) ) <EOL> def _munp ( self , n , c ) : <EOL> return c ** <NUM_LIT:2> / ( c ** <NUM_LIT:2> - n ** <NUM_LIT:2> ) <EOL> def _entropy ( self , c ) : <EOL> return log ( <NUM_LIT> / c ) + <NUM_LIT:1.0> <EOL> loglaplace = loglaplace_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> def _lognorm_logpdf ( x , s ) : <EOL> return _lazywhere ( x != <NUM_LIT:0> , ( x , s ) , <EOL> lambda x , s : - log ( x ) ** <NUM_LIT:2> / ( <NUM_LIT:2> * s ** <NUM_LIT:2> ) - log ( s * x * sqrt ( <NUM_LIT:2> * pi ) ) , <EOL> - np . inf ) <EOL> class lognorm_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _rvs ( self , s ) : <EOL> return exp ( s * self . _random_state . standard_normal ( self . _size ) ) <EOL> def _pdf ( self , x , s ) : <EOL> return exp ( self . _logpdf ( x , s ) ) <EOL> def _logpdf ( self , x , s ) : <EOL> return _lognorm_logpdf ( x , s ) <EOL> def _cdf ( self , x , s ) : <EOL> return _norm_cdf ( log ( x ) / s ) <EOL> def _logcdf ( self , x , s ) : <EOL> return _norm_logcdf ( log ( x ) / s ) <EOL> def _ppf ( self , q , s ) : <EOL> return exp ( s * _norm_ppf ( q ) ) <EOL> def _sf ( self , x , s ) : <EOL> return _norm_sf ( log ( x ) / s ) <EOL> def _logsf ( self , x , s ) : <EOL> return _norm_logsf ( log ( x ) / s ) <EOL> def _stats ( self , s ) : <EOL> p = exp ( s * s ) <EOL> mu = sqrt ( p ) <EOL> mu2 = p * ( p - <NUM_LIT:1> ) <EOL> g1 = sqrt ( ( p - <NUM_LIT:1> ) ) * ( <NUM_LIT:2> + p ) <EOL> g2 = np . polyval ( [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:0> , - <NUM_LIT> ] , p ) <EOL> return mu , mu2 , g1 , g2 <EOL> def _entropy ( self , s ) : <EOL> return <NUM_LIT:0.5> * ( <NUM_LIT:1> + log ( <NUM_LIT:2> * pi ) + <NUM_LIT:2> * log ( s ) ) <EOL> lognorm = lognorm_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class gilbrat_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _rvs ( self ) : <EOL> return exp ( self . _random_state . standard_normal ( self . _size ) ) <EOL> def _pdf ( self , x ) : <EOL> return exp ( self . _logpdf ( x ) ) <EOL> def _logpdf ( self , x ) : <EOL> return _lognorm_logpdf ( x , <NUM_LIT:1.0> ) <EOL> def _cdf ( self , x ) : <EOL> return _norm_cdf ( log ( x ) ) <EOL> def _ppf ( self , q ) : <EOL> return exp ( _norm_ppf ( q ) ) <EOL> def _stats ( self ) : <EOL> p = np . e <EOL> mu = sqrt ( p ) <EOL> mu2 = p * ( p - <NUM_LIT:1> ) <EOL> g1 = sqrt ( ( p - <NUM_LIT:1> ) ) * ( <NUM_LIT:2> + p ) <EOL> g2 = np . polyval ( [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:0> , - <NUM_LIT> ] , p ) <EOL> return mu , mu2 , g1 , g2 <EOL> def _entropy ( self ) : <EOL> return <NUM_LIT:0.5> * log ( <NUM_LIT:2> * pi ) + <NUM_LIT:0.5> <EOL> gilbrat = gilbrat_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class maxwell_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _rvs ( self ) : <EOL> return chi . rvs ( <NUM_LIT> , size = self . _size , random_state = self . _random_state ) <EOL> def _pdf ( self , x ) : <EOL> return sqrt ( <NUM_LIT> / pi ) * x * x * exp ( - x * x / <NUM_LIT> ) <EOL> def _cdf ( self , x ) : <EOL> return special . gammainc ( <NUM_LIT> , x * x / <NUM_LIT> ) <EOL> def _ppf ( self , q ) : <EOL> return sqrt ( <NUM_LIT:2> * special . gammaincinv ( <NUM_LIT> , q ) ) <EOL> def _stats ( self ) : <EOL> val = <NUM_LIT:3> * pi - <NUM_LIT:8> <EOL> return ( <NUM_LIT:2> * sqrt ( <NUM_LIT> / pi ) , <NUM_LIT:3> - <NUM_LIT:8> / pi , sqrt ( <NUM_LIT:2> ) * ( <NUM_LIT:32> - <NUM_LIT:10> * pi ) / val ** <NUM_LIT> , <EOL> ( - <NUM_LIT:12> * pi * pi + <NUM_LIT> * pi - <NUM_LIT> ) / val ** <NUM_LIT> ) <EOL> def _entropy ( self ) : <EOL> return _EULER + <NUM_LIT:0.5> * log ( <NUM_LIT:2> * pi ) - <NUM_LIT:0.5> <EOL> maxwell = maxwell_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class mielke_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x , k , s ) : <EOL> return k * x ** ( k - <NUM_LIT:1.0> ) / ( <NUM_LIT:1.0> + x ** s ) ** ( <NUM_LIT:1.0> + k * <NUM_LIT:1.0> / s ) <EOL> def _cdf ( self , x , k , s ) : <EOL> return x ** k / ( <NUM_LIT:1.0> + x ** s ) ** ( k * <NUM_LIT:1.0> / s ) <EOL> def _ppf ( self , q , k , s ) : <EOL> qsk = pow ( q , s * <NUM_LIT:1.0> / k ) <EOL> return pow ( qsk / ( <NUM_LIT:1.0> - qsk ) , <NUM_LIT:1.0> / s ) <EOL> mielke = mielke_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class nakagami_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x , nu ) : <EOL> return <NUM_LIT:2> * nu ** nu / gam ( nu ) * ( x ** ( <NUM_LIT:2> * nu - <NUM_LIT:1.0> ) ) * exp ( - nu * x * x ) <EOL> def _cdf ( self , x , nu ) : <EOL> return special . gammainc ( nu , nu * x * x ) <EOL> def _ppf ( self , q , nu ) : <EOL> return sqrt ( <NUM_LIT:1.0> / nu * special . gammaincinv ( nu , q ) ) <EOL> def _stats ( self , nu ) : <EOL> mu = gam ( nu + <NUM_LIT:0.5> ) / gam ( nu ) / sqrt ( nu ) <EOL> mu2 = <NUM_LIT:1.0> - mu * mu <EOL> g1 = mu * ( <NUM_LIT:1> - <NUM_LIT:4> * nu * mu2 ) / <NUM_LIT> / nu / np . power ( mu2 , <NUM_LIT> ) <EOL> g2 = - <NUM_LIT:6> * mu ** <NUM_LIT:4> * nu + ( <NUM_LIT:8> * nu - <NUM_LIT:2> ) * mu ** <NUM_LIT:2> - <NUM_LIT:2> * nu + <NUM_LIT:1> <EOL> g2 /= nu * mu2 ** <NUM_LIT> <EOL> return mu , mu2 , g1 , g2 <EOL> nakagami = nakagami_gen ( a = <NUM_LIT:0.0> , name = "<STR_LIT>" ) <EOL> class ncx2_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _rvs ( self , df , nc ) : <EOL> return self . _random_state . noncentral_chisquare ( df , nc , self . _size ) <EOL> def _logpdf ( self , x , df , nc ) : <EOL> return _ncx2_log_pdf ( x , df , nc ) <EOL> def _pdf ( self , x , df , nc ) : <EOL> return _ncx2_pdf ( x , df , nc ) <EOL> def _cdf ( self , x , df , nc ) : <EOL> return _ncx2_cdf ( x , df , nc ) <EOL> def _ppf ( self , q , df , nc ) : <EOL> return special . chndtrix ( q , df , nc ) <EOL> def _stats ( self , df , nc ) : <EOL> val = df + <NUM_LIT> * nc <EOL> return ( df + nc , <NUM_LIT:2> * val , sqrt ( <NUM_LIT:8> ) * ( val + nc ) / val ** <NUM_LIT> , <EOL> <NUM_LIT> * ( val + <NUM_LIT:2> * nc ) / val ** <NUM_LIT> ) <EOL> ncx2 = ncx2_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class ncf_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _rvs ( self , dfn , dfd , nc ) : <EOL> return self . _random_state . noncentral_f ( dfn , dfd , nc , self . _size ) <EOL> def _pdf_skip ( self , x , dfn , dfd , nc ) : <EOL> n1 , n2 = dfn , dfd <EOL> term = - nc / <NUM_LIT:2> + nc * n1 * x / ( <NUM_LIT:2> * ( n2 + n1 * x ) ) + gamln ( n1 / <NUM_LIT> ) + gamln ( <NUM_LIT:1> + n2 / <NUM_LIT> ) <EOL> term -= gamln ( ( n1 + n2 ) / <NUM_LIT> ) <EOL> Px = exp ( term ) <EOL> Px *= n1 ** ( n1 / <NUM_LIT:2> ) * n2 ** ( n2 / <NUM_LIT:2> ) * x ** ( n1 / <NUM_LIT:2> - <NUM_LIT:1> ) <EOL> Px *= ( n2 + n1 * x ) ** ( - ( n1 + n2 ) / <NUM_LIT:2> ) <EOL> Px *= special . assoc_laguerre ( - nc * n1 * x / ( <NUM_LIT> * ( n2 + n1 * x ) ) , n2 / <NUM_LIT:2> , n1 / <NUM_LIT:2> - <NUM_LIT:1> ) <EOL> Px /= special . beta ( n1 / <NUM_LIT:2> , n2 / <NUM_LIT:2> ) <EOL> def _cdf ( self , x , dfn , dfd , nc ) : <EOL> return special . ncfdtr ( dfn , dfd , nc , x ) <EOL> def _ppf ( self , q , dfn , dfd , nc ) : <EOL> return special . ncfdtri ( dfn , dfd , nc , q ) <EOL> def _munp ( self , n , dfn , dfd , nc ) : <EOL> val = ( dfn * <NUM_LIT:1.0> / dfd ) ** n <EOL> term = gamln ( n + <NUM_LIT:0.5> * dfn ) + gamln ( <NUM_LIT:0.5> * dfd - n ) - gamln ( dfd * <NUM_LIT:0.5> ) <EOL> val *= exp ( - nc / <NUM_LIT> + term ) <EOL> val *= special . hyp1f1 ( n + <NUM_LIT:0.5> * dfn , <NUM_LIT:0.5> * dfn , <NUM_LIT:0.5> * nc ) <EOL> return val <EOL> def _stats ( self , dfn , dfd , nc ) : <EOL> mu = where ( dfd <= <NUM_LIT:2> , inf , dfd / ( dfd - <NUM_LIT> ) * ( <NUM_LIT:1> + nc * <NUM_LIT:1.0> / dfn ) ) <EOL> mu2 = where ( dfd <= <NUM_LIT:4> , inf , <NUM_LIT:2> * ( dfd * <NUM_LIT:1.0> / dfn ) ** <NUM_LIT> * <EOL> ( ( dfn + nc / <NUM_LIT> ) ** <NUM_LIT> + ( dfn + nc ) * ( dfd - <NUM_LIT> ) ) / <EOL> ( ( dfd - <NUM_LIT> ) ** <NUM_LIT> * ( dfd - <NUM_LIT> ) ) ) <EOL> return mu , mu2 , None , None <EOL> ncf = ncf_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class t_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _rvs ( self , df ) : <EOL> return self . _random_state . standard_t ( df , size = self . _size ) <EOL> def _pdf ( self , x , df ) : <EOL> r = asarray ( df * <NUM_LIT:1.0> ) <EOL> Px = exp ( gamln ( ( r + <NUM_LIT:1> ) / <NUM_LIT:2> ) - gamln ( r / <NUM_LIT:2> ) ) <EOL> Px /= sqrt ( r * pi ) * ( <NUM_LIT:1> + ( x ** <NUM_LIT:2> ) / r ) ** ( ( r + <NUM_LIT:1> ) / <NUM_LIT:2> ) <EOL> return Px <EOL> def _logpdf ( self , x , df ) : <EOL> r = df * <NUM_LIT:1.0> <EOL> lPx = gamln ( ( r + <NUM_LIT:1> ) / <NUM_LIT:2> ) - gamln ( r / <NUM_LIT:2> ) <EOL> lPx -= <NUM_LIT:0.5> * log ( r * pi ) + ( r + <NUM_LIT:1> ) / <NUM_LIT:2> * log ( <NUM_LIT:1> + ( x ** <NUM_LIT:2> ) / r ) <EOL> return lPx <EOL> def _cdf ( self , x , df ) : <EOL> return special . stdtr ( df , x ) <EOL> def _sf ( self , x , df ) : <EOL> return special . stdtr ( df , - x ) <EOL> def _ppf ( self , q , df ) : <EOL> return special . stdtrit ( df , q ) <EOL> def _isf ( self , q , df ) : <EOL> return - special . stdtrit ( df , q ) <EOL> def _stats ( self , df ) : <EOL> mu2 = _lazywhere ( df > <NUM_LIT:2> , ( df , ) , <EOL> lambda df : df / ( df - <NUM_LIT> ) , <EOL> np . inf ) <EOL> g1 = where ( df > <NUM_LIT:3> , <NUM_LIT:0.0> , np . nan ) <EOL> g2 = _lazywhere ( df > <NUM_LIT:4> , ( df , ) , <EOL> lambda df : <NUM_LIT> / ( df - <NUM_LIT> ) , <EOL> np . nan ) <EOL> return <NUM_LIT:0> , mu2 , g1 , g2 <EOL> t = t_gen ( name = '<STR_LIT:t>' ) <EOL> class nct_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _argcheck ( self , df , nc ) : <EOL> return ( df > <NUM_LIT:0> ) & ( nc == nc ) <EOL> def _rvs ( self , df , nc ) : <EOL> sz , rndm = self . _size , self . _random_state <EOL> n = norm . rvs ( loc = nc , size = sz , random_state = rndm ) <EOL> c2 = chi2 . rvs ( df , size = sz , random_state = rndm ) <EOL> return n * sqrt ( df ) / sqrt ( c2 ) <EOL> def _pdf ( self , x , df , nc ) : <EOL> n = df * <NUM_LIT:1.0> <EOL> nc = nc * <NUM_LIT:1.0> <EOL> x2 = x * x <EOL> ncx2 = nc * nc * x2 <EOL> fac1 = n + x2 <EOL> trm1 = n / <NUM_LIT> * log ( n ) + gamln ( n + <NUM_LIT:1> ) <EOL> trm1 -= n * log ( <NUM_LIT:2> ) + nc * nc / <NUM_LIT> + ( n / <NUM_LIT> ) * log ( fac1 ) + gamln ( n / <NUM_LIT> ) <EOL> Px = exp ( trm1 ) <EOL> valF = ncx2 / ( <NUM_LIT:2> * fac1 ) <EOL> trm1 = sqrt ( <NUM_LIT:2> ) * nc * x * special . hyp1f1 ( n / <NUM_LIT:2> + <NUM_LIT:1> , <NUM_LIT> , valF ) <EOL> trm1 /= asarray ( fac1 * special . gamma ( ( n + <NUM_LIT:1> ) / <NUM_LIT:2> ) ) <EOL> trm2 = special . hyp1f1 ( ( n + <NUM_LIT:1> ) / <NUM_LIT:2> , <NUM_LIT:0.5> , valF ) <EOL> trm2 /= asarray ( sqrt ( fac1 ) * special . gamma ( n / <NUM_LIT:2> + <NUM_LIT:1> ) ) <EOL> Px *= trm1 + trm2 <EOL> return Px <EOL> def _cdf ( self , x , df , nc ) : <EOL> return special . nctdtr ( df , nc , x ) <EOL> def _ppf ( self , q , df , nc ) : <EOL> return special . nctdtrit ( df , nc , q ) <EOL> def _stats ( self , df , nc , moments = '<STR_LIT>' ) : <EOL> mu , mu2 , g1 , g2 = None , None , None , None <EOL> gfac = gam ( df / <NUM_LIT> - <NUM_LIT:0.5> ) / gam ( df / <NUM_LIT> ) <EOL> c11 = sqrt ( df / <NUM_LIT> ) * gfac <EOL> c20 = df / ( df - <NUM_LIT> ) <EOL> c22 = c20 - c11 * c11 <EOL> mu = np . where ( df > <NUM_LIT:1> , nc * c11 , np . inf ) <EOL> mu2 = np . where ( df > <NUM_LIT:2> , c22 * nc * nc + c20 , np . inf ) <EOL> if '<STR_LIT:s>' in moments : <EOL> c33t = df * ( <NUM_LIT> - <NUM_LIT> * df ) / ( df - <NUM_LIT> ) / ( df - <NUM_LIT> ) + <NUM_LIT> * c11 * c11 <EOL> c31t = <NUM_LIT> * df / ( df - <NUM_LIT> ) / ( df - <NUM_LIT> ) <EOL> mu3 = ( c33t * nc * nc + c31t ) * c11 * nc <EOL> g1 = np . where ( df > <NUM_LIT:3> , mu3 / np . power ( mu2 , <NUM_LIT> ) , np . nan ) <EOL> if '<STR_LIT:k>' in moments : <EOL> c44 = df * df / ( df - <NUM_LIT> ) / ( df - <NUM_LIT> ) <EOL> c44 -= c11 * c11 * <NUM_LIT> * df * ( <NUM_LIT> - df ) / ( df - <NUM_LIT> ) / ( df - <NUM_LIT> ) <EOL> c44 -= <NUM_LIT> * c11 ** <NUM_LIT:4> <EOL> c42 = df / ( df - <NUM_LIT> ) - c11 * c11 * ( df - <NUM_LIT:1.> ) / ( df - <NUM_LIT> ) <EOL> c42 *= <NUM_LIT> * df / ( df - <NUM_LIT> ) <EOL> c40 = <NUM_LIT> * df * df / ( df - <NUM_LIT> ) / ( df - <NUM_LIT> ) <EOL> mu4 = c44 * nc ** <NUM_LIT:4> + c42 * nc ** <NUM_LIT:2> + c40 <EOL> g2 = np . where ( df > <NUM_LIT:4> , mu4 / mu2 ** <NUM_LIT:2> - <NUM_LIT> , np . nan ) <EOL> return mu , mu2 , g1 , g2 <EOL> nct = nct_gen ( name = "<STR_LIT>" ) <EOL> class pareto_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x , b ) : <EOL> return b * x ** ( - b - <NUM_LIT:1> ) <EOL> def _cdf ( self , x , b ) : <EOL> return <NUM_LIT:1> - x ** ( - b ) <EOL> def _ppf ( self , q , b ) : <EOL> return pow ( <NUM_LIT:1> - q , - <NUM_LIT:1.0> / b ) <EOL> def _stats ( self , b , moments = '<STR_LIT>' ) : <EOL> mu , mu2 , g1 , g2 = None , None , None , None <EOL> if '<STR_LIT:m>' in moments : <EOL> mask = b > <NUM_LIT:1> <EOL> bt = extract ( mask , b ) <EOL> mu = valarray ( shape ( b ) , value = inf ) <EOL> place ( mu , mask , bt / ( bt - <NUM_LIT:1.0> ) ) <EOL> if '<STR_LIT:v>' in moments : <EOL> mask = b > <NUM_LIT:2> <EOL> bt = extract ( mask , b ) <EOL> mu2 = valarray ( shape ( b ) , value = inf ) <EOL> place ( mu2 , mask , bt / ( bt - <NUM_LIT> ) / ( bt - <NUM_LIT:1.0> ) ** <NUM_LIT:2> ) <EOL> if '<STR_LIT:s>' in moments : <EOL> mask = b > <NUM_LIT:3> <EOL> bt = extract ( mask , b ) <EOL> g1 = valarray ( shape ( b ) , value = nan ) <EOL> vals = <NUM_LIT:2> * ( bt + <NUM_LIT:1.0> ) * sqrt ( bt - <NUM_LIT> ) / ( ( bt - <NUM_LIT> ) * sqrt ( bt ) ) <EOL> place ( g1 , mask , vals ) <EOL> if '<STR_LIT:k>' in moments : <EOL> mask = b > <NUM_LIT:4> <EOL> bt = extract ( mask , b ) <EOL> g2 = valarray ( shape ( b ) , value = nan ) <EOL> vals = ( <NUM_LIT> * polyval ( [ <NUM_LIT:1.0> , <NUM_LIT:1.0> , - <NUM_LIT:6> , - <NUM_LIT:2> ] , bt ) / <EOL> polyval ( [ <NUM_LIT:1.0> , - <NUM_LIT> , <NUM_LIT> , <NUM_LIT:0.0> ] , bt ) ) <EOL> place ( g2 , mask , vals ) <EOL> return mu , mu2 , g1 , g2 <EOL> def _entropy ( self , c ) : <EOL> return <NUM_LIT:1> + <NUM_LIT:1.0> / c - log ( c ) <EOL> pareto = pareto_gen ( a = <NUM_LIT:1.0> , name = "<STR_LIT>" ) <EOL> class lomax_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x , c ) : <EOL> return c * <NUM_LIT:1.0> / ( <NUM_LIT:1.0> + x ) ** ( c + <NUM_LIT:1.0> ) <EOL> def _logpdf ( self , x , c ) : <EOL> return log ( c ) - ( c + <NUM_LIT:1> ) * special . log1p ( x ) <EOL> def _cdf ( self , x , c ) : <EOL> return - special . expm1 ( - c * special . log1p ( x ) ) <EOL> def _sf ( self , x , c ) : <EOL> return exp ( - c * special . log1p ( x ) ) <EOL> def _logsf ( self , x , c ) : <EOL> return - c * special . log1p ( x ) <EOL> def _ppf ( self , q , c ) : <EOL> return special . expm1 ( - special . log1p ( - q ) / c ) <EOL> def _stats ( self , c ) : <EOL> mu , mu2 , g1 , g2 = pareto . stats ( c , loc = - <NUM_LIT:1.0> , moments = '<STR_LIT>' ) <EOL> return mu , mu2 , g1 , g2 <EOL> def _entropy ( self , c ) : <EOL> return <NUM_LIT:1> + <NUM_LIT:1.0> / c - log ( c ) <EOL> lomax = lomax_gen ( a = <NUM_LIT:0.0> , name = "<STR_LIT>" ) <EOL> class pearson3_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _preprocess ( self , x , skew ) : <EOL> loc = <NUM_LIT:0.0> <EOL> scale = <NUM_LIT:1.0> <EOL> norm2pearson_transition = <NUM_LIT> <EOL> ans , x , skew = np . broadcast_arrays ( [ <NUM_LIT:1.0> ] , x , skew ) <EOL> ans = ans . copy ( ) <EOL> mask = np . absolute ( skew ) < norm2pearson_transition <EOL> invmask = ~ mask <EOL> beta = <NUM_LIT> / ( skew [ invmask ] * scale ) <EOL> alpha = ( scale * beta ) ** <NUM_LIT:2> <EOL> zeta = loc - alpha / beta <EOL> transx = beta * ( x [ invmask ] - zeta ) <EOL> return ans , x , transx , skew , mask , invmask , beta , alpha , zeta <EOL> def _argcheck ( self , skew ) : <EOL> return np . ones ( np . shape ( skew ) , dtype = bool ) <EOL> def _stats ( self , skew ) : <EOL> ans , x , transx , skew , mask , invmask , beta , alpha , zeta = ( <EOL> self . _preprocess ( [ <NUM_LIT:1> ] , skew ) ) <EOL> m = zeta + alpha / beta <EOL> v = alpha / ( beta ** <NUM_LIT:2> ) <EOL> s = <NUM_LIT> / ( alpha ** <NUM_LIT:0.5> ) * np . sign ( beta ) <EOL> k = <NUM_LIT> / alpha <EOL> return m , v , s , k <EOL> def _pdf ( self , x , skew ) : <EOL> ans = exp ( self . _logpdf ( x , skew ) ) <EOL> if ans . ndim == <NUM_LIT:0> : <EOL> if np . isnan ( ans ) : <EOL> return <NUM_LIT:0.0> <EOL> return ans <EOL> ans [ np . isnan ( ans ) ] = <NUM_LIT:0.0> <EOL> return ans <EOL> def _logpdf ( self , x , skew ) : <EOL> ans , x , transx , skew , mask , invmask , beta , alpha , zeta = ( <EOL> self . _preprocess ( x , skew ) ) <EOL> ans [ mask ] = np . log ( _norm_pdf ( x [ mask ] ) ) <EOL> ans [ invmask ] = log ( abs ( beta ) ) + gamma . _logpdf ( transx , alpha ) <EOL> return ans <EOL> def _cdf ( self , x , skew ) : <EOL> ans , x , transx , skew , mask , invmask , beta , alpha , zeta = ( <EOL> self . _preprocess ( x , skew ) ) <EOL> ans [ mask ] = _norm_cdf ( x [ mask ] ) <EOL> ans [ invmask ] = gamma . _cdf ( transx , alpha ) <EOL> return ans <EOL> def _rvs ( self , skew ) : <EOL> ans , x , transx , skew , mask , invmask , beta , alpha , zeta = ( <EOL> self . _preprocess ( [ <NUM_LIT:0> ] , skew ) ) <EOL> if mask [ <NUM_LIT:0> ] : <EOL> return self . _random_state . standard_normal ( self . _size ) <EOL> ans = self . _random_state . standard_gamma ( alpha , self . _size ) / beta + zeta <EOL> if ans . size == <NUM_LIT:1> : <EOL> return ans [ <NUM_LIT:0> ] <EOL> return ans <EOL> def _ppf ( self , q , skew ) : <EOL> ans , q , transq , skew , mask , invmask , beta , alpha , zeta = ( <EOL> self . _preprocess ( q , skew ) ) <EOL> ans [ mask ] = _norm_ppf ( q [ mask ] ) <EOL> ans [ invmask ] = special . gammaincinv ( alpha , q [ invmask ] ) / beta + zeta <EOL> return ans <EOL> pearson3 = pearson3_gen ( name = "<STR_LIT>" ) <EOL> class powerlaw_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x , a ) : <EOL> return a * x ** ( a - <NUM_LIT:1.0> ) <EOL> def _logpdf ( self , x , a ) : <EOL> return log ( a ) + special . xlogy ( a - <NUM_LIT:1> , x ) <EOL> def _cdf ( self , x , a ) : <EOL> return x ** ( a * <NUM_LIT:1.0> ) <EOL> def _logcdf ( self , x , a ) : <EOL> return a * log ( x ) <EOL> def _ppf ( self , q , a ) : <EOL> return pow ( q , <NUM_LIT:1.0> / a ) <EOL> def _stats ( self , a ) : <EOL> return ( a / ( a + <NUM_LIT:1.0> ) , <EOL> a / ( a + <NUM_LIT> ) / ( a + <NUM_LIT:1.0> ) ** <NUM_LIT:2> , <EOL> - <NUM_LIT> * ( ( a - <NUM_LIT:1.0> ) / ( a + <NUM_LIT> ) ) * sqrt ( ( a + <NUM_LIT> ) / a ) , <EOL> <NUM_LIT:6> * polyval ( [ <NUM_LIT:1> , - <NUM_LIT:1> , - <NUM_LIT:6> , <NUM_LIT:2> ] , a ) / ( a * ( a + <NUM_LIT> ) * ( a + <NUM_LIT:4> ) ) ) <EOL> def _entropy ( self , a ) : <EOL> return <NUM_LIT:1> - <NUM_LIT:1.0> / a - log ( a ) <EOL> powerlaw = powerlaw_gen ( a = <NUM_LIT:0.0> , b = <NUM_LIT:1.0> , name = "<STR_LIT>" ) <EOL> class powerlognorm_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x , c , s ) : <EOL> return ( c / ( x * s ) * _norm_pdf ( log ( x ) / s ) * <EOL> pow ( _norm_cdf ( - log ( x ) / s ) , c * <NUM_LIT:1.0> - <NUM_LIT:1.0> ) ) <EOL> def _cdf ( self , x , c , s ) : <EOL> return <NUM_LIT:1.0> - pow ( _norm_cdf ( - log ( x ) / s ) , c * <NUM_LIT:1.0> ) <EOL> def _ppf ( self , q , c , s ) : <EOL> return exp ( - s * _norm_ppf ( pow ( <NUM_LIT:1.0> - q , <NUM_LIT:1.0> / c ) ) ) <EOL> powerlognorm = powerlognorm_gen ( a = <NUM_LIT:0.0> , name = "<STR_LIT>" ) <EOL> class powernorm_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x , c ) : <EOL> return ( c * _norm_pdf ( x ) * ( _norm_cdf ( - x ) ** ( c - <NUM_LIT:1.0> ) ) ) <EOL> def _logpdf ( self , x , c ) : <EOL> return log ( c ) + _norm_logpdf ( x ) + ( c - <NUM_LIT:1> ) * _norm_logcdf ( - x ) <EOL> def _cdf ( self , x , c ) : <EOL> return <NUM_LIT:1.0> - _norm_cdf ( - x ) ** ( c * <NUM_LIT:1.0> ) <EOL> def _ppf ( self , q , c ) : <EOL> return - _norm_ppf ( pow ( <NUM_LIT:1.0> - q , <NUM_LIT:1.0> / c ) ) <EOL> powernorm = powernorm_gen ( name = '<STR_LIT>' ) <EOL> class rdist_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x , c ) : <EOL> return np . power ( ( <NUM_LIT:1.0> - x ** <NUM_LIT:2> ) , c / <NUM_LIT> - <NUM_LIT:1> ) / special . beta ( <NUM_LIT:0.5> , c / <NUM_LIT> ) <EOL> def _cdf ( self , x , c ) : <EOL> term1 = x / special . beta ( <NUM_LIT:0.5> , c / <NUM_LIT> ) <EOL> res = <NUM_LIT:0.5> + term1 * special . hyp2f1 ( <NUM_LIT:0.5> , <NUM_LIT:1> - c / <NUM_LIT> , <NUM_LIT> , x ** <NUM_LIT:2> ) <EOL> if np . any ( np . isnan ( res ) ) : <EOL> return rv_continuous . _cdf ( self , x , c ) <EOL> return res <EOL> def _munp ( self , n , c ) : <EOL> numerator = ( <NUM_LIT:1> - ( n % <NUM_LIT:2> ) ) * special . beta ( ( n + <NUM_LIT:1.0> ) / <NUM_LIT:2> , c / <NUM_LIT> ) <EOL> return numerator / special . beta ( <NUM_LIT:1.> / <NUM_LIT:2> , c / <NUM_LIT> ) <EOL> rdist = rdist_gen ( a = - <NUM_LIT:1.0> , b = <NUM_LIT:1.0> , name = "<STR_LIT>" ) <EOL> class rayleigh_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _rvs ( self ) : <EOL> return chi . rvs ( <NUM_LIT:2> , size = self . _size , random_state = self . _random_state ) <EOL> def _pdf ( self , r ) : <EOL> return r * exp ( - <NUM_LIT:0.5> * r ** <NUM_LIT:2> ) <EOL> def _cdf ( self , r ) : <EOL> return - special . expm1 ( - <NUM_LIT:0.5> * r ** <NUM_LIT:2> ) <EOL> def _ppf ( self , q ) : <EOL> return sqrt ( - <NUM_LIT:2> * special . log1p ( - q ) ) <EOL> def _sf ( self , r ) : <EOL> return exp ( - <NUM_LIT:0.5> * r ** <NUM_LIT:2> ) <EOL> def _isf ( self , q ) : <EOL> return sqrt ( - <NUM_LIT:2> * log ( q ) ) <EOL> def _stats ( self ) : <EOL> val = <NUM_LIT:4> - pi <EOL> return ( np . sqrt ( pi / <NUM_LIT:2> ) , val / <NUM_LIT:2> , <NUM_LIT:2> * ( pi - <NUM_LIT:3> ) * sqrt ( pi ) / val ** <NUM_LIT> , <EOL> <NUM_LIT:6> * pi / val - <NUM_LIT:16> / val ** <NUM_LIT:2> ) <EOL> def _entropy ( self ) : <EOL> return _EULER / <NUM_LIT> + <NUM_LIT:1> - <NUM_LIT:0.5> * log ( <NUM_LIT:2> ) <EOL> rayleigh = rayleigh_gen ( a = <NUM_LIT:0.0> , name = "<STR_LIT>" ) <EOL> class reciprocal_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _argcheck ( self , a , b ) : <EOL> self . a = a <EOL> self . b = b <EOL> self . d = log ( b * <NUM_LIT:1.0> / a ) <EOL> return ( a > <NUM_LIT:0> ) & ( b > <NUM_LIT:0> ) & ( b > a ) <EOL> def _pdf ( self , x , a , b ) : <EOL> return <NUM_LIT:1.0> / ( x * self . d ) <EOL> def _logpdf ( self , x , a , b ) : <EOL> return - log ( x ) - log ( self . d ) <EOL> def _cdf ( self , x , a , b ) : <EOL> return ( log ( x ) - log ( a ) ) / self . d <EOL> def _ppf ( self , q , a , b ) : <EOL> return a * pow ( b * <NUM_LIT:1.0> / a , q ) <EOL> def _munp ( self , n , a , b ) : <EOL> return <NUM_LIT:1.0> / self . d / n * ( pow ( b * <NUM_LIT:1.0> , n ) - pow ( a * <NUM_LIT:1.0> , n ) ) <EOL> def _entropy ( self , a , b ) : <EOL> return <NUM_LIT:0.5> * log ( a * b ) + log ( log ( b / a ) ) <EOL> reciprocal = reciprocal_gen ( name = "<STR_LIT>" ) <EOL> class rice_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _argcheck ( self , b ) : <EOL> return b >= <NUM_LIT:0> <EOL> def _rvs ( self , b ) : <EOL> sz = self . _size if self . _size else <NUM_LIT:1> <EOL> t = b / np . sqrt ( <NUM_LIT:2> ) + self . _random_state . standard_normal ( size = ( <NUM_LIT:2> , sz ) ) <EOL> return np . sqrt ( ( t * t ) . sum ( axis = <NUM_LIT:0> ) ) <EOL> def _cdf ( self , x , b ) : <EOL> return chndtr ( np . square ( x ) , <NUM_LIT:2> , np . square ( b ) ) <EOL> def _ppf ( self , q , b ) : <EOL> return np . sqrt ( chndtrix ( q , <NUM_LIT:2> , np . square ( b ) ) ) <EOL> def _pdf ( self , x , b ) : <EOL> return x * exp ( - ( x - b ) * ( x - b ) / <NUM_LIT> ) * special . i0e ( x * b ) <EOL> def _munp ( self , n , b ) : <EOL> nd2 = n / <NUM_LIT> <EOL> n1 = <NUM_LIT:1> + nd2 <EOL> b2 = b * b / <NUM_LIT> <EOL> return ( <NUM_LIT> ** ( nd2 ) * exp ( - b2 ) * special . gamma ( n1 ) * <EOL> special . hyp1f1 ( n1 , <NUM_LIT:1> , b2 ) ) <EOL> rice = rice_gen ( a = <NUM_LIT:0.0> , name = "<STR_LIT>" ) <EOL> class recipinvgauss_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _rvs ( self , mu ) : <EOL> return <NUM_LIT:1.0> / self . _random_state . wald ( mu , <NUM_LIT:1.0> , size = self . _size ) <EOL> def _pdf ( self , x , mu ) : <EOL> return <NUM_LIT:1.0> / sqrt ( <NUM_LIT:2> * pi * x ) * exp ( - ( <NUM_LIT:1> - mu * x ) ** <NUM_LIT> / ( <NUM_LIT:2> * x * mu ** <NUM_LIT> ) ) <EOL> def _logpdf ( self , x , mu ) : <EOL> return - ( <NUM_LIT:1> - mu * x ) ** <NUM_LIT> / ( <NUM_LIT:2> * x * mu ** <NUM_LIT> ) - <NUM_LIT:0.5> * log ( <NUM_LIT:2> * pi * x ) <EOL> def _cdf ( self , x , mu ) : <EOL> trm1 = <NUM_LIT:1.0> / mu - x <EOL> trm2 = <NUM_LIT:1.0> / mu + x <EOL> isqx = <NUM_LIT:1.0> / sqrt ( x ) <EOL> return <NUM_LIT:1.0> - _norm_cdf ( isqx * trm1 ) - exp ( <NUM_LIT> / mu ) * _norm_cdf ( - isqx * trm2 ) <EOL> recipinvgauss = recipinvgauss_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class semicircular_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x ) : <EOL> return <NUM_LIT> / pi * sqrt ( <NUM_LIT:1> - x * x ) <EOL> def _cdf ( self , x ) : <EOL> return <NUM_LIT:0.5> + <NUM_LIT:1.0> / pi * ( x * sqrt ( <NUM_LIT:1> - x * x ) + arcsin ( x ) ) <EOL> def _stats ( self ) : <EOL> return <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , - <NUM_LIT:1.0> <EOL> def _entropy ( self ) : <EOL> return <NUM_LIT> <EOL> semicircular = semicircular_gen ( a = - <NUM_LIT:1.0> , b = <NUM_LIT:1.0> , name = "<STR_LIT>" ) <EOL> class skew_norm_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _argcheck ( self , a ) : <EOL> return np . isfinite ( a ) <EOL> def _pdf ( self , x , a ) : <EOL> return <NUM_LIT> * _norm_pdf ( x ) * _norm_cdf ( a * x ) <EOL> def _rvs ( self , a ) : <EOL> u0 = self . _random_state . normal ( size = self . _size ) <EOL> v = self . _random_state . normal ( size = self . _size ) <EOL> d = a / np . sqrt ( <NUM_LIT:1> + a ** <NUM_LIT:2> ) <EOL> u1 = d * u0 + v * np . sqrt ( <NUM_LIT:1> - d ** <NUM_LIT:2> ) <EOL> return np . where ( u0 >= <NUM_LIT:0> , u1 , - u1 ) <EOL> def _stats ( self , a , moments = '<STR_LIT>' ) : <EOL> output = [ None , None , None , None ] <EOL> const = np . sqrt ( <NUM_LIT:2> / pi ) * a / np . sqrt ( <NUM_LIT:1> + a ** <NUM_LIT:2> ) <EOL> if '<STR_LIT:m>' in moments : <EOL> output [ <NUM_LIT:0> ] = const <EOL> if '<STR_LIT:v>' in moments : <EOL> output [ <NUM_LIT:1> ] = <NUM_LIT:1> - const ** <NUM_LIT:2> <EOL> if '<STR_LIT:s>' in moments : <EOL> output [ <NUM_LIT:2> ] = ( ( <NUM_LIT:4> - pi ) / <NUM_LIT:2> ) * ( const / np . sqrt ( <NUM_LIT:1> - const ** <NUM_LIT:2> ) ) ** <NUM_LIT:3> <EOL> if '<STR_LIT:k>' in moments : <EOL> output [ <NUM_LIT:3> ] = ( <NUM_LIT:2> * ( pi - <NUM_LIT:3> ) ) * ( const ** <NUM_LIT:4> / ( <NUM_LIT:1> - const ** <NUM_LIT:2> ) ** <NUM_LIT:2> ) <EOL> return output <EOL> skewnorm = skew_norm_gen ( name = '<STR_LIT>' ) <EOL> class trapz_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _argcheck ( self , c , d ) : <EOL> return ( c >= <NUM_LIT:0> ) & ( c <= <NUM_LIT:1> ) & ( d >= <NUM_LIT:0> ) & ( d <= <NUM_LIT:1> ) & ( d >= c ) <EOL> def _pdf ( self , x , c , d ) : <EOL> u = <NUM_LIT:2> / ( d - c + <NUM_LIT:1> ) <EOL> condlist = [ x < c , x <= d , x > d ] <EOL> choicelist = [ u * x / c , u , u * ( <NUM_LIT:1> - x ) / ( <NUM_LIT:1> - d ) ] <EOL> return np . select ( condlist , choicelist ) <EOL> def _cdf ( self , x , c , d ) : <EOL> condlist = [ x < c , x <= d , x > d ] <EOL> choicelist = [ x ** <NUM_LIT:2> / c / ( d - c + <NUM_LIT:1> ) , <EOL> ( c + <NUM_LIT:2> * ( x - c ) ) / ( d - c + <NUM_LIT:1> ) , <EOL> <NUM_LIT:1> - ( ( <NUM_LIT:1> - x ) ** <NUM_LIT:2> / ( d - c + <NUM_LIT:1> ) / ( <NUM_LIT:1> - d ) ) ] <EOL> return np . select ( condlist , choicelist ) <EOL> def _ppf ( self , q , c , d ) : <EOL> qc , qd = self . _cdf ( c , c , d ) , self . _cdf ( d , c , d ) <EOL> condlist = [ q < qc , q <= qd , q > qd ] <EOL> choicelist = [ np . sqrt ( q * c * ( <NUM_LIT:1> + d - c ) ) , <EOL> <NUM_LIT:0.5> * q * ( <NUM_LIT:1> + d - c ) + <NUM_LIT:0.5> * c , <EOL> <NUM_LIT:1> - sqrt ( ( <NUM_LIT:1> - q ) * ( d - c + <NUM_LIT:1> ) * ( <NUM_LIT:1> - d ) ) ] <EOL> return np . select ( condlist , choicelist ) <EOL> trapz = trapz_gen ( a = <NUM_LIT:0.0> , b = <NUM_LIT:1.0> , name = "<STR_LIT>" ) <EOL> class triang_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _rvs ( self , c ) : <EOL> return self . _random_state . triangular ( <NUM_LIT:0> , c , <NUM_LIT:1> , self . _size ) <EOL> def _argcheck ( self , c ) : <EOL> return ( c >= <NUM_LIT:0> ) & ( c <= <NUM_LIT:1> ) <EOL> def _pdf ( self , x , c ) : <EOL> return where ( x < c , <NUM_LIT:2> * x / c , <NUM_LIT:2> * ( <NUM_LIT:1> - x ) / ( <NUM_LIT:1> - c ) ) <EOL> def _cdf ( self , x , c ) : <EOL> return where ( x < c , x * x / c , ( x * x - <NUM_LIT:2> * x + c ) / ( c - <NUM_LIT:1> ) ) <EOL> def _ppf ( self , q , c ) : <EOL> return where ( q < c , sqrt ( c * q ) , <NUM_LIT:1> - sqrt ( ( <NUM_LIT:1> - c ) * ( <NUM_LIT:1> - q ) ) ) <EOL> def _stats ( self , c ) : <EOL> return ( c + <NUM_LIT:1.0> ) / <NUM_LIT> , ( <NUM_LIT:1.0> - c + c * c ) / <NUM_LIT> , sqrt ( <NUM_LIT:2> ) * ( <NUM_LIT:2> * c - <NUM_LIT:1> ) * ( c + <NUM_LIT:1> ) * ( c - <NUM_LIT:2> ) / ( <NUM_LIT:5> * np . power ( ( <NUM_LIT:1.0> - c + c * c ) , <NUM_LIT> ) ) , - <NUM_LIT> / <NUM_LIT> <EOL> def _entropy ( self , c ) : <EOL> return <NUM_LIT:0.5> - log ( <NUM_LIT:2> ) <EOL> triang = triang_gen ( a = <NUM_LIT:0.0> , b = <NUM_LIT:1.0> , name = "<STR_LIT>" ) <EOL> class truncexpon_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _argcheck ( self , b ) : <EOL> self . b = b <EOL> return ( b > <NUM_LIT:0> ) <EOL> def _pdf ( self , x , b ) : <EOL> return exp ( - x ) / ( - special . expm1 ( - b ) ) <EOL> def _logpdf ( self , x , b ) : <EOL> return - x - log ( - special . expm1 ( - b ) ) <EOL> def _cdf ( self , x , b ) : <EOL> return special . expm1 ( - x ) / special . expm1 ( - b ) <EOL> def _ppf ( self , q , b ) : <EOL> return - special . log1p ( q * special . expm1 ( - b ) ) <EOL> def _munp ( self , n , b ) : <EOL> if n == <NUM_LIT:1> : <EOL> return ( <NUM_LIT:1> - ( b + <NUM_LIT:1> ) * exp ( - b ) ) / ( - special . expm1 ( - b ) ) <EOL> elif n == <NUM_LIT:2> : <EOL> return <NUM_LIT:2> * ( <NUM_LIT:1> - <NUM_LIT:0.5> * ( b * b + <NUM_LIT:2> * b + <NUM_LIT:2> ) * exp ( - b ) ) / ( - special . expm1 ( - b ) ) <EOL> else : <EOL> return self . _mom1_sc ( n , b ) <EOL> def _entropy ( self , b ) : <EOL> eB = exp ( b ) <EOL> return log ( eB - <NUM_LIT:1> ) + ( <NUM_LIT:1> + eB * ( b - <NUM_LIT:1.0> ) ) / ( <NUM_LIT:1.0> - eB ) <EOL> truncexpon = truncexpon_gen ( a = <NUM_LIT:0.0> , name = '<STR_LIT>' ) <EOL> class truncnorm_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _argcheck ( self , a , b ) : <EOL> self . a = a <EOL> self . b = b <EOL> self . _nb = _norm_cdf ( b ) <EOL> self . _na = _norm_cdf ( a ) <EOL> self . _sb = _norm_sf ( b ) <EOL> self . _sa = _norm_sf ( a ) <EOL> if self . a > <NUM_LIT:0> : <EOL> self . _delta = - ( self . _sb - self . _sa ) <EOL> else : <EOL> self . _delta = self . _nb - self . _na <EOL> self . _logdelta = log ( self . _delta ) <EOL> return ( a != b ) <EOL> def _pdf ( self , x , a , b ) : <EOL> return _norm_pdf ( x ) / self . _delta <EOL> def _logpdf ( self , x , a , b ) : <EOL> return _norm_logpdf ( x ) - self . _logdelta <EOL> def _cdf ( self , x , a , b ) : <EOL> return ( _norm_cdf ( x ) - self . _na ) / self . _delta <EOL> def _ppf ( self , q , a , b ) : <EOL> if self . a > <NUM_LIT:0> : <EOL> return _norm_isf ( q * self . _sb + self . _sa * ( <NUM_LIT:1.0> - q ) ) <EOL> else : <EOL> return _norm_ppf ( q * self . _nb + self . _na * ( <NUM_LIT:1.0> - q ) ) <EOL> def _stats ( self , a , b ) : <EOL> nA , nB = self . _na , self . _nb <EOL> d = nB - nA <EOL> pA , pB = _norm_pdf ( a ) , _norm_pdf ( b ) <EOL> mu = ( pA - pB ) / d <EOL> mu2 = <NUM_LIT:1> + ( a * pA - b * pB ) / d - mu * mu <EOL> return mu , mu2 , None , None <EOL> truncnorm = truncnorm_gen ( name = '<STR_LIT>' ) <EOL> class tukeylambda_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _argcheck ( self , lam ) : <EOL> return np . ones ( np . shape ( lam ) , dtype = bool ) <EOL> def _pdf ( self , x , lam ) : <EOL> Fx = asarray ( special . tklmbda ( x , lam ) ) <EOL> Px = Fx ** ( lam - <NUM_LIT:1.0> ) + ( asarray ( <NUM_LIT:1> - Fx ) ) ** ( lam - <NUM_LIT:1.0> ) <EOL> Px = <NUM_LIT:1.0> / asarray ( Px ) <EOL> return where ( ( lam <= <NUM_LIT:0> ) | ( abs ( x ) < <NUM_LIT:1.0> / asarray ( lam ) ) , Px , <NUM_LIT:0.0> ) <EOL> def _cdf ( self , x , lam ) : <EOL> return special . tklmbda ( x , lam ) <EOL> def _ppf ( self , q , lam ) : <EOL> return special . boxcox ( q , lam ) - special . boxcox1p ( - q , lam ) <EOL> def _stats ( self , lam ) : <EOL> return <NUM_LIT:0> , _tlvar ( lam ) , <NUM_LIT:0> , _tlkurt ( lam ) <EOL> def _entropy ( self , lam ) : <EOL> def integ ( p ) : <EOL> return log ( pow ( p , lam - <NUM_LIT:1> ) + pow ( <NUM_LIT:1> - p , lam - <NUM_LIT:1> ) ) <EOL> return integrate . quad ( integ , <NUM_LIT:0> , <NUM_LIT:1> ) [ <NUM_LIT:0> ] <EOL> tukeylambda = tukeylambda_gen ( name = '<STR_LIT>' ) <EOL> class uniform_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _rvs ( self ) : <EOL> return self . _random_state . uniform ( <NUM_LIT:0.0> , <NUM_LIT:1.0> , self . _size ) <EOL> def _pdf ( self , x ) : <EOL> return <NUM_LIT:1.0> * ( x == x ) <EOL> def _cdf ( self , x ) : <EOL> return x <EOL> def _ppf ( self , q ) : <EOL> return q <EOL> def _stats ( self ) : <EOL> return <NUM_LIT:0.5> , <NUM_LIT:1.0> / <NUM_LIT:12> , <NUM_LIT:0> , - <NUM_LIT> <EOL> def _entropy ( self ) : <EOL> return <NUM_LIT:0.0> <EOL> uniform = uniform_gen ( a = <NUM_LIT:0.0> , b = <NUM_LIT:1.0> , name = '<STR_LIT>' ) <EOL> class vonmises_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _rvs ( self , kappa ) : <EOL> return self . _random_state . vonmises ( <NUM_LIT:0.0> , kappa , size = self . _size ) <EOL> def _pdf ( self , x , kappa ) : <EOL> return exp ( kappa * cos ( x ) ) / ( <NUM_LIT:2> * pi * i0 ( kappa ) ) <EOL> def _cdf ( self , x , kappa ) : <EOL> return _stats . von_mises_cdf ( kappa , x ) <EOL> def _stats_skip ( self , kappa ) : <EOL> return <NUM_LIT:0> , None , <NUM_LIT:0> , None <EOL> def _entropy ( self , kappa ) : <EOL> return ( - kappa * i1 ( kappa ) / i0 ( kappa ) <EOL> + np . log ( <NUM_LIT:2> * np . pi * i0 ( kappa ) ) ) <EOL> vonmises = vonmises_gen ( name = '<STR_LIT>' ) <EOL> vonmises_line = vonmises_gen ( a = - np . pi , b = np . pi , name = '<STR_LIT>' ) <EOL> class wald_gen ( invgauss_gen ) : <EOL> """<STR_LIT>""" <EOL> def _rvs ( self ) : <EOL> return self . _random_state . wald ( <NUM_LIT:1.0> , <NUM_LIT:1.0> , size = self . _size ) <EOL> def _pdf ( self , x ) : <EOL> return invgauss . _pdf ( x , <NUM_LIT:1.0> ) <EOL> def _logpdf ( self , x ) : <EOL> return invgauss . _logpdf ( x , <NUM_LIT:1.0> ) <EOL> def _cdf ( self , x ) : <EOL> return invgauss . _cdf ( x , <NUM_LIT:1.0> ) <EOL> def _stats ( self ) : <EOL> return <NUM_LIT:1.0> , <NUM_LIT:1.0> , <NUM_LIT> , <NUM_LIT> <EOL> wald = wald_gen ( a = <NUM_LIT:0.0> , name = "<STR_LIT>" ) <EOL> class wrapcauchy_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _argcheck ( self , c ) : <EOL> return ( c > <NUM_LIT:0> ) & ( c < <NUM_LIT:1> ) <EOL> def _pdf ( self , x , c ) : <EOL> return ( <NUM_LIT:1.0> - c * c ) / ( <NUM_LIT:2> * pi * ( <NUM_LIT:1> + c * c - <NUM_LIT:2> * c * cos ( x ) ) ) <EOL> def _cdf ( self , x , c ) : <EOL> output = np . zeros ( x . shape , dtype = x . dtype ) <EOL> val = ( <NUM_LIT:1.0> + c ) / ( <NUM_LIT:1.0> - c ) <EOL> c1 = x < pi <EOL> c2 = <NUM_LIT:1> - c1 <EOL> xp = extract ( c1 , x ) <EOL> xn = extract ( c2 , x ) <EOL> if np . any ( xn ) : <EOL> valn = extract ( c2 , np . ones_like ( x ) * val ) <EOL> xn = <NUM_LIT:2> * pi - xn <EOL> yn = tan ( xn / <NUM_LIT> ) <EOL> on = <NUM_LIT:1.0> - <NUM_LIT:1.0> / pi * arctan ( valn * yn ) <EOL> place ( output , c2 , on ) <EOL> if np . any ( xp ) : <EOL> valp = extract ( c1 , np . ones_like ( x ) * val ) <EOL> yp = tan ( xp / <NUM_LIT> ) <EOL> op = <NUM_LIT:1.0> / pi * arctan ( valp * yp ) <EOL> place ( output , c1 , op ) <EOL> return output <EOL> def _ppf ( self , q , c ) : <EOL> val = ( <NUM_LIT:1.0> - c ) / ( <NUM_LIT:1.0> + c ) <EOL> rcq = <NUM_LIT:2> * arctan ( val * tan ( pi * q ) ) <EOL> rcmq = <NUM_LIT:2> * pi - <NUM_LIT:2> * arctan ( val * tan ( pi * ( <NUM_LIT:1> - q ) ) ) <EOL> return where ( q < <NUM_LIT:1.0> / <NUM_LIT:2> , rcq , rcmq ) <EOL> def _entropy ( self , c ) : <EOL> return log ( <NUM_LIT:2> * pi * ( <NUM_LIT:1> - c * c ) ) <EOL> wrapcauchy = wrapcauchy_gen ( a = <NUM_LIT:0.0> , b = <NUM_LIT:2> * pi , name = '<STR_LIT>' ) <EOL> class gennorm_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x , beta ) : <EOL> return np . exp ( self . _logpdf ( x , beta ) ) <EOL> def _logpdf ( self , x , beta ) : <EOL> return np . log ( <NUM_LIT> * beta ) - special . gammaln ( <NUM_LIT:1.> / beta ) - abs ( x ) ** beta <EOL> def _cdf ( self , x , beta ) : <EOL> c = <NUM_LIT> * np . sign ( x ) <EOL> return ( <NUM_LIT> + c ) - c * special . gammaincc ( <NUM_LIT:1.> / beta , abs ( x ) ** beta ) <EOL> def _ppf ( self , x , beta ) : <EOL> c = np . sign ( x - <NUM_LIT> ) <EOL> return c * special . gammainccinv ( <NUM_LIT:1.> / beta , ( <NUM_LIT:1.> + c ) - <NUM_LIT> * c * x ) ** ( <NUM_LIT:1.> / beta ) <EOL> def _sf ( self , x , beta ) : <EOL> return self . _cdf ( - x , beta ) <EOL> def _isf ( self , x , beta ) : <EOL> return - self . _ppf ( x , beta ) <EOL> def _stats ( self , beta ) : <EOL> c1 , c3 , c5 = special . gammaln ( [ <NUM_LIT:1.> / beta , <NUM_LIT> / beta , <NUM_LIT> / beta ] ) <EOL> return <NUM_LIT:0.> , np . exp ( c3 - c1 ) , <NUM_LIT:0.> , np . exp ( c5 + c1 - <NUM_LIT> * c3 ) - <NUM_LIT> <EOL> def _entropy ( self , beta ) : <EOL> return <NUM_LIT:1.> / beta - np . log ( <NUM_LIT> * beta ) + special . gammaln ( <NUM_LIT:1.> / beta ) <EOL> gennorm = gennorm_gen ( name = '<STR_LIT>' ) <EOL> class halfgennorm_gen ( rv_continuous ) : <EOL> """<STR_LIT>""" <EOL> def _pdf ( self , x , beta ) : <EOL> return np . exp ( self . _logpdf ( x , beta ) ) <EOL> def _logpdf ( self , x , beta ) : <EOL> return np . log ( beta ) - special . gammaln ( <NUM_LIT:1.> / beta ) - x ** beta <EOL> def _cdf ( self , x , beta ) : <EOL> return special . gammainc ( <NUM_LIT:1.> / beta , x ** beta ) <EOL> def _ppf ( self , x , beta ) : <EOL> return special . gammaincinv ( <NUM_LIT:1.> / beta , x ) ** ( <NUM_LIT:1.> / beta ) <EOL> def _sf ( self , x , beta ) : <EOL> return special . gammaincc ( <NUM_LIT:1.> / beta , x ** beta ) <EOL> def _isf ( self , x , beta ) : <EOL> return special . gammainccinv ( <NUM_LIT:1.> / beta , x ) ** ( <NUM_LIT:1.> / beta ) <EOL> def _entropy ( self , beta ) : <EOL> return <NUM_LIT:1.> / beta - np . log ( beta ) + special . gammaln ( <NUM_LIT:1.> / beta ) <EOL> halfgennorm = halfgennorm_gen ( a = <NUM_LIT:0> , name = '<STR_LIT>' ) <EOL> pairs = list ( globals ( ) . items ( ) ) <EOL> _distn_names , _distn_gen_names = get_distribution_names ( pairs , rv_continuous ) <EOL> __all__ = _distn_names + _distn_gen_names </s>
