splitn {dng}R Documentation

Split-normal distribution

Description

Density distribution function, quantile function and random generation function for the split normal distribution.

Usage

dsplitn(x, mu, sigma, lmd, logarithm)

psplitn(q, mu, sigma, lmd)

qsplitn(p, mu, sigma, lmd)

rsplitn(n, mu, sigma, lmd)

Arguments

x

vector of quantiles.

mu

vector of location parameter. (The mode of the density)

sigma

vector of standard deviations.

lmd

vector of skewness parameters (>0). If is 1, reduced to symmetric normal distribution.

logarithm

logical; if TRUE, probabilities p are given as log(p).

q

vector of quantiles.

p

vector of probability.

n

number of observations. If length(n) > 1, the length is taken to be the number required.

Details

The random ' variable y follows a split-normal distribution, y~N(μ, ' σ, λ), which has density:

1/(1+λ)σ ' √(2/π) exp{-(y-μ)*2/2σ^2}, if y<=μ

'

1/(1+λ)σ √(2/π) exp{-(y-μ)*2/2σ^2 λ^2}, ' if y>μ

where σ>0 and λ>0. The Split-normal ' distribution reduce to normal distribution when λ=1.

Value

dsplitn gives the density; psplitn gives the percentile; qsplitn gives the quantile; and rsplitn gives the random variables. Invalid arguments will result in return value NaN, with a warning.

The numerical arguments other than n are recycled to the length of the result. Only the first elements of the logical arguments are used.

Functions

Author(s)

Feng Li, Jiayue Zeng

References

Villani, M., & Larsson, R. (2006) The Multivariate Split Normal Distribution and Asymmetric Principal Components Analysis. Sveriges Riksbank Working Paper Series, No. 175.

See Also

splitn_mean(), splitn_var(),splitn_skewness() and splitn_kurtosis() for numerical characteristics of the split-normal distribution.

Examples


n <- 3
mu <- c(0,1,2)
sigma <- c(1,2,3)
lmd <- c(1,2,3)

q0 <- rsplitn(n, mu, sigma, lmd)
d0 <- dsplitn(q0, mu, sigma, lmd, logarithm = FALSE)
p0 <- psplitn(q0, mu, sigma, lmd)
q1 <- qsplitn(p0,mu, sigma, lmd)
all.equal(q0, q1)

[Package dng version 0.2.1 Index]