SMNGdistribution {BayesLN}R Documentation

SMNG and logSMNG Distributions

Description

Density function, distribution function, quantile function and random generator for the SMNG distribution and the logSMNG. It requires the specification of a five prameters vector: mu, delta, gamma, lambda and beta.

Usage

dSMNG(
  x,
  mu = 0,
  delta,
  gamma,
  lambda,
  beta = 0,
  inf_sum = FALSE,
  rel_tol = 1e-05
)

pSMNG(q, mu, delta, gamma, lambda, beta, rel_tol = 1e-05)

qSMNG(p, mu, delta, gamma, lambda, beta, rel_tol = 1e-05)

rSMNG(n, mu, delta, gamma, lambda, beta)

dlSMNG(x, mu = 0, delta, gamma, lambda, beta, inf_sum = FALSE, rel_tol = 1e-05)

plSMNG(q, mu, delta, gamma, lambda, beta, rel_tol = 1e-05)

qlSMNG(p, mu, delta, gamma, lambda, beta, rel_tol = 1e-05)

rlSMNG(n, mu, delta, gamma, lambda, beta)

Arguments

x, q

Vector of quantiles.

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 integrate procedure or for the infinite sum convergence check. Default set to 1e-5.

p

Vector of probabilities.

n

Sample size.

Details

The SMNG distribution is a normal scale-mean mixture distribution with a GIG as mixing distribution. The density can be expressed as an infinite sum of Bessel K functions and it is characterized by 5 parameters.

Moreover, if X is SMNG distributed, then Z=exp(X) is distributed as a log-SMNG distribution.

Value

dSMNG and dlSMNG provide the values of the density function at a quantile x for, respectively a SMNG distribution and a log-SMNG.

pSMNG and plSMNG provide the cumulative distribution function at a quantile q.

qSMNG and qlSMNG provide the quantile corresponding to a probability level p.

rSMNG and rlSMNG generate n independent samples from the desired distribution.

Examples


### Plots of density and cumulative functions of the SMNG distribution
x<-seq(-10,10,length.out = 500)

plot(x,dSMNG(x = x,mu = 0,delta = 1,gamma = 1,lambda = 1,beta= 2),
    type="l",ylab="f(x)")
lines(x,dSMNG(x = x,mu = 0,delta = 1,gamma = 1,lambda = 1,beta= -2),col=2)
title("SMNG density function")

plot(x,pSMNG(q = x,mu = 0,delta = 1,gamma = 1,lambda = 1,beta= 2),
    type="l",ylab="F(x)")
lines(x,pSMNG(q = x,mu = 0,delta = 1,gamma = 1,lambda = 1,beta= -2),col=2)
title("SMNG cumulative function")


### Plots of density and cumulative functions of the logSMNG distribution
x<-seq(0,20,length.out = 500)

plot(x,dlSMNG(x = x,mu = 0,delta = 1,gamma = 1,lambda = 2,beta = 1),
    type="l",ylab="f(x)",ylim = c(0,1.5))
lines(x,dlSMNG(x = x,mu = 0,delta = 1,gamma = 1,lambda = 2,beta = -1),col=2)
title("logSMNG density function")

plot(x,plSMNG(q = x,mu = 0,delta = 1,gamma = 1,lambda = 2,beta = 1),
    type="l",ylab="F(x)",ylim = c(0,1))
lines(x,plSMNG(q = x,mu = 0,delta = 1,gamma = 1,lambda = 2,beta = -1),col=2)
title("logSMNG cumulative function")



[Package BayesLN version 0.2.10 Index]