Package 'MomTrunc'

Title: Moments of Folded and Doubly Truncated Multivariate Distributions
Description: It computes arbitrary products moments (mean vector and variance-covariance matrix), for some double truncated (and folded) multivariate distributions. These distributions belong to the family of selection elliptical distributions, which includes well known skewed distributions as the unified skew-t distribution (SUT) and its particular cases as the extended skew-t (EST), skew-t (ST) and the symmetric student-t (T) distribution. Analogous normal cases unified skew-normal (SUN), extended skew-normal (ESN), skew-normal (SN), and symmetric normal (N) are also included. Density, probabilities and random deviates are also offered for these members.
Authors: Christian E. Galarza [aut, cre, trl] , Raymond Kan [ctb] , Victor H. Lachos [aut, ths]
Maintainer: Christian E. Galarza <[email protected]>
License: GPL (>=2)
Version: 6.1
Built: 2024-11-27 04:25:16 UTC
Source: https://github.com/chedgala/momtrunc

Help Index


Moments of Folded and Doubly Truncated Multivariate Distributions

Description

It computes arbitrary products moments (mean vector and variance-covariance matrix), for some double truncated (and folded) multivariate distributions. These distributions belong to the family of selection elliptical distributions, which includes well known skewed distributions as the unified skew-t distribution (SUT) and its particular cases as the extended skew-t (EST), skew-t (ST) and the symmetric student-t (T) distribution. Analogous normal cases unified skew-normal (SUN), extended skew-normal (ESN), skew-normal (SN), and symmetric normal (N) are also included. Density, probabilities and random deviates are also offered for these members.

Details

Probabilities can be computed using the functions pmvSN and pmvESN for the normal cases SN and ESN and, pmvST and pmvEST for the t cases ST and EST respectively, which offer the option to return the logarithm in base 2 of the probability, useful when the true probability is too small for the machine precision. These functions above use methods in Genz (1992) through the mvtnorm package (linked direclty to our C++ functions) and Cao et.al. (2019) through the package tlrmvnmvt. For the double truncated Student-t cases SUT, EST, ST and T, decimal degrees of freedom are supported. Computation of arbitrary moments are based in the works of Kan & Robotti (2017) and Galarza et.al. (2021,2022a,2022b). Reference for the family of selection-elliptical distributions in this package can be found in Arellano-Valle & Genton (2005).

Author(s)

Christian E. Galarza [aut, cre, trl] (<https://orcid.org/0000-0002-4818-6006>), Raymond Kan [ctb] (<https://orcid.org/0000-0002-0578-9974>), Victor H. Lachos [aut, ths] (<https://orcid.org/0000-0002-7239-2459>)

Maintainer: Christian E. Galarza <[email protected]>

References

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

Cao, J., Genton, M. G., Keyes, D. E., & Turkiyyah, G. M. (2019) "Exploiting Low Rank Covariance Structures for Computing High-Dimensional Normal and Student-t Probabilities" <https://marcgenton.github.io/2019.CGKT.manuscript.pdf>.

Galarza, C. E., Lin, T. I., Wang, W. L., & Lachos, V. H. (2021). On moments of folded and truncated multivariate Student-t distributions based on recurrence relations. Metrika, 84(6), 825-850 <doi:10.1007/s00184-020-00802-1>.

Galarza, C. E., Matos, L. A., Dey, D. K., & Lachos, V. H. (2022a). "On moments of folded and doubly truncated multivariate extended skew-normal distributions." Journal of Computational and Graphical Statistics, 1-11 <doi:10.1080/10618600.2021.2000869>.

Galarza, C. E., Matos, L. A., Castro, L. M., & Lachos, V. H. (2022b). Moments of the doubly truncated selection elliptical distributions with emphasis on the unified multivariate skew-t distribution. Journal of Multivariate Analysis, 189, 104944 <doi:10.1016/j.jmva.2021.104944>.

Genz, A., "Numerical computation of multivariate normal probabilities," Journal of Computational and Graphical Statistics, 1, 141-149 (1992) <doi:10.1080/10618600.1992.10477010>.

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

See Also

onlymeanTMD,meanvarTMD,momentsTMD,dmvSN,pmvSN,rmvSN,dmvST,pmvST,rmvST

Examples

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)

meanvarTMD(a,b,mu,Sigma,dist="normal") #normal case
meanvarTMD(mu = mu,Sigma = Sigma,lambda = c(-2,0,1),dist="SN") #skew normal with NO truncation
meanvarTMD(a,b,mu,Sigma,lambda = c(-2,0,1),nu = 4.87,dist = "ST") #skew t
momentsTMD(3,a,b,mu,Sigma,nu = 4,dist = "t") #t case, all moments or order <=3

Cumulative distribution function for folded multivariate distributions

Description

It computes the cumulative distribution function on x for a folded p-variate Normal, Skew-normal (SN), Extended Skew-normal (ESN) and Student's t-distribution.

Usage

cdfFMD(x,mu,Sigma,lambda = NULL,tau = NULL,dist,nu = NULL)

Arguments

x

vector of length pp where the cdf is evaluated.

mu

a numeric vector of length pp representing the location parameter.

Sigma

a numeric positive definite matrix with dimension ppxpp representing the scale parameter.

lambda

a numeric vector of length pp representing the skewness parameter for SN and ESN cases. If lambda == 0, the ESN/SN reduces to a normal (symmetric) distribution.

