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 |
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.
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).
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]>
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.
onlymeanTMD
,meanvarTMD
,momentsTMD
,dmvSN
,pmvSN
,rmvSN
,dmvST
,pmvST
,rmvST
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
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
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.
cdfFMD(x,mu,Sigma,lambda = NULL,tau = NULL,dist,nu = NULL)
cdfFMD(x,mu,Sigma,lambda = NULL,tau = NULL,dist,nu = NULL)
x |
vector of length |
mu |
a numeric vector of length |
Sigma |
a numeric positive definite matrix with dimension |
lambda |
a numeric vector of length |
tau |
It represents the extension parameter for the ESN distribution. If |
dist |
represents the folded distribution to be computed. The values are |
nu |
It represents the degrees of freedom for the Student's t-distribution. |
Normal case by default, i.e., when dist
is not provided. Univariate case is also considered, where Sigma
will be the variance .
It returns the distribution value for a single point x
.
Degrees of freedom must be a positive integer. If nu >= 200
, Normal case is considered."
Christian E. Galarza <[email protected]> and Victor H. Lachos <[email protected]>
Maintainer: Christian E. Galarza <[email protected]>
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>.
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")
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")
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
.
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)
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)
x |
vector or matrix of quantiles. If |
n |
number of observations. |
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 vector of length |
tau |
It represents the extension parameter for the ESN distribution. If |
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. |
dmvESN
gives the density, pmvESN
gives the distribution function, and rmvESN
generates random deviates for the Multivariate Extended-Skew Normal Distribution.
Christian E. Galarza <[email protected]> and Victor H. Lachos <[email protected]>
Maintainer: Christian E. Galarza <[email protected]>
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>.
dmvSN
, pmvSN
, rmvSN
, meanvarFMD
,meanvarTMD
,momentsTMD
#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)
#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)
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
.
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)
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)
x |
vector or matrix of quantiles. If |
n |
number of observations. |
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 vector of length |
tau |
It represents the extension parameter for the EST distribution. If |
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. |
dmvEST
gives the density, pmvEST
gives the distribution function, and rmvEST
generates random deviates for the Multivariate Extended-Skew- Distribution.
Christian E. Galarza <[email protected]> and Victor H. Lachos <[email protected]>
Maintainer: Christian E. Galarza <[email protected]>
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>.
dmvST
, pmvST
, rmvST
, meanvarFMD
,meanvarTMD
,momentsTMD
#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)
#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)
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
.
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)
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)
x |
vector or matrix of quantiles. If |
n |
number of observations. |
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 vector of length |
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. |
dmvSN
gives the density, pmvSN
gives the distribution function, and rmvSN
generates random deviates for the Multivariate Skew-normal Distribution.
Christian E. Galarza <[email protected]> and Victor H. Lachos <[email protected]>
Maintainer: Christian E. Galarza <[email protected]>
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>.
dmvESN
, pmvESN
, rmvESN
, meanvarFMD
,meanvarTMD
,momentsTMD
#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)
#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)
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
.
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)
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)
x |
vector or matrix of quantiles. If |
n |
number of observations. |
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 vector of length |
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. |
dmvST
gives the density, pmvST
gives the distribution function, and rmvST
generates random deviates for the Multivariate Skew- Distribution.
Christian E. Galarza <[email protected]> and Victor H. Lachos <[email protected]>
Maintainer: Christian E. Galarza <[email protected]>
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>.
dmvST
, pmvST
, rmvST
, meanvarFMD
,meanvarTMD
,momentsTMD
#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)
#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)
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)
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 <[email protected]> and Victor H. Lachos <[email protected]>
Maintainer: Christian E. Galarza <[email protected]>
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")
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")
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.
meanvarFMD(mu,Sigma,lambda = NULL,tau = NULL,nu = NULL,dist)
meanvarFMD(mu,Sigma,lambda = NULL,tau = NULL,nu = NULL,dist)
mu |
a numeric vector of length |
Sigma |
a numeric positive definite matrix with dimension |
lambda |
a numeric vector of length |
tau |
It represents the extension parameter for the ESN distribution. If |
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 case by default, i.e., when dist
is not provided. Univariate case is also considered, where Sigma
will be the variance .
It returns a list with three elements:
mean |
the mean vector of length |
EYY |
the second moment matrix of dimensions |
varcov |
the variance-covariance matrix of dimensions |
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.
Degree of freedom must be a positive integer. If nu >= 200
, Normal case is considered."
Christian E. Galarza <[email protected]> and Victor H. Lachos <[email protected]>
Maintainer: Christian E. Galarza <[email protected]>
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>.
momentsFMD
, onlymeanTMD
,meanvarTMD
,momentsTMD
, dmvSN
,pmvSN
,rmvSN
, dmvESN
,pmvESN
,rmvESN
, dmvST
,pmvST
,rmvST
, dmvEST
,pmvEST
,rmvEST
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")
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")
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.
meanvarTMD(lower = rep(-Inf,length(mu)),upper = rep(Inf,length(mu)),mu,Sigma ,lambda = NULL,tau = NULL,Gamma = NULL,nu = NULL,dist)
meanvarTMD(lower = rep(-Inf,length(mu)),upper = rep(Inf,length(mu)),mu,Sigma ,lambda = NULL,tau = NULL,Gamma = NULL,nu = NULL,dist)
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 |
Univariate case is also considered, where Sigma
will be the variance . 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).
It returns a list with three elements:
mean |
the mean vector of length |
EYY |
the second moment matrix of dimensions |
varcov |
the variance-covariance matrix of dimensions |
For the cases, the algorithm supports degrees of freedom
nu <= 2
.
If nu >= 300
, Normal case is considered."
Christian E. Galarza <[email protected]> and Victor H. Lachos <[email protected]>
Maintainer: Christian E. Galarza <[email protected]>
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>.
MCmeanvarTMD
,
momentsTMD
, meanvarFMD
, meanvarFMD
,momentsFMD
, dmvSN
,pmvSN
,rmvSN
, dmvESN
,pmvESN
,rmvESN
, dmvST
,pmvST
,rmvST
, dmvEST
,pmvEST
,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) # 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)
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)
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.
momentsFMD(kappa,mu,Sigma,lambda = NULL,tau = NULL,nu = NULL,dist)
momentsFMD(kappa,mu,Sigma,lambda = NULL,tau = NULL,nu = NULL,dist)
kappa |
moments vector of length |
mu |
a numeric vector of length |
Sigma |
a numeric positive definite matrix with dimension |
lambda |
a numeric vector of length |
tau |
It represents the extension parameter for the ESN distribution. If |
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 |
Univariate case is also considered, where Sigma
will be the variance .
A data frame containing columns. The
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.
For the Student-t cases, including ST and EST, kappa
- order moments exist only for
kappa < nu
.
Degrees of freedom must be a positive integer. If nu >= 300
, Normal case is considered."
Christian E. Galarza <[email protected]> and Victor H. Lachos <[email protected]>
Maintainer: Christian E. Galarza <[email protected]>
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>.
meanvarFMD
, onlymeanTMD
,meanvarTMD
,momentsTMD
, dmvSN
,pmvSN
,rmvSN
, dmvESN
,pmvESN
,rmvESN
, dmvST
,pmvST
,rmvST
, dmvEST
,pmvEST
,rmvEST
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)
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)
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.
momentsTMD(kappa,lower = rep(-Inf,length(mu)),upper = rep(Inf,length(mu)),mu,Sigma, lambda = NULL,tau = NULL,nu = NULL,dist)
momentsTMD(kappa,lower = rep(-Inf,length(mu)),upper = rep(Inf,length(mu)),mu,Sigma, lambda = NULL,tau = NULL,nu = NULL,dist)
kappa |
moments vector of length |
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 vector of length |
tau |
It represents the extension parameter for the ESN distribution. If |
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 |
Univariate case is also considered, where Sigma
will be the variance .
A data frame containing columns. The
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.
If nu >= 300
, Normal case is considered."
Christian E. Galarza <[email protected]> and Victor H. Lachos <[email protected]>
Maintainer: Christian E. Galarza <[email protected]>
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.
onlymeanTMD
,meanvarTMD
,momentsFMD
,meanvarFMD
,dmvSN
,pmvSN
,rmvSN
, dmvESN
,pmvESN
,rmvESN
, dmvST
,pmvST
,rmvST
, dmvEST
,pmvEST
,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) 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")
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")
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.
onlymeanTMD(lower = rep(-Inf, length(mu)),upper = rep(Inf,length(mu)),mu,Sigma, lambda = NULL,tau = NULL,Gamma = NULL,nu = NULL,dist)
onlymeanTMD(lower = rep(-Inf, length(mu)),upper = rep(Inf,length(mu)),mu,Sigma, lambda = NULL,tau = NULL,Gamma = NULL,nu = NULL,dist)
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 vector of length |
tau |
It represents the extension parameter for the ESN distribution. If |
Gamma |
a correlation matrix with dimension |
nu |
It represents the degrees of freedom for the Student's t-distribution. |
dist |
represents the truncated distribution to be used. The values are |
Univariate case is also considered, where Sigma
will be the variance . 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).
It returns the mean vector of length .
Degrees of freedom must be a positive integer. If nu >= 300
, Normal case is considered."
Christian E. Galarza <[email protected]> and Victor H. Lachos <[email protected]>
Maintainer: Christian E. Galarza <[email protected]>
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.
momentsTMD
, meanvarFMD
, momentsFMD
,dmvESN
,rmvESN
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)
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)
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
.
pmvnormt(lower = rep(-Inf,ncol(sigma)),upper = rep(Inf,ncol(sigma)), mean = rep(0,ncol(sigma)),sigma,nu = NULL,uselog2 = FALSE)
pmvnormt(lower = rep(-Inf,ncol(sigma)),upper = rep(Inf,ncol(sigma)), mean = rep(0,ncol(sigma)),sigma,nu = NULL,uselog2 = FALSE)
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 |
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 |
The estimated probability or its log2 if uselog2 == TRUE
If is.null(nu)
, normal case is considered.
Christian E. Galarza <[email protected]> and Victor H. Lachos <[email protected]>
Maintainer: Christian E. Galarza <[email protected]>
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>
onlymeanTMD
,meanvarTMD
,momentsFMD
,momentsTMD
,meanvarFMD
,dmvSN
,pmvSN
,rmvSN
, dmvESN
,pmvESN
,rmvESN
, dmvST
,pmvST
,rmvST
, dmvEST
,pmvEST
,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) 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)
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)