Generate pseudo random-number from an asymmetric power exponential distribution using the Tadikamalla method. This codes is the original version of Bottazzi (2004)
rasubbo_orig(n, m = 0, al = 1, ar = 1, bl = 2, br = 2)
a numeric vector containing a random sample.
(int) - size of the sample.
(numeric) - location parameter.
(numeric) - scale parameters.
(numeric) - shape parameters.
The AEP distribution is expressed by the function:
$$f(x;a_l,a_r,b_l,b_r,m) =
\frac{1}{A} e^{- \frac{1}{b_l} |\frac{x-m}{a_l}|^{b_l} }, x < m
$$
$$f(x;a_l,a_r,b_l,b_r,m) =
\frac{1}{A} e^{- \frac{1}{b_r} |\frac{x-m}{a_r}|^{b_r} }, x > m
$$
with:
$$A = a_lb_l^{1/b_l}\Gamma(1+1/b_l) + a_rb_r^{1/b_r}\Gamma(1+1/b_r)$$
where \(m\) is a location parameter, \(b*\) are shape parameters, \(a*\)
are scale parameters and \(\Gamma\) represents the gamma function.
By a suitably transformation, it is possible to use the EP distribution with
the Tadikamalla method to sample from this distribution. We basically take
the absolute values of the numbers sampled from the rpower
function,
which is equivalent from sampling from a half Exponential Power distribution.
These values are then weighted by a constant expressed in the parameters.
More details are available on the package vignette and on the
function rpower
.
sample_gamma <- rasubbo(1000, 0, 0.5, 0.5, 1, 1)
Run the code above in your browser using DataLab