Density, distribution function, and random number generation for the multivariate Skew-Normal distribution.
The functions to compute densities
pmsc, and to generate random numbers
rmsc for the
multivariate skew Normal distribution are available in the contributed
sn (note, they are no longer builtin in fMultivar).
The reason is that the performance for these functions in package
sn has superseeded those used before in the package fMultivar.
The usage of the
sn functions is:
dmsn(x, xi, Omega, alpha, tau = 0, dp = NULL, log = FALSE)
pmsn(x, xi, Omega, alpha, tau = 0, dp = NULL, ...)
rmsn(n, xi, Omega, alpha, tau = 0, dp = NULL)
NOTE: The multivariate skew-normal distribution is discussed by
Azzalini and Dalla Valle (1996). The
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.
Be aware that the location vector
xi does not represent
the mean vector of the distribution. Similarly,
not the covariance matrix of the distribution, although it is
a covariance matrix.
For further details we refer to the help page in the package
Azzalini, A. and Dalla Valle, A. (1996), The multivariate skew-normal distribution, Biometrika 83, 715-726.
Azzalini, A. and Capitanio, A. (1999), Statistical applications of the multivariate skew normal distribution, Journal Roy.Statist.Soc. B 61, 579-602, Full-length version available at http://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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
## Not run: ## Make 2-D Grid Coordinates: N <- 101 x <- y <- seq(-3, 3, l=N) X <- cbind(u=grid2d(x)$x, v=grid2d(x)$y) ## dmsn # Set Parameters: xi <- c(0, 0) Omega <- diag(2); Omega[2,1] <- Omega[1,2] <- 0.5 alpha <- c(2, -6) # Compute skew Normal Density: z <- sn::dmsn(X, xi, Omega, alpha) Z <- list(x=x, y=x, z=matrix(z, ncol = length(x))) # Plot: image(Z) contour(Z) grid(col="red") ## rmsn - set.seed(4711) r <- sn::rmsn(n=5000, xi, Omega, alpha) plot(hexBinning(r)) contour(Z, add=TRUE, col="darkblue", lwd=2) grid(col="red") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.