Learn R Programming

MomTrunc (version 5.97)

meanvarTMD: Mean and variance for doubly truncated multivariate distributions

Description

It computes the mean vector and variance-covariance matrix for some doubly truncated skew-elliptical distributions. 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.

Usage

meanvarTMD(lower = rep(-Inf,length(mu)),upper = rep(Inf,length(mu)),mu,Sigma
,lambda = NULL,tau = NULL,Gamma = NULL,nu = NULL,dist)

Arguments

lower

the vector of lower limits of length \(p\).

upper

the vector of upper limits of length \(p\).

mu

a numeric vector of length \(p\) representing the location parameter.

Sigma

a numeric positive definite matrix with dimension \(p\)x\(p\) representing the scale parameter.

lambda

a numeric matrix of dimension \(p\)x\(q\) representing the skewness/shape matrix parameter for the SUN and SUT distribution. For the ESN and EST distributions (\(q=1\)), lambda is a numeric vector of dimension \(p\) (see examples at the end of this help). If all(lambda == 0), the SUN/ESN/SN (SUT/EST/ST) reduces to a normal (t) symmetric distribution.

tau

a numeric vector of length \(q\) representing the extension parameter for the SUN and SUT distribution. For the ESN and EST distributions, tau is a positive scalar (\(q=1\)). Furthermore, if tau == 0, the ESN (EST) reduces to a SN (ST) distribution.

Gamma

a correlation matrix with dimension \(q\)x\(q\). It must be provided only for the SUN and SUT cases. For particular cases SN, ESN, ST and EST, we have that Gamma == 1 (see examples at the end of this help).

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 normal, SN , ESN and SUN for the doubly truncated Normal, Skew-normal, Extended Skew-normal and Unified-skew normal distributions and, t, ST , EST and SUT for the for the doubly truncated Student-t, Skew-t, Extended Skew-t and Unified skew-t distributions.

Value

It returns a list with three elements:

mean

the mean vector of length \(p\)

EYY

the second moment matrix of dimensions \(p\)x\(p\)

varcov

the variance-covariance matrix of dimensions \(p\)x\(p\)

Warning

For the \(t\) cases, the algorithm supports degrees of freedom nu <= 2.

Details

Univariate case is also considered, where Sigma will be the variance \(\sigma^2\). Normal case code is an R adaptation of the Matlab available function dtmvnmom.m from Kan & Robotti (2017) and it is used for p<=3. For higher dimensions we use an extension of the algorithm in Vaida (2009).

References

Arellano-Valle, R. B. & Genton, M. G. (2005). On fundamental skew distributions. Journal of Multivariate Analysis, 96, 93-116.

Arellano-Valle, R. B. & Genton, M. G. (2010). Multivariate extended skew-t distributions and related families. Metron, 68(3), 201-234.

Galarza C.E., Matos L.A., Dey D.K. & Lachos V.H. (2019) On Moments of Folded and Truncated Multivariate Extended Skew-Normal Distributions. Technical report. ID 19-14. University of Connecticut <https://stat.uconn.edu/tech-reports-2019/>.

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.

Kan, R., & Robotti, C. (2017). On moments of folded and truncated multivariate normal distributions. Journal of Computational and Graphical Statistics, 26(4), 930-934.

Kirkby J. Lars, Nguyen D. and Nguyen D. (2019). Moments of Student's t-distribution: A Unified Approach. <https://arxiv.org/abs/1912.01607>

Vaida, F. & Liu, L. (2009). Fast implementation for normal mixed effects models with censored response. Journal of Computational and Graphical Statistics, 18(4), 797-817.

See Also

MCmeanvarTMD, momentsTMD, meanvarFMD, meanvarFMD,momentsFMD, dmvSN,pmvSN,rmvSN, dmvESN,pmvESN,rmvESN, dmvST,pmvST,rmvST, dmvEST,pmvEST,rmvEST

Examples

Run this code
# NOT RUN {
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)

# 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

# Now works for for any nu>0
value2 = meanvarTMD(a,b,mu,Sigma,dist = "t",nu = 0.87)

value3 = meanvarTMD(a,b,mu,Sigma,lambda = c(-2,0,1),dist = "SN")
value4 = meanvarTMD(a,b,mu,Sigma,lambda = c(-2,0,1),nu = 4,dist = "ST")
value5 = meanvarTMD(a,b,mu,Sigma,lambda = c(-2,0,1),tau = 1,dist = "ESN")
value6 = meanvarTMD(a,b,mu,Sigma,lambda = c(-2,0,1),tau = 1,nu = 4,dist = "EST")

# }
# NOT RUN {
#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

value7 = meanvarTMD(a,b,mu,Sigma,lambda = Lambda,tau = c(-1,2),Gamma = Gamma,dist = "SUN")
value8 = meanvarTMD(a,b,mu,Sigma,lambda = Lambda,tau = c(-1,2),Gamma = Gamma,nu = 4,dist = "SUT")


#The ESN and EST as particular cases of the SUN and SUT for q=1

Lambda = matrix(c(-2,0,1),3,1)
Gamma  = 1
value9 = meanvarTMD(a,b,mu,Sigma,lambda = Lambda,tau = 1,Gamma = Gamma,dist = "SUN")
value10 = meanvarTMD(a,b,mu,Sigma,lambda = Lambda,tau = 1,Gamma = Gamma,nu = 4,dist = "SUT")

round(value5$varcov,2) == round(value9$varcov,2)
round(value6$varcov,2) == round(value10$varcov,2)
# }

Run the code above in your browser using DataLab