virocon.distributions module

class virocon.distributions.ExponentiatedWeibullDistribution(alpha=1, beta=1, delta=1, f_alpha=None, f_beta=None, f_delta=None)[source]

Bases: virocon.distributions.Distribution

An exponentiated Weibull distribution.

The parametrization used is the same as described by Haselsteiner et al. (2019) [1]_. The distributions cumulative distribution function is given by:

\(F(x) = \left[ 1- \exp \left(-\left( \frac{x}{\alpha} \right)^{\beta} \right) \right] ^{\delta}\)

Parameters
  • alpha (float) – Scale parameter of the exponentiated weibull distribution. Defaults to 1.

  • beta (float) – First shape parameter of the exponentiated weibull distribution. Defaults to 1.

  • delta (float) – Second shape parameter of the exponentiated weibull distribution. Defaults to 1.

  • f_alpha (float) – Fixed alpha parameter of the weibull distribution (e.g. given physical parameter). If this parameter is set, alpha is ignored. Defaults to None.

  • f_beta (float) – Fixed beta parameter of the weibull distribution (e.g. given physical parameter). If this parameter is set, beta is ignored. Defaults to None.

  • f_delta (float) – Fixed delta parameter of the weibull distribution (e.g. given physical parameter). If this parameter is set, delta is ignored. Defaults to None.

References

1

Haselsteiner, A.F.; Thoben, K.D. (2019) Predicting wave heights for marine design by prioritizing extreme events in a global model, Renewable Energy, Volume 156, August 2020, Pages 1146-1157; https://doi.org/10.1016/j.renene.2020.04.112

cdf(x, alpha=None, beta=None, delta=None)[source]

Cumulative distribution function.

draw_sample(n, alpha=None, beta=None, delta=None)[source]

Draw a random sample of length n.

icdf(prob, alpha=None, beta=None, delta=None)[source]

Inverse cumulative distribution function.

property parameters

Parameters of the probability distribution.

Dict of the form: {“<parameter_name>” : <parameter_value>, …}

pdf(x, alpha=None, beta=None, delta=None)[source]

Probability density function.

class virocon.distributions.LogNormalDistribution(mu=0, sigma=1, f_mu=None, f_sigma=None)[source]

Bases: virocon.distributions.Distribution

A Lognormal Distribution.

The distributions probability density function is given by [1]_:

\(f(x) = \frac{1}{x\widetilde{\sigma} \sqrt{2\pi}}\exp \left[ \frac{-(\ln x - \widetilde{\mu})^2}{2\widetilde{\sigma}^2}\right]\)

Parameters
  • mu (float) – Mean parameter of the corresponding normal distribution. Defaults to 0.

  • sigma (float) – Standard deviation of the corresponding normal distribution. Defaults to 1.

  • f_mu (float) – Fixed parameter mu of the lognormal distribution (e.g. given physical parameter). If this parameter is set, mu is ignored. Defaults to None.

  • f_sigma (float) – Fixed parameter sigma of the lognormal distribution (e.g. given physical parameter). If this parameter is set, sigma is ignored. Defaults to None

References

1

Forbes, C.; Evans, M.; Hastings, N; Peacock, B. (2011) Statistical Distributions, 4th Edition, Published by John Wiley & Sons, Inc., Hoboken, New Jersey., Pages 131-132

cdf(x, mu=None, sigma=None)[source]

Cumulative distribution function.

Parameters
  • x (array_like,) – Points at which the cdf is evaluated. Shape: 1-dimensional.

  • mu (float, optional) – The variance parameter. Defaults to self.mu .

  • sigma (float, optional) – The shape parameter. Defaults to self.sigma .

draw_sample(n, mu=None, sigma=None)[source]

Draw a random sample of length n.

icdf(prob, mu=None, sigma=None)[source]

Inverse cumulative distribution function.

Parameters
  • prob (Probabilities for which the i_cdf is evaluated.) – Shape: 1-dimensional

  • mu (float, optional) – The variance parameter. Defaults to self.mu .

  • sigma (float, optional) – The shape parameter. Defaults to self.sigma .

property parameters

Parameters of the probability distribution.

Dict of the form: {“<parameter_name>” : <parameter_value>, …}

pdf(x, mu=None, sigma=None)[source]

Probability density function.

Parameters
  • x (array_like,) – Points at which the pdf is evaluated. Shape: 1-dimensional.

  • mu (float, optional) – The variance parameter. Defaults to self.mu .

  • sigma (float, optional) – The shape parameter. Defaults to self.sigma .

class virocon.distributions.NormalDistribution(mu=0, sigma=1, f_mu=None, f_sigma=None)[source]

Bases: virocon.distributions.Distribution

A Normal (Gaussian) Distribution.

The distributions probability density function is given by [1]_:

\(f(x) = \frac{1}{{\sigma} \sqrt{2\pi}} \exp \left( - \frac{( x - \mu)^2}{2\sigma^2}\right)\)

