View source: R/USER_MCmeanvarTMD.R
| MCmeanvarTMD | R Documentation | 
It computes the Monte Carlo mean vector and variance-covariance matrix for some doubly truncated skew-elliptical distributions. Monte Carlo simulations are performed via slice Sampling.
It supports the p-variate Normal, Skew-normal (SN), Extended Skew-normal (ESN) and Unified Skew-normal (SUN) as well as the Student's-t, Skew-t (ST), Extended Skew-t (EST) and Unified Skew-t (SUT) distribution.
MCmeanvarTMD(lower = rep(-Inf,length(mu)),upper = rep(Inf,length(mu)),mu,Sigma
,lambda = NULL,tau = NULL,Gamma = NULL,nu = NULL,dist,n = 10000)
| lower | the vector of lower limits of length  | 
| upper | the vector of upper limits of length  | 
| mu | a numeric vector of length  | 
| Sigma | a numeric positive definite matrix with dimension  | 
| lambda | a numeric matrix of dimension  | 
| tau | a numeric vector of length  | 
| Gamma | a correlation matrix with dimension  | 
| nu | It represents the degrees of freedom for the Student's t-distribution being a positive real number. | 
| dist | represents the truncated distribution to be used. The values are  | 
| n | number of Monte Carlo samples to be generated. | 
It returns a list with three elements:
| mean | the estimate for the mean vector of length  | 
| EYY | the estimate for the second moment matrix of dimensions  | 
| varcov | the estimate for the variance-covariance matrix of dimensions  | 
Christian E. Galarza <cgalarza88@gmail.com> and Victor H. Lachos <hlachos@uconn.edu>
Maintainer: Christian E. Galarza <cgalarza88@gmail.com>
Arellano-Valle, R. B. & Genton, M. G. (2005). On fundamental skew distributions. Journal of Multivariate Analysis, 96, 93-116.
Ho, H. J., Lin, T. I., Chen, H. Y., & Wang, W. L. (2012). Some results on the truncated multivariate t distribution. Journal of Statistical Planning and Inference, 142(1), 25-40.
meanvarTMD, rmvSN,rmvESN,rmvST, rmvEST
a = c(-0.8,-0.7,-0.6)
b = c(0.5,0.6,0.7)
mu = c(0.1,0.2,0.3)
Sigma = matrix(data = c(1,0.2,0.3,0.2,1,0.4,0.3,0.4,1),
               nrow = length(mu),ncol = length(mu),byrow = TRUE)
## Normal case
# Theoretical value
value1 = meanvarTMD(a,b,mu,Sigma,dist="normal")
#MC estimate
MC11 = MCmeanvarTMD(a,b,mu,Sigma,dist="normal") #by defalut n = 10000
MC12 = MCmeanvarTMD(a,b,mu,Sigma,dist="normal",n = 10^5) #more precision
## Skew-t case
 
# Theoretical value
value2 = meanvarTMD(a,b,mu,Sigma,lambda = c(-2,0,1),nu = 4,dist = "ST")
#MC estimate
MC21 = MCmeanvarTMD(a,b,mu,Sigma,lambda = c(-2,0,1),nu = 4,dist = "ST")
## More...
MC5 = MCmeanvarTMD(a,b,mu,Sigma,lambda = c(-2,0,1),tau = 1,dist = "ESN")
MC6 = MCmeanvarTMD(a,b,mu,Sigma,lambda = c(-2,0,1),tau = 1,nu = 4,dist = "EST")
#Skew-unified Normal (SUN) and Skew-unified t (SUT) distributions
Lambda = matrix(c(1,0,2,-3,0,-1),3,2) #A skewness matrix p times q
Gamma  = matrix(c(1,-0.5,-0.5,1),2,2) #A correlation matrix q times q
tau    = c(-1,2)                      #A vector of extension parameters of dim q
MC7 = MCmeanvarTMD(a,b,mu,Sigma,lambda = Lambda,tau = c(-1,2),Gamma = Gamma,dist = "SUN")
MC8 = MCmeanvarTMD(a,b,mu,Sigma,lambda = Lambda,tau = c(-1,2),Gamma = Gamma,nu = 1,dist = "SUT")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.