tau

It represents the extension parameter for the ESN distribution. If tau == 0, the ESN reduces to a SN distribution.

dist

represents the folded distribution to be computed. The values are normal, SN , ESN and t for the doubly truncated Normal, Skew-normal, Extended Skew-normal and Student's t-distribution respectively.

nu

It represents the degrees of freedom for the Student's t-distribution.

Details

Normal case by default, i.e., when dist is not provided. Univariate case is also considered, where Sigma will be the variance σ2\sigma^2.

Value

It returns the distribution value for a single point x.

Note

Degrees of freedom must be a positive integer. If nu >= 200, Normal case is considered."

Author(s)

Christian E. Galarza <[email protected]> and Victor H. Lachos <[email protected]>

Maintainer: Christian E. Galarza <[email protected]>

References

Galarza, C. E., Lin, T. I., Wang, W. L., & Lachos, V. H. (2021). On moments of folded and truncated multivariate Student-t distributions based on recurrence relations. Metrika, 84(6), 825-850 <doi:10.1007/s00184-020-00802-1>.

Galarza, C. E., Matos, L. A., Dey, D. K., & Lachos, V. H. (2022a). "On moments of folded and doubly truncated multivariate extended skew-normal distributions." Journal of Computational and Graphical Statistics, 1-11 <doi:10.1080/10618600.2021.2000869>.

Galarza, C. E., Matos, L. A., Castro, L. M., & Lachos, V. H. (2022b). Moments of the doubly truncated selection elliptical distributions with emphasis on the unified multivariate skew-t distribution. Journal of Multivariate Analysis, 189, 104944 <doi:10.1016/j.jmva.2021.104944>.

See Also

momentsFMD, meanvarFMD

Examples

mu = c(0.1,0.2,0.3,0.4)
Sigma = matrix(data = c(1,0.2,0.3,0.1,0.2,1,0.4,-0.1,0.3,0.4,1,0.2,0.1,-0.1,0.2,1),
               nrow = length(mu),ncol = length(mu),byrow = TRUE)
cdfFMD(x = c(0.5,0.2,1.0,1.3),mu,Sigma,dist="normal")
cdfFMD(x = c(0.5,0.2,1.0,1.3),mu,Sigma,dist = "t",nu = 4)
cdfFMD(x = c(0.5,0.2,1.0,1.3),mu,Sigma,lambda = c(-2,0,2,1),dist = "SN")
cdfFMD(x = c(0.5,0.2,1.0,1.3),mu,Sigma,lambda = c(-2,0,2,1),tau = 1,dist = "ESN")

Multivariate Extended-Skew Normal Density, Probablilities and Random Deviates Generator

Description

These functions provide the density function, probabilities and a random number generator for the multivariate extended-skew normal (ESN) distribution with mean vector mu, scale matrix Sigma, skewness parameter lambda and extension parameter tau.

Usage

dmvESN(x,mu=rep(0,length(lambda)),Sigma=diag(length(lambda)),lambda,tau=0)
pmvESN(lower = rep(-Inf,length(lambda)),upper=rep(Inf,length(lambda)),
        mu = rep(0,length(lambda)),Sigma,lambda,tau,log2 = FALSE)
rmvESN(n,mu=rep(0,length(lambda)),Sigma=diag(length(lambda)),lambda,tau=0)

Arguments

x

vector or matrix of quantiles. If x is a matrix, each row is taken to be a quantile.

n

number of observations.

lower

the vector of lower limits of length pp.

upper

the vector of upper limits of length pp.

mu

a numeric vector of length pp representing the location parameter.

Sigma

a numeric positive definite matrix with dimension ppxpp representing the scale parameter.

lambda

a numeric vector of length pp representing the skewness parameter for SN and ESN cases. If lambda == 0, the ESN/SN reduces to a normal (symmetric) distribution.

tau

It represents the extension parameter for the ESN distribution. If tau == 0, the ESN reduces to a SN distribution.

log2

a boolean variable, indicating if the log2 result should be returned. This is useful when the true probability is too small for the machine precision.

Value

dmvESN gives the density, pmvESN gives the distribution function, and rmvESN generates random deviates for the Multivariate Extended-Skew Normal Distribution.

Author(s)

Christian E. Galarza <[email protected]> and Victor H. Lachos <[email protected]>

Maintainer: Christian E. Galarza <[email protected]>

References

Galarza, C. E., Lin, T. I., Wang, W. L., & Lachos, V. H. (2021). On moments of folded and truncated multivariate Student-t distributions based on recurrence relations. Metrika, 84(6), 825-850 <doi:10.1007/s00184-020-00802-1>.

Galarza, C. E., Matos, L. A., Dey, D. K., & Lachos, V. H. (2022a). "On moments of folded and doubly truncated multivariate extended skew-normal distributions." Journal of Computational and Graphical Statistics, 1-11 <doi:10.1080/10618600.2021.2000869>.

Galarza, C. E., Matos, L. A., Castro, L. M., & Lachos, V. H. (2022b). Moments of the doubly truncated selection elliptical distributions with emphasis on the unified multivariate skew-t distribution. Journal of Multivariate Analysis, 189, 104944 <doi:10.1016/j.jmva.2021.104944>.

Galarza, C.E., Matos, L.A. and Lachos, V.H. (2022c). An EM algorithm for estimating the parameters of the multivariate skew-normal distribution with censored responses. Metron. <doi:10.1007/s40300-021-00227-4>.

