Ejemplo n.º 1
0
def Lognormal(mu=0, sigma=1, shift=0, scale=1):
    R"""
Log-normal distribution

Parameters
----------
mu : float, Dist
    Mean in the normal distribution.
    Overlaps with scale by mu=log(scale)
sigma : float, Dist
    Standard deviation of the normal distribution.
shift : float, Dist
    Location of the lower bound.
scale : float, Dist
    Scale parameter.
    Overlaps with mu by scale=e**mu

Examples
--------
>>> cp.seed(1000)
>>> f = cp.Lognormal(0, 1)
>>> q = np.linspace(0,1,6)[1:-1]
>>> print f.inv(q)
[ 0.43101119  0.77619841  1.28833038  2.32012539]
>>> print f.fwd(f.inv(q))
[ 0.2  0.4  0.6  0.8]
>>> print f.sample(4)
[ 1.48442856  0.30109692  5.19451094  0.95632796]
>>> print f.mom(1)
1.6487212707
    """
    dist = co.lognormal(sigma)*scale*np.e**mu + shift
    dist.addattr(str="Lognormal(%s,%s,%s,%s)"%(mu,sigma,shift,scale))
    return dist
Ejemplo n.º 2
0
def Lognormal(mu=0, sigma=1, shift=0, scale=1):
    R"""
Log-normal distribution

Parameters
----------
mu : float, Dist
    Mean in the normal distribution.
    Overlaps with scale by mu=log(scale)
sigma : float, Dist
    Standard deviation of the normal distribution.
shift : float, Dist
    Location of the lower bound.
scale : float, Dist
    Scale parameter.
    Overlaps with mu by scale=e**mu

Examples
--------
>>> cp.seed(1000)
>>> f = cp.Lognormal(0, 1)
>>> q = np.linspace(0,1,6)[1:-1]
>>> print f.inv(q)
[ 0.43101119  0.77619841  1.28833038  2.32012539]
>>> print f.fwd(f.inv(q))
[ 0.2  0.4  0.6  0.8]
>>> print f.sample(4)
[ 1.48442856  0.30109692  5.19451094  0.95632796]
>>> print f.mom(1)
1.6487212707
    """
    dist = co.lognormal(sigma) * scale * np.e**mu + shift
    dist.addattr(str="Lognormal(%s,%s,%s,%s)" % (mu, sigma, shift, scale))
    return dist
Ejemplo n.º 3
0
def Gilbrat(scale=1, shift=0):
    """
Gilbrat distribution
Standard log-normal distribution

Parameters
----------
scale :  float, Dist
    Scaling parameter
shift :  float, Dist
    Location parameter
    """
    dist = co.lognormal(1)*scale + shift
    dist.addattr(str="Gilbrat(%s,%s)"%(scale, shift))
    return dist
Ejemplo n.º 4
0
def Gilbrat(scale=1, shift=0):
    """
Gilbrat distribution
Standard log-normal distribution

Parameters
----------
scale :  float, Dist
    Scaling parameter
shift :  float, Dist
    Location parameter
    """
    dist = co.lognormal(1) * scale + shift
    dist.addattr(str="Gilbrat(%s,%s)" % (scale, shift))
    return dist