Learn R Programming

dirttee (version 1.0.2)

asynorm: The asymmetric normal distribution.

Description

Density, distribution function, quantile function and random generation for the asymmetric normal distribution with the parameters mu, sigma and tau.

Usage

dasynorm(x, mu = 0, sigma = 1, tau = 0.5)
pasynorm(q, mu = 0, sigma = 1, tau = 0.5)
qasynorm(p, mu = 0, sigma = 1, tau = 0.5)
rasynorm(n, mu = 0, sigma = 1, tau = 0.5)

Value

dasynorm gives the density, pasynorm gives the distribution function, qasynorm gives the quantile function, and rasynorm generates random deviates.

Corresponds to the normal distribution for \(\tau = 0.5\).

The length of the result is determined by n for rasynorm, and is the maximum of the lengths of the numerical arguments for the other functions.

The numerical arguments other than n are recycled to the length of the result.

Arguments

q

vector of quantiles.

mu

location parameter and mode of the distribution.

sigma

comparable to the standard deviation. Must be positive.

tau

asymmetry parameter.

x

vector of locations.

p

vector of probabilities.

n

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

Details

The asymmetric normal distribution has the following density
\(f(x) = (2\sqrt{\tau(1-\tau)/\pi}/\sigma)/(\sqrt{1-\tau} + \sqrt{\tau)}\exp(-|(\tau - (x <= \mu))|*(x - \mu)^2/\sigma^2)\) The cdf is derived by integration of the distribution function by using the integrate function.

Examples

Run this code

hist(rasynorm(1000))

qg <- qasynorm(0.1, 1, 2, 0.5)

pasynorm(qg, 1, 2, 0.5)

ax <- c(1:1000)/100-5
plot(ax,dasynorm(ax), type = 'l')

Run the code above in your browser using DataLab