Genz, A., (1992) "Numerical computation of multivariate normal probabilities," Journal of Computational and Graphical Statistics, 1, 141-149 <doi:10.1080/10618600.1992.10477010>.

See Also

dmvSN, pmvSN, rmvSN, meanvarFMD,meanvarTMD,momentsTMD

Examples

#Univariate case
dmvESN(x = -1,mu = 2,Sigma = 5,lambda = -2,tau = 0.5)
rmvESN(n = 100,mu = 2,Sigma = 5,lambda = -2,tau = 0.5)
#Multivariate case
mu = c(0.1,0.2,0.3,0.4)
Sigma = matrix(data = c(1,0.2,0.3,0.1,0.2,1,0.4,-0.1,0.3,0.4,1,0.2,0.1,-0.1,0.2,1),
               nrow = length(mu),ncol = length(mu),byrow = TRUE)
lambda = c(-2,0,1,2)
tau = 2
#One observation
dmvESN(x = c(-2,-1,0,1),mu,Sigma,lambda,tau)
rmvESN(n = 100,mu,Sigma,lambda,tau)
#Many observations as matrix
x = matrix(rnorm(4*10),ncol = 4,byrow = TRUE)
dmvESN(x = x,mu,Sigma,lambda,tau)

lower = rep(-Inf,4)
upper = c(-1,0,2,5)
pmvESN(lower,upper,mu,Sigma,lambda,tau)

Multivariate Extended-Skew t Density, Probablilities and Random Deviates Generator

Description

These functions provide the density function, probabilities and a random number generator for the multivariate extended-skew t (EST) distribution with mean vector mu, scale matrix Sigma, skewness parameter lambda, extension parameter tau and degrees of freedom nu.

Usage

dmvEST(x,mu=rep(0,length(lambda)),Sigma=diag(length(lambda)),lambda,tau=0,nu)
pmvEST(lower = rep(-Inf,length(lambda)),upper=rep(Inf,length(lambda)),
        mu = rep(0,length(lambda)),Sigma,lambda,tau,nu,log2 = FALSE)
rmvEST(n,mu=rep(0,length(lambda)),Sigma=diag(length(lambda)),lambda,tau,nu)

Arguments

x

vector or matrix of quantiles. If x is a matrix, each row is taken to be a quantile.

n

number of observations.

lower

the vector of lower limits of length pp.

upper

the vector of upper limits of length pp.

mu

a numeric vector of length pp representing the location parameter.

Sigma

a numeric positive definite matrix with dimension ppxpp representing the scale parameter.

lambda

a numeric vector of length pp representing the skewness parameter for ST and EST cases. If lambda == 0, the EST/ST reduces to a t (symmetric) distribution.

tau

It represents the extension parameter for the EST distribution. If tau == 0, the EST reduces to a ST distribution.

nu

It represents the degrees of freedom of the Student's t-distribution.

log2

a boolean variable, indicating if the log2 result should be returned. This is useful when the true probability is too small for the machine precision.

Value

dmvEST gives the density, pmvEST gives the distribution function, and rmvEST generates random deviates for the Multivariate Extended-Skew-tt Distribution.

Author(s)

Christian E. Galarza <[email protected]> and Victor H. Lachos <[email protected]>

Maintainer: Christian E. Galarza <[email protected]>

References

Galarza, C. E., Lin, T. I., Wang, W. L., & Lachos, V. H. (2021). On moments of folded and truncated multivariate Student-t distributions based on recurrence relations. Metrika, 84(6), 825-850 <doi:10.1007/s00184-020-00802-1>.

Galarza, C. E., Matos, L. A., Castro, L. M., & Lachos, V. H. (2022b). Moments of the doubly truncated selection elliptical distributions with emphasis on the unified multivariate skew-t distribution. Journal of Multivariate Analysis, 189, 104944 <doi:10.1016/j.jmva.2021.104944>.

Genz, A., (1992) "Numerical computation of multivariate normal probabilities," Journal of Computational and Graphical Statistics, 1, 141-149 <doi:10.1080/10618600.1992.10477010>.

See Also

dmvST, pmvST, rmvST, meanvarFMD,meanvarTMD,momentsTMD

Examples

#Univariate case
dmvEST(x = -1,mu = 2,Sigma = 5,lambda = -2,tau = 0.5,nu=4)
rmvEST(n = 100,mu = 2,Sigma = 5,lambda = -2,tau = 0.5,nu=4)
#Multivariate case
mu = c(0.1,0.2,0.3,0.4)
Sigma = matrix(data = c(1,0.2,0.3,0.1,0.2,1,0.4,-0.1,0.3,0.4,1,0.2,0.1,-0.1,0.2,1),
               nrow = length(mu),ncol = length(mu),byrow = TRUE)
lambda = c(-2,0,1,2)
tau = 2
#One observation
dmvEST(x = c(-2,-1,0,1),mu,Sigma,lambda,tau,nu=4)
rmvEST(n = 100,mu,Sigma,lambda,tau,nu=4)
#Many observations as matrix
x = matrix(rnorm(4*10),ncol = 4,byrow = TRUE)
dmvEST(x = x,mu,Sigma,lambda,tau,nu=4)

lower = rep(-Inf,4)
upper = c(-1,0,2,5)
pmvEST(lower,upper,mu,Sigma,lambda,tau,nu=4)