Parameters
  • mu (float) – Location parameter, the mean. Defaults to 0.

  • sigma (float) – Scale parameter, the standard deviation. Defaults to 1.

  • f_mu (float) – Fixed parameter mu of the normal distribution (e.g. given physical parameter). If this parameter is set, mu is ignored. Defaults to None.

  • f_sigma (float) – Fixed parameter sigma of the normal distribution (e.g. given physical parameter). If this parameter is set, sigma is ignored. Defaults to None

References

1

Forbes, C.; Evans, M.; Hastings, N; Peacock, B. (2011) Statistical Distributions, 4th Edition, Published by John Wiley & Sons, Inc., Hoboken, New Jersey., Page 143

cdf(x, mu=None, sigma=None)[source]

Cumulative distribution function.

Parameters
  • x (array_like,) – Points at which the cdf is evaluated. Shape: 1-dimensional.

  • mu (float, optional) – The location parameter. Defaults to self.mu .

  • sigma (float, optional) – The scale parameter. Defaults to self.sigma .

draw_sample(n, mu=None, sigma=None)[source]

Draw a random sample of length n.

icdf(prob, mu=None, sigma=None)[source]

Inverse cumulative distribution function.

Parameters
  • prob (Probabilities for which the i_cdf is evaluated.) – Shape: 1-dimensional

  • mu (float, optional) – The location parameter. Defaults to self.mu .

  • sigma (float, optional) – The scale parameter. Defaults to self.sigma .

property parameters

Parameters of the probability distribution.

Dict of the form: {“<parameter_name>” : <parameter_value>, …}

pdf(x, mu=None, sigma=None)[source]

Probability density function.

Parameters
  • x (array_like,) – Points at which the pdf is evaluated. Shape: 1-dimensional.

  • mu (float, optional) – The location parameter. Defaults to self.mu .

  • sigma (float, optional) – The scale parameter. Defaults to self.sigma .

class virocon.distributions.WeibullDistribution(alpha=1, beta=1, gamma=0, f_alpha=None, f_beta=None, f_gamma=None)[source]

Bases: virocon.distributions.Distribution

A weibull distribution.

The distributions probability density function is given by [1]_ :

\(f(x) = \frac{\beta}{\alpha} \left (\frac{x-\gamma}{\alpha} \right)^{\beta -1} \exp \left[-\left( \frac{x-\gamma}{\alpha} \right)^{\beta} \right]\)

Parameters
  • alpha (float) – Scale parameter of the weibull distribution. Defaults to 1.

  • beta (float) – Shape parameter of the weibull distribution. Defaults to 1.

  • gamma (float) – Location parameter of the weibull distribution (3-parameter weibull distribution). Defaults to 0.

  • f_alpha (float) – Fixed scale parameter of the weibull distribution (e.g. given physical parameter). If this parameter is set, lambda is ignored. Defaults to None.

  • f_beta (float) – Fixed shape parameter of the weibull distribution (e.g. given physical parameter). If this parameter is set, k is ignored. Defaults to None.

  • f_gamma (float) – Fixed location parameter of the weibull distribution (e.g. given physical parameter). If this parameter is set, theta is ignored. Defaults to None.

References

1

Haselsteiner, A.F.; Ohlendorf, J.H.; Wosniok, W.; Thoben, K.D.(2017) Deriving environmental contours from highest density regions. Coastal Engineering 123 (2017) 42–51.

cdf(x, alpha=None, beta=None, gamma=None)[source]

Cumulative distribution function.

Parameters
  • x (array_like,) – Points at which the cdf is evaluated. Shape: 1-dimensional.

  • alpha (float, optional) – The scale parameter. Defaults to self.alpha.

  • beta (float, optional) – The shape parameter. Defaults to self.beta.

  • gamma (float, optional) – The location parameter . Defaults to self.gamma.

draw_sample(n, alpha=None, beta=None, gamma=None)[source]

Draw a random sample of length n.

icdf(prob, alpha=None, beta=None, gamma=None)[source]

Inverse cumulative distribution function.

Parameters

prob (array_like) – Probabilities for which the i_cdf is evaluated. Shape: 1-dimensional

alphafloat, optional

The scale parameter. Defaults to self.aplha .

betafloat, optional

The shape parameter. Defaults to self.beta.

gamma: float, optional

The location parameter . Defaults to self.gamma.

property parameters

Parameters of the probability distribution.

Dict of the form: {“<parameter_name>” : <parameter_value>, …}

pdf(x, alpha=None, beta=None, gamma=None)[source]

Probability density function.

Parameters
  • x (array_like,) – Points at which the pdf is evaluated. Shape: 1-dimensional.

  • alpha (float, optional) – The scale parameter. Defaults to self.alpha.

  • beta (float, optional) – The shape parameter. Defaults to self.beta.

  • gamma (float, optional) – The location parameter . Defaults to self.gamma.