virocon.distributions module¶
Distributions for single variables.
- 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) 4. 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. The fixed parameter does not change, even when fitting the distribution. 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. The fixed parameter does not change, even when fitting the distribution. 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. The fixed parameter does not change, even when fitting the distribution. Defaults to None.
References
- 4
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
- draw_sample(n, alpha=None, beta=None, delta=None, *, random_state=None)[source]¶
Draw a random sample of length n.
- nfloat
Number of observations that shall be drawn.
- args, kwargsfloat, optional
Parameter of the distribution
- random_state{None, int, numpy.random.Generator}, optional
Can be used to draw a reproducible sample.
- property parameters¶
Parameters of the probability distribution.
Dict of the form: {“<parameter_name>” : <parameter_value>, …}
- class virocon.distributions.GeneralizedGammaDistribution(m=1, c=1, lambda_=1, f_m=None, f_c=None, f_lambda_=None)[source]¶
Bases:
virocon.distributions.Distribution
A 3-parameter generalized Gamma distribution.
The parametrization is orientated on 5 :
\(f(x) = \frac{ \lambda^{cm} cx^{cm-1} \exp \left[ - \left(\lambda x^{c} \right) \right] }{\Gamma(m)}\)
- Parameters
m (float) – First shape parameter of the generalized Gamma distribution. Defaults to 1.
c (float) – Second shape parameter of the generalized Gamma distribution. Defaults to 1.
lambda_ (float) – Scale parameter of the generalized Gamma distribution. Defaults to 1.
f_m (float) – Fixed shape parameter of the generalized Gamma distribution (e.g. given physical parameter). If this parameter is set, m is ignored. The fixed parameter does not change, even when fitting the distribution. Defaults to None.
f_c (float) – Fixed second shape parameter of the generalized Gamma distribution (e.g. given physical parameter). If this parameter is set, c is ignored. The fixed parameter does not change, even when fitting the distribution. Defaults to None.
f_lambda_ (float) – Fixed reciprocal scale parameter of the generalized Gamma distribution (e.g. given physical parameter). If this parameter is set, lambda_ is ignored. The fixed parameter does not change, even when fitting the distribution. Defaults to None.
References
- 5
M.K. Ochi, New approach for estimating the severest sea state from statistical data , Coast. Eng. Chapter 38 (1992) pp. 512-525.
- draw_sample(n, m=None, c=None, lambda_=None, random_state=None)[source]¶
Draw a random sample of length n.
- nfloat
Number of observations that shall be drawn.
- args, kwargsfloat, optional
Parameter of the distribution
- random_state{None, int, numpy.random.Generator}, optional
Can be used to draw a reproducible sample.
- icdf(prob, m=None, c=None, lambda_=None)[source]¶
Inverse cumulative distribution function.
- Parameters
prob (array_like) – Probabilities for which the i_cdf is evaluated. Shape: 1-dimensional
m (float, optional) – First shape parameter. Defaults to self.m.
c (float, optional) – The second shape parameter. Defaults to self.c.
lambda (float, optional) – The reciprocal scale parameter . Defaults to self.lambda_.
- property parameters¶
Parameters of the probability distribution.
Dict of the form: {“<parameter_name>” : <parameter_value>, …}
- 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 [2]_:
\(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. The fixed parameter does not change, even when fitting the distribution. 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. The fixed parameter does not change, even when fitting the distribution. Defaults to None.
References
- 2
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
- draw_sample(n, mu=None, sigma=None, *, random_state=None)[source]¶
Draw a random sample of length n.
- nfloat
Number of observations that shall be drawn.
- args, kwargsfloat, optional
Parameter of the distribution
- random_state{None, int, numpy.random.Generator}, optional
Can be used to draw a reproducible sample.
- property parameters¶
Parameters of the probability distribution.
Dict of the form: {“<parameter_name>” : <parameter_value>, …}
- 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 3:
\(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. The fixed parameter does not change, even when fitting the distribution. 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. The fixed parameter does not change, even when fitting the distribution. Defaults to None.
References
- 3
Forbes, C.; Evans, M.; Hastings, N; Peacock, B. (2011) Statistical Distributions, 4th Edition, Published by John Wiley & Sons, Inc., Hoboken, New Jersey., Page 143
- draw_sample(n, mu=None, sigma=None, *, random_state=None)[source]¶
Draw a random sample of length n.
- nfloat
Number of observations that shall be drawn.
- args, kwargsfloat, optional
Parameter of the distribution
- random_state{None, int, numpy.random.Generator}, optional
Can be used to draw a reproducible sample.
- property parameters¶
Parameters of the probability distribution.
Dict of the form: {“<parameter_name>” : <parameter_value>, …}
- class virocon.distributions.ScipyDistribution(*args, **kwargs)[source]¶
Bases:
virocon.distributions.Distribution
A base class used for virocon distributions derived from a scipy distribution.
To create a new virocon distribution inherit from ScipyDistribution and overwrite either scipy_dist or scipy_dist_name.
- scipy_dist¶
A continuous distribution defined in scipy. (Or acting like a distribution defined there.)
- Type
sts.rv_continuous
- draw_sample(n, *args, random_state=None, **kwargs)[source]¶
Draw a random sample of length n.
- nfloat
Number of observations that shall be drawn.
- args, kwargsfloat, optional
Parameter of the distribution
- random_state{None, int, numpy.random.Generator}, optional
Can be used to draw a reproducible sample.
- property parameters¶
Parameters of the probability distribution.
Dict of the form: {“<parameter_name>” : <parameter_value>, …}
- scipy_dist: scipy.stats._distn_infrastructure.rv_continuous¶
- class virocon.distributions.VonMisesDistribution(kappa=1, mu=0, f_kappa=None, f_mu=None)[source]¶
Bases:
virocon.distributions.Distribution
A Von Mises (Circular Norm) Distribution.
The distributions probability density function is given by [1]_:
\(f(x) = \frac{\exp{(\kappa \cos{(x - \mu)})}}{2 \pi I_0(\kappa)}\)
The distribution is used to model wind-wave misalignment in [2]_. Being a circular norm distribution it can be used to model direction.
- Parameters
kappa (float) – Shape parameter Defaults to 1.
mu (float) – Location parameter, the mean. Defaults to 0.
f_kappa (float) – Fixed parameter kappa of the von mises distribution (e.g. given physical parameter). If this parameter is set, kappa is ignored. Defaults to None.
f_mu (float) – Fixed parameter mu of the von mises distribution (e.g. given physical parameter). If this parameter is set, mu is ignored. Defaults to None.
References
- 1
Mardia, Kantilal; Jupp, Peter E. (1999). Directional Statistics. Wiley. ISBN 978-0-471-95333-3.
- 2
Stewart G M, Robertson A, Jonkman J and Lackner M A 2016 The creation of a comprehensive metocean data set for offshore wind turbine simulations: Comprehensive metocean data set Wind Energy 19 1151–9
- draw_sample(n, kappa=None, mu=None, random_state=None)[source]¶
Draw a random sample of length n.
- nfloat
Number of observations that shall be drawn.
- args, kwargsfloat, optional
Parameter of the distribution
- random_state{None, int, numpy.random.Generator}, optional
Can be used to draw a reproducible sample.
- property parameters¶
Parameters of the probability distribution.
Dict of the form: {“<parameter_name>” : <parameter_value>, …}
- 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, alpha is ignored. The fixed parameter does not change, even when fitting the distribution. Defaults to None.
f_beta (float) – Fixed shape parameter of the weibull distribution (e.g. given physical parameter). If this parameter is set, beta is ignored. The fixed parameter does not change, even when fitting the distribution. Defaults to None.
f_gamma (float) – Fixed location parameter of the weibull distribution (e.g. given physical parameter). If this parameter is set, gamma is ignored. The fixed parameter does not change, even when fitting the distribution. 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.
- draw_sample(n, alpha=None, beta=None, gamma=None, *, random_state=None)[source]¶
Draw a random sample of length n.
- nfloat
Number of observations that shall be drawn.
- args, kwargsfloat, optional
Parameter of the distribution
- random_state{None, int, numpy.random.Generator}, optional
Can be used to draw a reproducible sample.
- 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
alpha (float, optional) – The scale parameter. Defaults to self.aplha .
beta (float, 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>, …}