Multivariate Skew Normal Density and Probabilities and Random Deviates

Description

These functions provide the density function and a random number generator for the multivariate skew normal (SN) distribution with mean vector mu, scale matrix Sigma and skewness parameter lambda.

Usage

dmvSN(x,mu=rep(0,length(lambda)),Sigma=diag(length(lambda)),lambda)
pmvSN(lower = rep(-Inf,length(lambda)),upper=rep(Inf,length(lambda)),
        mu = rep(0,length(lambda)),Sigma,lambda,log2 = FALSE)
rmvSN(n,mu=rep(0,length(lambda)),Sigma=diag(length(lambda)),lambda)

Arguments

x

vector or matrix of quantiles. If x is a matrix, each row is taken to be a quantile.

n

number of observations.

lower

the vector of lower limits of length pp.

upper

the vector of upper limits of length pp.

mu

a numeric vector of length pp representing the location parameter.

Sigma

a numeric positive definite matrix with dimension ppxpp representing the scale parameter.

lambda

a numeric vector of length pp representing the skewness parameter for SN and SN cases. If lambda == 0, the SN/SN reduces to a normal (symmetric) distribution.

log2

a boolean variable, indicating if the log2 result should be returned. This is useful when the true probability is too small for the machine precision.

Value

dmvSN gives the density, pmvSN gives the distribution function, and rmvSN generates random deviates for the Multivariate Skew-normal Distribution.

Author(s)

Christian E. Galarza <[email protected]> and Victor H. Lachos <[email protected]>

Maintainer: Christian E. Galarza <[email protected]>

References

Galarza, C. E., Matos, L. A., Dey, D. K., & Lachos, V. H. (2022a). "On moments of folded and doubly truncated multivariate extended skew-normal distributions." Journal of Computational and Graphical Statistics, 1-11 <doi:10.1080/10618600.2021.2000869>.

Galarza, C. E., Matos, L. A., Castro, L. M., & Lachos, V. H. (2022b). Moments of the doubly truncated selection elliptical distributions with emphasis on the unified multivariate skew-t distribution. Journal of Multivariate Analysis, 189, 104944 <doi:10.1016/j.jmva.2021.104944>.

Galarza, C.E., Matos, L.A. and Lachos, V.H. (2022c). An EM algorithm for estimating the parameters of the multivariate skew-normal distribution with censored responses. Metron. <doi:10.1007/s40300-021-00227-4>.

Genz, A., (1992) "Numerical computation of multivariate normal probabilities," Journal of Computational and Graphical Statistics, 1, 141-149 <doi:10.1080/10618600.1992.10477010>.

See Also

dmvESN, pmvESN, rmvESN, meanvarFMD,meanvarTMD,momentsTMD

Examples

#Univariate case
dmvSN(x = -1,mu = 2,Sigma = 5,lambda = -2)
rmvSN(n = 100,mu = 2,Sigma = 5,lambda = -2)
#Multivariate case
mu = c(0.1,0.2,0.3,0.4)
Sigma = matrix(data = c(1,0.2,0.3,0.1,0.2,1,0.4,-0.1,0.3,0.4,1,0.2,0.1,-0.1,0.2,1),
               nrow = length(mu),ncol = length(mu),byrow = TRUE)
lambda = c(-2,0,1,2)
#One observation
dmvSN(x = c(-2,-1,0,1),mu,Sigma,lambda)
rmvSN(n = 100,mu,Sigma,lambda)
#Many observations as matrix
x = matrix(rnorm(4*10),ncol = 4,byrow = TRUE)
dmvSN(x = x,mu,Sigma,lambda)

lower = rep(-Inf,4)
upper = c(-1,0,2,5)
pmvSN(lower,upper,mu,Sigma,lambda)

Multivariate Skew t Density, Probablilities and Random Deviates Generator

Description

These functions provide the density function, probabilities and a random number generator for the multivariate skew t (EST) distribution with mean vector mu, scale matrix Sigma, skewness parameter lambda and degrees of freedom nu.

Usage

dmvST(x,mu=rep(0,length(lambda)),Sigma=diag(length(lambda)),lambda,nu)
pmvST(lower = rep(-Inf,length(lambda)),upper=rep(Inf,length(lambda)),
        mu = rep(0,length(lambda)),Sigma,lambda,nu,log2 = FALSE)
rmvST(n,mu=rep(0,length(lambda)),Sigma=diag(length(lambda)),lambda,nu)

Arguments

x

vector or matrix of quantiles. If x is a matrix, each row is taken to be a quantile.

n

number of observations.

lower

the vector of lower limits of length pp.

upper

the vector of upper limits of length pp.

mu

a numeric vector of length pp representing the location parameter.

Sigma

a numeric positive definite matrix with dimension ppxpp representing the scale parameter.

lambda

a numeric vector of length pp representing the skewness parameter for ST and EST cases. If lambda == 0, the EST/ST reduces to a t (symmetric) distribution.

nu

It represents the degrees of freedom of the Student's t-distribution.

log2

a boolean variable, indicating if the log2 result should be returned. This is useful when the true probability is too small for the machine precision.

Value

dmvST gives the density, pmvST gives the distribution function, and rmvST generates random deviates for the Multivariate Skew-tt Distribution.

Author(s)

