dmsn: Multivariate skew-normal distribution

View source: R/sn-funct.R

dmsnR Documentation

Multivariate skew-normal distribution

Description

Probability density function, distribution function and random number generation for the multivariate skew-normal (SN) distribution.

Usage

dmsn(x, xi=rep(0,length(alpha)), Omega, alpha, tau=0, dp=NULL, log=FALSE)
pmsn(x, xi=rep(0,length(alpha)), Omega, alpha,  tau=0, dp=NULL, ...)
rmsn(n=1, xi=rep(0,length(alpha)), Omega, alpha,  tau=0, dp=NULL)

Arguments

x

either a vector of length d, where d=length(alpha), or a matrix with d columns, giving the coordinates of the point(s) where the density or the distribution function must be evaluated.

xi

a numeric vector of length d representing the location parameter of the distribution; see ‘Background’. In a call to dmsn and pmsn, xi can be a matrix, whose rows represent a set of location parameters; in this case, its dimensions must match those of x.

Omega

a symmetric positive-definite matrix of dimension (d,d); see ‘Background’.

alpha

a numeric vector which regulates the slant of the density; see ‘Background’. Inf values in alpha are not allowed.

tau

a single value representing the ‘hidden mean’ parameter of the ESN distribution; tau=0 (default) corresponds to a SN distribution.

dp

a list with three elements, corresponding to xi, Omega and alpha described above; default value FALSE. If dp is assigned, individual parameters must not be specified.

n

a numeric value which represents the number of random vectors to be drawn.

log

logical (default value: FALSE); if TRUE, log-densities are returned.

...

additional parameters passed to pmnorm.

Details

Typical usages are

dmsn(x, xi=rep(0,length(alpha)), Omega, alpha, log=FALSE)
dmsn(x, dp=, log=FALSE)
pmsn(x, xi=rep(0,length(alpha)), Omega, alpha, ...)
pmsn(x, dp=)
rmsn(n=1, xi=rep(0,length(alpha)), Omega, alpha)
rmsn(n=1, dp=)

For efficiency reasons, rmsn makes very limited checks on the validity of the arguments. For instance, failure to positive definiteness of Omega would not be detected, and an uncontrolled crash occurs. Function pmsn makes use of pmnorm from package mnormt; the accuracy of its computation can be controlled via ...

Value

A vector of density values (dmsn) or of probabilities (pmsn) or a matrix of random points (rmsn).

Background

The multivariate skew-normal distribution is discussed by Azzalini and Dalla Valle (1996). The (Omega,alpha) parametrization adopted here is the one of Azzalini and Capitanio (1999). Chapter 5 of Azzalini and Capitanio (2014) provides an extensive account, including subsequent developments.

Notice that the location vector xi does not represent the mean vector of the distribution. Similarly, Omega is not the covariance matrix of the distribution, although it is a covariance matrix. Finally, the components of alpha are not equal to the slant parameters of the marginal distributions; to fix the marginal parameters at prescribed values, it is convenient to start from the OP parameterization, as illustrated in the ‘Examples’ below. Another option is to start from the CP parameterization, but notice that, at variance from the OP, not all CP sets are invertible to lend a DP set.

References

Azzalini, A. and Capitanio, A. (1999). Statistical applications of the multivariate skew normal distribution. J.Roy.Statist.Soc. B 61, 579–602. Full-length version available at https://arXiv.org/abs/0911.2093

Azzalini, A. with the collaboration of Capitanio, A. (2014). The Skew-Normal and Related Families. Cambridge University Press, IMS Monographs series.

Azzalini, A. and Dalla Valle, A. (1996). The multivariate skew-normal distribution. Biometrika 83, 715–726.

See Also

dsn, dmst, pmnorm, op2dp, cp2dp

Examples

x <- seq(-3,3,length=15)
xi <- c(0.5, -1)
Omega <- diag(2)
Omega[2,1] <- Omega[1,2] <- 0.5
alpha <- c(2,-6)
pdf <- dmsn(cbind(x, 2*x-1), xi, Omega, alpha)
cdf <- pmsn(cbind(x, 2*x-1), xi, Omega, alpha)
p1 <- pmsn(c(2,1), xi, Omega, alpha)
p2 <- pmsn(c(2,1), xi, Omega, alpha, abseps=1e-12, maxpts=10000)
#
rnd <- rmsn(10, xi, Omega, alpha)
#
# use OP parameters to fix marginal shapes at given lambda values:
op <- list(xi=c(0,1), Psi=matrix(c(2,2,2,3), 2, 2), lambda=c(5, -2))
rnd <- rmsn(10, dp=op2dp(op,"SN"))
# 
# use CP parameters to fix mean vector, variance matrix and marginal skewness:
cp <- list(mean=c(0,0), var.cov=matrix(c(3,2,2,3)/3, 2, 2), gamma1=c(0.8, 0.4))
dp <- cp2dp(cp, "SN")
rnd <- rmsn(5, dp=dp)

sn documentation built on April 5, 2023, 5:15 p.m.