## distributions.PearsonVI


Pearson Type VI distribution implementation (inverted beta distribution).


Usage

``` python
distributions.PearsonVI(
    alpha1,
    alpha2,
    beta,
    random_seed=None,
)
```


Where: - alpha1 = shape parameter 1 (\> 0) - alpha2 = shape parameter 2 (\> 0) - beta = scale (\> 0)

Law (2007, pg 294-295) notes that PearsonVI can be used to model the time to complete a task.

For certain values of the shape parameters, the mean and variance can be directly computed. See functions mean() and var() for details.


## Sampling:

Pearson6(a1,a2,b) = b\*X/(1-X), where X=Beta(a1,a2)

This class conforms to the Distribution protocol.


## Sources:

\[1\] https://riskwiki.vosesoftware.com/PearsonType6distribution.php


## Note

A good R package for Pearson distributions is PearsonDS https://www.rdocumentation.org/packages/PearsonDS/versions/1.3.0


## Attributes

| Name | Description |
|----|----|
| [mean](#mean) | Calculate the mean of the Pearson Type VI distribution. |
| [variance](#variance) | Calculate the variance of the Pearson Type VI distribution. |

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


#### mean


Calculate the mean of the Pearson Type VI distribution.


`mean: float`


##### Raises


`ValueError`  
If alpha2 \<= 1.0, as the mean is not defined in this case.


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


#### variance


Calculate the variance of the Pearson Type VI distribution.


`variance: float`


##### Raises


`ValueError`  
If alpha2 \<= 2.0, as the variance is not defined in this case.


## Methods

| Name | Description |
|----|----|
| [__init__()](#__init__) | Initialize a Pearson Type VI distribution. |
| [sample()](#sample) | Generate random samples from the Pearson Type VI distribution. |

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


#### \_\_init\_\_()


Initialize a Pearson Type VI distribution.


Usage

``` python
__init__(alpha1, alpha2, beta, random_seed=None)
```


##### Parameters


`alpha1: float`  
Shape parameter 1. Must be \> 0.

`alpha2: float`  
Shape parameter 2. Must be \> 0.

`beta: float`  
Scale parameter. Must be \> 0.

`random_seed: Optional[Union[int, SeedSequence]] = None`  
A random seed or SeedSequence to reproduce samples. If None, a unique sample sequence is generated.


##### Raises


`ValueError`  
If any of the parameters are not positive.


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


#### sample()


Generate random samples from the Pearson Type VI distribution.


Usage

``` python
sample(size=None)
```


##### Parameters


`size: Optional[Union[int, Tuple[int, …]]] = None`  
The number/shape of samples to generate:

- If None: returns a single sample as a float
- If int: returns a 1-D array with that many samples
- If tuple of ints: returns an array with that shape


##### Returns


`Union[float, NDArray[np.float64]]`  
Random samples from the Pearson Type VI distribution:

- A single float when size is None
- A numpy array of floats with shape determined by size parameter
