## distributions.Lognormal


Lognormal distribution: `ln X ~ Normal(meanlog, sdlog**2)`.


Usage


``` python
distributions.Lognormal()
```


## Parameters


`meanlog: float`  
Mean of `ln X`.

`sdlog: float`  
Standard deviation of `ln X`; must be positive.


## Raises


`ValueError`  
If [meanlog](distributions.Lognormal.md#prospicio.distributions.Lognormal.meanlog) is not finite or [sdlog](distributions.Lognormal.md#prospicio.distributions.Lognormal.sdlog) is not positive and finite.


## Examples

``` python
>>> from prospicio.distributions import Lognormal
>>> d = Lognormal.from_mean_cv(1000.0, 0.5)
>>> round(d.mean(), 6)
```

1000.0


## Attributes

| Name | Description |
|----|----|
| [meanlog](#meanlog) | Mean of `ln X`. |
| [sdlog](#sdlog) | Standard deviation of `ln X`. |

------------------------------------------------------------------------


#### meanlog


Mean of `ln X`.


`meanlog: float`


------------------------------------------------------------------------


#### sdlog


Standard deviation of `ln X`.


`sdlog: float`


## Methods

| Name | Description |
|----|----|
| [cdf()](#cdf) | Distribution function `P(X <= x)`. |
| [from_mean_cv()](#from_mean_cv) | Lognormal with the given mean and coefficient of variation. |
| [layer()](#layer) | Expected loss to the layer [limit](reinsurance.Layer.md#prospicio.reinsurance.Layer.limit) xs [attachment](reinsurance.Layer.md#prospicio.reinsurance.Layer.attachment). |
| [lev()](#lev) | Limited expected value `E[min(X, limit)]`. |
| [mean()](#mean) | Mean of the distribution. |
| [quantile()](#quantile) | Quantile: the smallest [x](pricing.TabulatedCurve.md#prospicio.pricing.TabulatedCurve.x) with `P(X <= x) >= p`. |
| [sample()](#sample) | [n](distributions.Binomial.md#prospicio.distributions.Binomial.n) draws from stream `stream` of the generator keyed by [seed](aggregate.EventSet.md#prospicio.aggregate.EventSet.seed). |
| [std()](#std) | Standard deviation of the distribution. |
| [stop_loss()](#stop_loss) | Expected excess over a retention, `E[max(X - retention, 0)]`, |
| [variance()](#variance) | Variance of the distribution. |

------------------------------------------------------------------------


#### cdf()


Distribution function `P(X <= x)`.


Usage


``` python
cdf(x)
```


##### Parameters


`x: float`  


##### Returns


`float`  


------------------------------------------------------------------------


#### from_mean_cv()


Lognormal with the given mean and coefficient of variation.


Usage


``` python
from_mean_cv(mean, cv)
```


##### Parameters


`mean: float`  
Mean of `X`; must be positive.

`cv: float`  
Coefficient of variation of `X`; must be positive.


##### Returns


`Lognormal`  


##### Raises


`ValueError`  
If [mean](risk.Gpd.md#prospicio.risk.Gpd.mean) or `cv` is not positive and finite.


------------------------------------------------------------------------


#### layer()


Expected loss to the layer [limit](reinsurance.Layer.md#prospicio.reinsurance.Layer.limit) xs [attachment](reinsurance.Layer.md#prospicio.reinsurance.Layer.attachment).


Usage


``` python
layer(limit, attachment)
```


##### Parameters


`limit: float`  

`attachment: float`  


##### Returns


`float`  


##### Examples

``` python
>>> from prospicio.distributions import Lognormal
>>> d = Lognormal(7.0, 0.5)
>>> abs(d.layer(1000.0, 0.0) - d.lev(1000.0)) < 1e-9
```

True

------------------------------------------------------------------------


#### lev()


Limited expected value `E[min(X, limit)]`.


Usage


``` python
lev(limit)
```


##### Parameters


`limit: float`  


##### Returns


`float`  


------------------------------------------------------------------------


#### mean()


Mean of the distribution.


Usage


``` python
mean()
```


##### Returns


`float`  


------------------------------------------------------------------------


#### quantile()


Quantile: the smallest [x](pricing.TabulatedCurve.md#prospicio.pricing.TabulatedCurve.x) with `P(X <= x) >= p`.


Usage


``` python
quantile(p)
```


##### Parameters


`p: float`  
Probability in `[0, 1]`; `quantile(1.0)` is `inf`.


##### Returns


`float`  


##### Raises


`ValueError`  
If [p](models.Elpd.md#prospicio.models.Elpd.p) is outside `[0, 1]`.


------------------------------------------------------------------------


#### sample()


[n](distributions.Binomial.md#prospicio.distributions.Binomial.n) draws from stream `stream` of the generator keyed by [seed](aggregate.EventSet.md#prospicio.aggregate.EventSet.seed).


Usage


``` python
sample(n, seed, stream=0)
```


The same `(seed, stream)` gives the same draws in Python, R and Rust.


##### Parameters


`n: int`  
Number of draws.

`seed: int`  
Generator seed.

`stream: int = ``0`  
Stream id; distinct streams are independent.


##### Returns


`list of float`  


------------------------------------------------------------------------


#### std()


Standard deviation of the distribution.


Usage


``` python
std()
```


##### Returns


`float`  


------------------------------------------------------------------------


#### stop_loss()


Expected excess over a retention, `E[max(X - retention, 0)]`,


Usage


``` python
stop_loss(retention)
```


accurate far into the tail.


##### Parameters


`retention: float`  


##### Returns


`float`  


------------------------------------------------------------------------


#### variance()


Variance of the distribution.


Usage


``` python
variance()
```


##### Returns


`float`
