Package‘csn’
October12,2022
Type Package
Title Closed Skew-Normal Distribution
Version1.1.3
Date2015-05-09
Author Dmitry Pavlyuk,Eugene Girtcius
Maintainer Dmitry Pavlyuk<**************************>
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
NeedsCompilation no
Repository CRAN
Repository/R-Forge/Project csn
Repository/R-Forge/Revision10
Repository/R-Forge/DateTimeStamp2015-05-0907:20:52
Date/Publication2015-05-1023:27:41
R topics documented:
dcsn (2)
loglcsn (3)
pcsn (4)
rcsn (5)
Index7
1
2dcsn dcsn 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 n or a matrix with n columns,where n=ncol(sigma), giving the coordinates of the point(s)where the density must be evaluated mu a numeric vector representing the location parameter of the distribution;it must
be of length n,as defined above
sigma a positive definite matrix representing the scale parameter of the distribution;a
vector of length1is also allowed
gamma a matrix representing the skewness parameter of the distribution;a vector of
length1is also allowed
nu a numeric vector allows for closure with conditional densities;it must be of
length q,as defined above
delta a positive definite matrix allows for closure with the marginal densities;a vector
of length1is also allowed
Details
Function dcsn makes use of pmvnorm and dmvnorm from package mvtnorm
Value
dcsn returns a vector of density values
See Also
pmvnorm,dmvnorm
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)
loglcsn3 f1<-dcsn(x1,5,9,1,0,0.05)
f2<-dcsn(x2,mu,sigma,gamma,nu,delta)
loglcsn 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 n or a matrix with n columns,where n=ncol(sigma), giving the coordinates of the point(s)where the density must be evaluated mu a numeric vector representing the location parameter of the distribution;it must
be of length n,as defined above
sigma a positive definite matrix representing the scale parameter of the distribution;a
vector of length1is also allowed
gamma a matrix representing the skewness parameter of the distribution;a vector of
length1is also allowed
nu a numeric vector allows for closure with conditional densities;it must be of
length q,as defined above
delta a positive definite matrix allows for closure with the marginal densities;a vector
of length1is 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
pmvnorm,dmvnorm
4pcsn
truncated normal distributionExamples
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)
pcsn 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 n or a matrix with n columns,where n=ncol(sigma), giving the coordinates of the point(s)where the cdf must be evaluated mu a numeric vector representing the location parameter of the distribution;it must
be of length n,as defined above
sigma a positive definite matrix representing the scale parameter of the distribution;a
vector of length1is also allowed
gamma a matrix representing the skewness parameter of the distribution;a vector of
length1is also allowed
nu a numeric vector allows for closure with conditional densities;it must be of
length q,as defined above
delta a positive definite matrix allows for closure with the marginal densities;a vector
of length1is also allowed
Details
Function pcsn makes use of pmvnorm from package mvtnorm
Value
pcsn returns a vector of cdf values
See Also
pmvnorm
rcsn5
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)
rcsn 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 n,as defined above
sigma a positive definite matrix representing the scale parameter of the distribution;a vector of length1is also allowed
gamma a matrix representing the skewness parameter of the distribution;a vector of length1is also allowed
nu a numeric vector allows for closure with conditional densities;it must be of length q,as defined above
delta a positive definite matrix allows for closure with the marginal densities;a vector of length1is also allowed
Details
Function rcsn makes use of rmvnorm from package mvtnorm;
Value
rcsn returns a matrix of k rows of random vectors

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。