Christian E. Galarza <[email protected]> and Victor H. Lachos <[email protected]>

Maintainer: Christian E. Galarza <[email protected]>

References

Galarza, C. E., Lin, T. I., Wang, W. L., & Lachos, V. H. (2021). On moments of folded and truncated multivariate Student-t distributions based on recurrence relations. Metrika, 84(6), 825-850 <doi:10.1007/s00184-020-00802-1>.

Galarza, C. E., Matos, L. A., Dey, D. K., & Lachos, V. H. (2022a). "On moments of folded and doubly truncated multivariate extended skew-normal distributions." Journal of Computational and Graphical Statistics, 1-11 <doi:10.1080/10618600.2021.2000869>.

Galarza, C. E., Matos, L. A., Castro, L. M., & Lachos, V. H. (2022b). Moments of the doubly truncated selection elliptical distributions with emphasis on the unified multivariate skew-t distribution. Journal of Multivariate Analysis, 189, 104944 <doi:10.1016/j.jmva.2021.104944>.

Genz, A., (1992) "Numerical computation of multivariate normal probabilities," Journal of Computational and Graphical Statistics, 1, 141-149 <doi:10.1080/10618600.1992.10477010>.

See Also

dmvST, pmvST, rmvST, meanvarFMD,meanvarTMD,momentsTMD

Examples

#Univariate case
dmvST(x = -1,mu = 2,Sigma = 5,lambda = -2,nu=4)
rmvST(n = 100,mu = 2,Sigma = 5,lambda = -2,nu=4)
#Multivariate case
mu = c(0.1,0.2,0.3,0.4)
Sigma = matrix(data = c(1,0.2,0.3,0.1,0.2,1,0.4,-0.1,0.3,0.4,1,0.2,0.1,-0.1,0.2,1),
               nrow = length(mu),ncol = length(mu),byrow = TRUE)
lambda = c(-2,0,1,2)
#One observation
dmvST(x = c(-2,-1,0,1),mu,Sigma,lambda,nu=4)
rmvST(n = 100,mu,Sigma,lambda,nu=4)
#Many observations as matrix
x = matrix(rnorm(4*10),ncol = 4,byrow = TRUE)
dmvST(x = x,mu,Sigma,lambda,nu=4)

lower = rep(-Inf,4)
upper = c(-1,0,2,5)
pmvST(lower,upper,mu,Sigma,lambda,nu=4)

Monte Carlo Mean and variance for doubly truncated multivariate distributions

Description

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.

Usage

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

Arguments

lower

the vector of lower limits of length pp.

upper

the vector of upper limits of length pp.

mu

a numeric vector of length pp representing the location parameter.

Sigma

a numeric positive definite matrix with dimension ppxpp representing the scale parameter.

lambda

a numeric matrix of dimension ppxqq representing the skewness/shape matrix parameter for the SUN and SUT distribution. For the ESN and EST distributions (q=1q=1), lambda is a numeric vector of dimension pp (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 qq representing the extension parameter for the SUN and SUT distribution. For the ESN and EST distributions, tau is a positive scalar (q=1q=1). Furthermore, if tau == 0, the ESN (EST) reduces to a SN (ST) distribution.

Gamma

a correlation matrix with dimension qqxqq. 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.

n

number of Monte Carlo samples to be generated.

Value

It returns a list with three elements:

mean

the estimate for the mean vector of length pp

EYY

the estimate for the second moment matrix of dimensions ppxpp

varcov

the estimate for the variance-covariance matrix of dimensions ppxpp

Author(s)

Christian E. Galarza <[email protected]> and Victor H. Lachos <[email protected]>

Maintainer: Christian E. Galarza <[email protected]>

References

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.

See Also

meanvarTMD, rmvSN,rmvESN,rmvST, rmvEST

Examples

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")

Mean and variance for folded multivariate distributions

Description

It computes the mean vector and variance-covariance matrix for the folded p-variate Normal, Skew-normal (SN), Extended Skew-normal (ESN) and Student's t-distribution.

Usage

meanvarFMD(mu,Sigma,lambda = NULL,tau = NULL,nu = NULL,dist)

Arguments

mu

a numeric vector of length pp representing the location parameter.

Sigma

a numeric positive definite matrix with dimension ppxpp representing the scale parameter.

lambda

a numeric vector of length pp representing the skewness parameter for SN and ESN cases. If lambda == 0, the ESN/SN reduces to a normal (symmetric) distribution.

tau

It represents the extension parameter for the ESN distribution. If tau == 0, the ESN reduces to a SN distribution.

nu

It represents the degrees of freedom for the Student's t-distribution. Must be an integer greater than 1.

dist

represents the folded distribution to be computed. The values are normal, SN , ESN and t for the doubly truncated Normal, Skew-normal, Extended Skew-normal and Student's t-distribution respectively.

Details

Normal case by default, i.e., when dist is not provided. Univariate case is also considered, where Sigma will be the variance σ2\sigma^2.

Value

It returns a list with three elements:

mean

the mean vector of length pp

EYY

the second moment matrix of dimensions ppxpp

varcov

the variance-covariance matrix of dimensions ppxpp

Warning

The mean can only be provided when nu is larger than 2. On the other hand, the varcov matrix can only be provided when nu is larger than 3.

Note

Degree of freedom must be a positive integer. If nu >= 200, Normal case is considered."

Author(s)

Christian E. Galarza <[email protected]> and Victor H. Lachos <[email protected]>

Maintainer: Christian E. Galarza <[email protected]>

References

Galarza, C. E., Lin, T. I., Wang, W. L., & Lachos, V. H. (2021). On moments of folded and truncated multivariate Student-t distributions based on recurrence relations. Metrika, 84(6), 825-850 <doi:10.1007/s00184-020-00802-1>.

Galarza, C. E., Matos, L. A., Dey, D. K., & Lachos, V. H. (2022a). "On moments of folded and doubly truncated multivariate extended skew-normal distributions." Journal of Computational and Graphical Statistics, 1-11 <doi:10.1080/10618600.2021.2000869>.

Galarza, C. E., Matos, L. A., Castro, L. M., & Lachos, V. H. (2022b). Moments of the doubly truncated selection elliptical distributions with emphasis on the unified multivariate skew-t distribution. Journal of Multivariate Analysis, 189, 104944 <doi:10.1016/j.jmva.2021.104944>.

See Also

momentsFMD, onlymeanTMD,meanvarTMD,momentsTMD, dmvSN,pmvSN,rmvSN, dmvESN,pmvESN,rmvESN, dmvST,pmvST,rmvST, dmvEST,pmvEST,rmvEST

Examples

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)
value1 = meanvarFMD(mu,Sigma,dist="normal")
value2 = meanvarFMD(mu,Sigma,nu = 4,dist = "t")
value3 = meanvarFMD(mu,Sigma,lambda = c(-2,0,1),dist = "SN")
value4 = meanvarFMD(mu,Sigma,lambda = c(-2,0,1),tau = 1,dist = "ESN")

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 pp.

