Type: | Package |
Title: | Closed Skew-Normal Distribution |
Version: | 1.1.3 |
Date: | 2015-05-09 |
Author: | Dmitry Pavlyuk, Eugene Girtcius |
Maintainer: | Dmitry Pavlyuk <Dmitry.V.Pavlyuk@gmail.com> |
Depends: | R (≥ 2.2.0) |
Imports: | mvtnorm |
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. |
License: | GPL-2 |
Packaged: | 2015-05-09 07:25:08 UTC; rforge |
NeedsCompilation: | no |
Repository: | CRAN |
Repository/R-Forge/Project: | csn |
Repository/R-Forge/Revision: | 10 |
Repository/R-Forge/DateTimeStamp: | 2015-05-09 07:20:52 |
Date/Publication: | 2015-05-10 23:27:41 |
The probability density function
Description
The probability density function of the closed-skew normal distribution
Usage
dcsn(x, mu, sigma, gamma, nu, delta)
Arguments
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 |
Details
Function dcsn makes use of pmvnorm and dmvnorm from package mvtnorm
Value
dcsn
returns a vector of density values
See Also
Examples
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
Description
The log-likelihood function of the closed-skew normal distribution
Usage
loglcsn(x, mu, sigma, gamma, nu, delta)
Arguments
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 |
Details
Function loglcsn makes use of pmvnorm and dmvnorm from package mvtnorm
Value
loglcsn
returns a sum of log-transformed density values
See Also
Examples
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
Description
The cumulative distribution function of the closed-skew normal distribution
Usage
pcsn(x, mu, sigma, gamma, nu, delta)
Arguments
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 |
Details
Function pcsn makes use of pmvnorm from package mvtnorm
Value
pcsn
returns a vector of cdf values
See Also
Examples
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
Description
Random number generation of the closed-skew normal distribution
Usage
rcsn(k, mu = rep(0, n), sigma, gamma, nu = rep(0, q), delta)
Arguments
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 |
Details
Function rcsn makes use of rmvnorm from package mvtnorm;
Value
rcsn
returns a matrix of k
rows of random vectors
See Also
Examples
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)