SMNGmoments {BayesLN} | R Documentation |
SMNG Moments and Moment Generating Function
Description
Functions that implement the mean, the generic moments (both raw and centered) and the moment generating function of the SMNG distribution.
Usage
SMNG_MGF(
r,
mu = 0,
delta,
gamma,
lambda,
beta = 0,
inf_sum = FALSE,
rel_tol = 1e-05
)
meanSMNG(mu, delta, gamma, lambda, beta)
SMNGmoment(j, mu, delta, gamma, lambda, beta, type = "central")
Arguments
r |
Coefficient of the MGF. Can be viewed also as the order of the logSMNG moments. |
mu |
Location parameter, default set to 0. |
delta |
Concentration parameter, must be positive. |
gamma |
Tail parameter, must be positive. |
lambda |
Shape parameter. |
beta |
Skewness parameter, default set to 0 (symmetric case). |
inf_sum |
Logical: if FALSE (default), the integral representation of the SMNG density is used, otherwise the infinite sum is employed. |
rel_tol |
Level of relative tolerance required for the |
j |
Order of the moment. |
type |
String that indicate the kind of moment to comupute. Could be |
Details
If the mean (i.e. the first order raw moment) of the SMNG distribution is required, then the function meanSMNG
could be use.
On the other hand, to obtain the generic j-th moment both "raw"
or "centered"
around the mean, the function momentSMNG
could be used.
Finally, to evaluate the Moment Generating Function (MGF) of the SMNG distribution in the point r
, the function SMNG_MGF
is provided.
It is defined only for points that are lower then the parameter gamma
, and for integer values of r
it could also considered as the
r-th raw moment of the logSMNG distribution. The last function is implemented both in the integral form, which uses the routine integrate
,
or in the infinite sum structure.
Examples
### Comparisons sample quantities vs true values
sample <- rSMNG(n=50000,mu = 0,delta = 2,gamma = 2,lambda = 1,beta = 2)
mean(sample)
meanSMNG(mu = 0,delta = 2,gamma = 2,lambda = 1,beta = 2)
var(sample)
SMNGmoment(j = 2,mu = 0,delta = 2,gamma = 2,lambda = 1,beta = 2,type = "central")
SMNGmoment(j = 2,mu = 0,delta = 2,gamma = 2,lambda = 1,beta = 2,type = "raw")-
meanSMNG(mu = 0,delta = 2,gamma = 2,lambda = 1,beta = 2)^2
mean(exp(sample))
SMNG_MGF(r = 1,mu = 0,delta = 2,gamma = 2,lambda = 1,beta = 2)