upper

the vector of upper limits of length pp.

mu

a numeric vector of length pp representing the location parameter.

Sigma

a numeric positive definite matrix with dimension ppxpp representing the scale parameter.

lambda

a numeric matrix of dimension ppxqq representing the skewness/shape matrix parameter for the SUN and SUT distribution. For the ESN and EST distributions (q=1q=1), lambda is a numeric vector of dimension pp (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 qq representing the extension parameter for the SUN and SUT distribution. For the ESN and EST distributions, tau is a positive scalar (q=1q=1). Furthermore, if tau == 0, the ESN (EST) reduces to a SN (ST) distribution.

Gamma

a correlation matrix with dimension qqxqq. 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.

Details

Univariate case is also considered, where Sigma will be the variance σ2\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).

Value

It returns a list with three elements:

mean

the mean vector of length pp

EYY

the second moment matrix of dimensions ppxpp

varcov

the variance-covariance matrix of dimensions ppxpp

Warning

For the tt cases, the algorithm supports degrees of freedom nu <= 2.

Note

If nu >= 300, Normal case is considered."

Author(s)

Christian E. Galarza <[email protected]> and Victor H. Lachos <[email protected]>

Maintainer: Christian E. Galarza <[email protected]>

References

Galarza, C. E., Lin, T. I., Wang, W. L., & Lachos, V. H. (2021). On moments of folded and truncated multivariate Student-t distributions based on recurrence relations. Metrika, 84(6), 825-850 <doi:10.1007/s00184-020-00802-1>.

Galarza, C. E., Matos, L. A., Dey, D. K., & Lachos, V. H. (2022a). "On moments of folded and doubly truncated multivariate extended skew-normal distributions." Journal of Computational and Graphical Statistics, 1-11 <doi:10.1080/10618600.2021.2000869>.

Galarza, C. E., Matos, L. A., Castro, L. M., & Lachos, V. H. (2022b). Moments of the doubly truncated selection elliptical distributions with emphasis on the unified multivariate skew-t distribution. Journal of Multivariate Analysis, 189, 104944 <doi:10.1016/j.jmva.2021.104944>.

See Also

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

Examples

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")


#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)

Moments for folded multivariate distributions

Description

It computes the kappa-th order moments for the folded p-variate Normal, Skew-normal (SN), Extended Skew-normal (ESN) and Student's t-distribution. It also output other lower moments involved in the recurrence approach.

Usage

momentsFMD(kappa,mu,Sigma,lambda = NULL,tau = NULL,nu = NULL,dist)

Arguments

kappa

moments vector of length pp. All its elements must be integers greater or equal to 00. For the Student's-t case, kappa can be a scalar representing the order of the moment.

mu

a numeric vector of length pp representing the location parameter.

Sigma

a numeric positive definite matrix with dimension ppxpp representing the scale parameter.

lambda

a numeric vector of length pp representing the skewness parameter for SN and ESN cases. If lambda == 0, the ESN/SN reduces to a normal (symmetric) distribution.

tau

It represents the extension parameter for the ESN distribution. If tau == 0, the ESN reduces to a SN distribution.

nu

It represents the degrees of freedom for the Student's t-distribution. Must be an integer greater than 1.

dist

represents the folded distribution to be computed. The values are normal, SN , ESN and t for the doubly truncated Normal, Skew-normal, Extended Skew-normal and Student's t-distribution respectively.

Details

Univariate case is also considered, where Sigma will be the variance σ2\sigma^2.

Value

A data frame containing p+1p+1 columns. The pp first containing the set of combinations of exponents summing up to kappa and the last column containing the the expected value. Normal cases (ESN, SN and normal) return prod(kappa)+1 moments while the Student's t-distribution case returns all moments of order up to kappa. See example section.

Warning

For the Student-t cases, including ST and EST, kappa-thth order moments exist only for kappa < nu.

Note

Degrees of freedom must be a positive integer. If nu >= 300, Normal case is considered."

Author(s)

Christian E. Galarza <[email protected]> and Victor H. Lachos <[email protected]>

Maintainer: Christian E. Galarza <[email protected]>

References

Galarza, C. E., Lin, T. I., Wang, W. L., & Lachos, V. H. (2021). On moments of folded and truncated multivariate Student-t distributions based on recurrence relations. Metrika, 84(6), 825-850 <doi:10.1007/s00184-020-00802-1>.

Galarza, C. E., Matos, L. A., Dey, D. K., & Lachos, V. H. (2022a). "On moments of folded and doubly truncated multivariate extended skew-normal distributions." Journal of Computational and Graphical Statistics, 1-11 <doi:10.1080/10618600.2021.2000869>.

Galarza, C. E., Matos, L. A., Castro, L. M., & Lachos, V. H. (2022b). Moments of the doubly truncated selection elliptical distributions with emphasis on the unified multivariate skew-t distribution. Journal of Multivariate Analysis, 189, 104944 <doi:10.1016/j.jmva.2021.104944>.

See Also

meanvarFMD, onlymeanTMD,meanvarTMD,momentsTMD, dmvSN,pmvSN,rmvSN, dmvESN,pmvESN,rmvESN, dmvST,pmvST,rmvST, dmvEST,pmvEST,rmvEST

Examples

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)
value1 = momentsFMD(c(2,0,1),mu,Sigma,dist="normal")
value2 = momentsFMD(3,mu,Sigma,dist = "t",nu = 7)
value3 = momentsFMD(c(2,0,1),mu,Sigma,lambda = c(-2,0,1),dist = "SN")
value4 = momentsFMD(c(2,0,1),mu,Sigma,lambda = c(-2,0,1),tau = 1,dist = "ESN")

#T case with kappa vector input
value5 = momentsFMD(c(2,0,1),mu,Sigma,dist = "t",nu = 7)

Moments for doubly truncated multivariate distributions

Description

It computes kappa-th order moments for for some doubly truncated skew-elliptical distributions. It supports the p-variate Normal, Skew-normal (SN) and Extended Skew-normal (ESN), as well as the Student's-t, Skew-t (ST) and the Extended Skew-t (EST) distribution.

Usage

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

Arguments

kappa

moments vector of length pp. All its elements must be integers greater or equal to 00. For the Student's-t case, kappa can be a scalar representing the order of the moment.

lower

the vector of lower limits of length pp.

upper

the vector of upper limits of length pp.

mu

a numeric vector of length pp representing the location parameter.

Sigma

a numeric positive definite matrix with dimension ppxpp representing the scale parameter.

lambda

a numeric vector of length pp representing the skewness parameter for SN and ESN cases. If lambda == 0, the ESN/SN reduces to a normal (symmetric) distribution.

tau

It represents the extension parameter for the ESN distribution. If tau == 0, the ESN reduces to a SN distribution.

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

Details

Univariate case is also considered, where Sigma will be the variance σ2\sigma^2.

Value

A data frame containing p+1p+1 columns. The pp first containing the set of combinations of exponents summing up to kappa and the last column containing the the expected value. Normal cases (ESN, SN and normal) return prod(kappa)+1 moments while the Student's t-distribution case returns all moments of order up to kappa. See example section.

Note

If nu >= 300, Normal case is considered."

Author(s)

Christian E. Galarza <[email protected]> and Victor H. Lachos <[email protected]>

Maintainer: Christian E. Galarza <[email protected]>

References

Galarza, C. E., Lin, T. I., Wang, W. L., & Lachos, V. H. (2021). On moments of folded and truncated multivariate Student-t distributions based on recurrence relations. Metrika, 84(6), 825-850.

Galarza-Morales, C. E., Matos, L. A., Dey, D. K., & Lachos, V. H. (2022a). "On moments of folded and doubly truncated multivariate extended skew-normal distributions." Journal of Computational and Graphical Statistics, 1-11 <doi:10.1080/10618600.2021.2000869>.

Galarza, C. E., Matos, L. A., Castro, L. M., & Lachos, V. H. (2022b). Moments of the doubly truncated selection elliptical distributions with emphasis on the unified multivariate skew-t distribution. Journal of Multivariate Analysis, 189, 104944 <doi:10.1016/j.jmva.2021.104944>.

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

See Also

onlymeanTMD,meanvarTMD,momentsFMD,meanvarFMD,dmvSN,pmvSN,rmvSN, dmvESN,pmvESN,rmvESN, dmvST,pmvST,rmvST, dmvEST,pmvEST,rmvEST

Examples

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)
value1 = momentsTMD(c(2,0,1),a,b,mu,Sigma,dist="normal")
value2 = momentsTMD(c(2,0,1),a,b,mu,Sigma,dist = "t",nu = 7)
value3 = momentsTMD(c(2,0,1),a,b,mu,Sigma,lambda = c(-2,0,1),dist = "SN")
value4 = momentsTMD(c(2,0,1),a,b,mu,Sigma,lambda = c(-2,0,1),tau = 1,dist = "ESN")


