Learn R Programming

dng (version 0.2.1)

splitn: 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.

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

  • psplitn: Percentile for the split-normal distribution.

  • qsplitn: Quantile for the split-normal distribution.

  • rsplitn: Randon variables from the split-normal distribution.

Details

The random ' variable y follows a split-normal distribution, y~N(\(\mu\), ' \(\sigma\), \(\lambda\)), which has density: $$1/(1+\lambda)\sigma ' \sqrt(2/\pi) exp{-(y-\mu)*2/2\sigma^2}, if y<=\mu$$ ' $$1/(1+\lambda)\sigma \sqrt(2/\pi) exp{-(y-\mu)*2/2\sigma^2 \lambda^2}, ' if y>\mu$$ where \(\sigma>0\) and \(\lambda>0\). The Split-normal ' distribution reduce to normal distribution when \(\lambda=1\).

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

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab