Title: | Closed Skew-Normal Distribution |
---|---|
Description: | Provides functions for computing the density and the log-likelihood function of closed-skew normal variates, and for generating random vectors sampled from this distribution. See Gonzalez-Farias, G., Dominguez-Molina, J., and Gupta, A. (2004). The closed skew normal distribution, Skew-elliptical distributions and their applications: a journey beyond normality, Chapman and Hall/CRC, Boca Raton, FL, pp. 25-42. |
Authors: | Dmitry Pavlyuk, Eugene Girtcius |
Maintainer: | Dmitry Pavlyuk <[email protected]> |
License: | GPL-2 |
Version: | 1.1.3 |
Built: | 2024-12-01 07:58:46 UTC |
Source: | CRAN |
The probability density function of the closed-skew normal distribution
dcsn(x, mu, sigma, gamma, nu, delta)
dcsn(x, mu, sigma, gamma, nu, delta)
x |
this is either a vector of length |
mu |
a numeric vector representing the location parameter of the
distribution; it must be of length |
sigma |
a positive definite matrix representing the scale parameter of the distribution; a vector of length 1 is also allowed |
gamma |
a matrix representing the skewness parameter of the distribution; a vector of length 1 is also allowed |
nu |
a numeric vector allows for closure with conditional densities;
it must be of length |
delta |
a positive definite matrix allows for closure with the marginal densities; a vector of length 1 is also allowed |
Function dcsn makes use of pmvnorm and dmvnorm from package mvtnorm
dcsn
returns a vector of density values
x1 <- seq(4.5,11,length=100) x2 <- cbind(seq(3,9,length=100),seq(7,13,length=100)) mu <- c(5,7) sigma <- matrix(c(1,0.2,0.2,4),2) gamma <- matrix(c(4,0,0,5),2) nu <- c(-2,6) delta <- matrix(c(1,0,0,1),2) f1 <- dcsn(x1,5,9,1,0,0.05) f2 <- dcsn(x2, mu, sigma, gamma, nu, delta)
x1 <- seq(4.5,11,length=100) x2 <- cbind(seq(3,9,length=100),seq(7,13,length=100)) mu <- c(5,7) sigma <- matrix(c(1,0.2,0.2,4),2) gamma <- matrix(c(4,0,0,5),2) nu <- c(-2,6) delta <- matrix(c(1,0,0,1),2) f1 <- dcsn(x1,5,9,1,0,0.05) f2 <- dcsn(x2, mu, sigma, gamma, nu, delta)
The log-likelihood function of the closed-skew normal distribution
loglcsn(x, mu, sigma, gamma, nu, delta)
loglcsn(x, mu, sigma, gamma, nu, delta)
x |
this is either a vector of length |
mu |
a numeric vector representing the location parameter of the
distribution; it must be of length |
sigma |
a positive definite matrix representing the scale parameter of the distribution; a vector of length 1 is also allowed |
gamma |
a matrix representing the skewness parameter of the distribution; a vector of length 1 is also allowed |
nu |
a numeric vector allows for closure with conditional densities;
it must be of length |
delta |
a positive definite matrix allows for closure with the marginal densities; a vector of length 1 is also allowed |
Function loglcsn makes use of pmvnorm and dmvnorm from package mvtnorm
loglcsn
returns a sum of log-transformed density values
x <- cbind(seq(3,9,length=100),seq(7,13,length=100)) mu <- c(5,7) sigma <- matrix(c(1,0.2,0.2,4),2) gamma <- matrix(c(4,0,0,5),2) nu <- c(-2,6) delta <- matrix(c(1,0,0,1),2) L <- loglcsn(x, mu, sigma, gamma, nu, delta)
x <- cbind(seq(3,9,length=100),seq(7,13,length=100)) mu <- c(5,7) sigma <- matrix(c(1,0.2,0.2,4),2) gamma <- matrix(c(4,0,0,5),2) nu <- c(-2,6) delta <- matrix(c(1,0,0,1),2) L <- loglcsn(x, mu, sigma, gamma, nu, delta)
The cumulative distribution function of the closed-skew normal distribution
pcsn(x, mu, sigma, gamma, nu, delta)
pcsn(x, mu, sigma, gamma, nu, delta)
x |
this is either a vector of length |
mu |
a numeric vector representing the location parameter of the
distribution; it must be of length |
sigma |
a positive definite matrix representing the scale parameter of the distribution; a vector of length 1 is also allowed |
gamma |
a matrix representing the skewness parameter of the distribution; a vector of length 1 is also allowed |
nu |
a numeric vector allows for closure with conditional densities;
it must be of length |
delta |
a positive definite matrix allows for closure with the marginal densities; a vector of length 1 is also allowed |
Function pcsn makes use of pmvnorm from package mvtnorm
pcsn
returns a vector of cdf values
x1 <- seq(4,6,by = 0.1) x2 <- x1+sin(x1) x3 <- x1-cos(x1) x <- cbind(x1,x2,x3) mu <- c(1,2,3) sigma <- matrix(c(2,-1,0,-1,2,-1,0,-1,2),3) gamma <- matrix(c(0,1,0,2,2,3),2,3) nu <- c(1,3) delta <- matrix(c(1,1,1,2),2) pcsn(6,5,9,1,0,0.05) pcsn(c(3,4,5),mu,sigma,gamma,nu,delta) pcsn(x,mu,sigma,gamma,nu,delta)
x1 <- seq(4,6,by = 0.1) x2 <- x1+sin(x1) x3 <- x1-cos(x1) x <- cbind(x1,x2,x3) mu <- c(1,2,3) sigma <- matrix(c(2,-1,0,-1,2,-1,0,-1,2),3) gamma <- matrix(c(0,1,0,2,2,3),2,3) nu <- c(1,3) delta <- matrix(c(1,1,1,2),2) pcsn(6,5,9,1,0,0.05) pcsn(c(3,4,5),mu,sigma,gamma,nu,delta) pcsn(x,mu,sigma,gamma,nu,delta)
Random number generation of the closed-skew normal distribution
rcsn(k, mu = rep(0, n), sigma, gamma, nu = rep(0, q), delta)
rcsn(k, mu = rep(0, n), sigma, gamma, nu = rep(0, q), delta)
k |
the number of random numbers to be generated |
mu |
a numeric vector representing the location parameter of the
distribution; it must be of length |
sigma |
a positive definite matrix representing the scale parameter of the distribution; a vector of length 1 is also allowed |
gamma |
a matrix representing the skewness parameter of the distribution; a vector of length 1 is also allowed |
nu |
a numeric vector allows for closure with conditional densities;
it must be of length |
delta |
a positive definite matrix allows for closure with the marginal densities; a vector of length 1 is also allowed |
Function rcsn makes use of rmvnorm from package mvtnorm;
rcsn
returns a matrix of k
rows of random vectors
mu <- c(1,2,3) sigma <- matrix(c(2,-1,0,-1,2,-1,0,-1,2),3) gamma <- matrix(c(0,1,0,2,2,3),2,3) nu <- c(1,3) delta <- matrix(c(1,1,1,2),2) x1 <- rcsn(100, mu, sigma, gamma, nu, delta) x2 <- rcsn(100,5,9,1,0,0.05)
mu <- c(1,2,3) sigma <- matrix(c(2,-1,0,-1,2,-1,0,-1,2),3) gamma <- matrix(c(0,1,0,2,2,3),2,3) nu <- c(1,3) delta <- matrix(c(1,1,1,2),2) x1 <- rcsn(100, mu, sigma, gamma, nu, delta) x2 <- rcsn(100,5,9,1,0,0.05)