#T cases with kappa scalar (all moments up to 3)
value5 = momentsTMD(3,a,b,mu,Sigma,nu = 7,dist = "t")
value6 = momentsTMD(3,a,b,mu,Sigma,lambda = c(-2,0,1),nu = 7,dist = "ST")
value7 = momentsTMD(3,a,b,mu,Sigma,lambda = c(-2,0,1),tau = 1,nu = 7,dist = "EST")

Mean for doubly truncated multivariate distributions

Description

It computes the mean vector 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

onlymeanTMD(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 pp.

upper

the vector of upper limits of length pp.

mu

a numeric vector of length pp representing the location parameter.

Sigma

a numeric positive definite matrix with dimension ppxpp representing the scale parameter.

lambda

a numeric vector of length pp representing the skewness parameter for SN and ESN cases. If lambda == 0, the ESN/SN reduces to a normal (symmetric) distribution.

tau

It represents the extension parameter for the ESN distribution. If tau == 0, the ESN reduces to a SN distribution.

Gamma

a correlation matrix with dimension qqxqq. 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.

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.

Details

Univariate case is also considered, where Sigma will be the variance σ2\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 proposal in Galarza (2022b).

Value

It returns the mean vector of length pp.

Note

Degrees of freedom must be a positive integer. If nu >= 300, Normal case is considered."

Author(s)

Christian E. Galarza <[email protected]> and Victor H. Lachos <[email protected]>

Maintainer: Christian E. Galarza <[email protected]>

References

Galarza, C. E., Lin, T. I., Wang, W. L., & Lachos, V. H. (2021). On moments of folded and truncated multivariate Student-t distributions based on recurrence relations. Metrika, 84(6), 825-850.

Galarza-Morales, C. E., Matos, L. A., Dey, D. K., & Lachos, V. H. (2022a). "On moments of folded and doubly truncated multivariate extended skew-normal distributions." Journal of Computational and Graphical Statistics, 1-11 <doi:10.1080/10618600.2021.2000869>.

Galarza, C. E., Matos, L. A., Castro, L. M., & Lachos, V. H. (2022b). Moments of the doubly truncated selection elliptical distributions with emphasis on the unified multivariate skew-t distribution. Journal of Multivariate Analysis, 189, 104944 <doi:10.1016/j.jmva.2021.104944>.

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

See Also

momentsTMD, meanvarFMD, momentsFMD,dmvESN,rmvESN

Examples

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)
value1 = onlymeanTMD(a,b,mu,Sigma,dist="normal")

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

value3 = onlymeanTMD(a,b,mu,Sigma,lambda = c(-2,0,1),dist = "SN")
value4 = onlymeanTMD(a,b,mu,Sigma,lambda = c(-2,0,1),tau = 1,dist = "ESN")
value5 = onlymeanTMD(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

value6 = onlymeanTMD(a,b,mu,Sigma,lambda = Lambda,tau = c(-1,2),Gamma = Gamma,dist = "SUN")
value7 = onlymeanTMD(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
value8 = onlymeanTMD(a,b,mu,Sigma,lambda = Lambda,tau = 1,Gamma = Gamma,dist = "SUN")
value9 = onlymeanTMD(a,b,mu,Sigma,lambda = Lambda,tau = 1,Gamma = Gamma,nu = 4,dist = "SUT")

round(value4,2) == round(value8,2)
round(value5,2) == round(value9,2)

Multivariate normal and Student-t probabilities

Description

Computation of Multivariate normal and Student-t probabilities using the classic Genz method form packages mvtnorm and tlrmvnmvt packages. In order to save computational effort, it chooses whether to use the function pmvtnorm (pmvt) from mvtnorm, or functions pmvn (pmvt) from the tlrmvnmvt package, depending of the vector size p, real or integer degrees of freedom nu.

Usage

pmvnormt(lower = rep(-Inf,ncol(sigma)),upper = rep(Inf,ncol(sigma)),
mean = rep(0,ncol(sigma)),sigma,nu = NULL,uselog2 = FALSE)

Arguments

lower

lower integration limits, a numeric vector of length p

upper

upper integration limits, a numeric vector of length p

mean

the location parameter, a numeric vector of length p

sigma

the scale matrix, a square matrix that matches the length of 'lower'

nu

degrees of freedom, a positive real number. If NULL, normal case is considered

uselog2

a boolean variable, indicating if the log2 result should be returned. This is useful when the true probability is too small for the machine precision

Value

The estimated probability or its log2 if uselog2 == TRUE

Note

If is.null(nu), normal case is considered.

Author(s)

Christian E. Galarza <[email protected]> and Victor H. Lachos <[email protected]>

Maintainer: Christian E. Galarza <[email protected]>

References

Genz, A. (1992), "Numerical computation of multivariate normal probabilities," Journal of Computational and Graphical Statistics, 1, 141-149.

Cao, J., Genton, M. G., Keyes, D. E., & Turkiyyah, G. M. "Exploiting Low Rank Covariance Structures for Computing High-Dimensional Normal and Student- t Probabilities" (2019) <https://marcgenton.github.io/2019.CGKT.manuscript.pdf>

See Also

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

Examples

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)

pmvnormt(lower = a,upper = b,mean = mu,sigma = Sigma) #normal case
pmvnormt(lower = a,upper = b,mean = mu,sigma = Sigma,nu = 4.23)  #t case 
pmvnormt(lower = a,upper = b,mean = mu,sigma = Sigma,nu = 4.23,uselog2 = TRUE)