Skip to contents

Draws from the multivariate t with location mu, scale matrix sigma and df degrees of freedom using the thread-safe threefry simulator; when lower/upper are finite, draws are exact by the exponential tilting acceptance-rejection method of Botev and L'Ecuyer (2015).

Usage

rxRmvt(
  n,
  mu = NULL,
  sigma,
  df,
  lower = -Inf,
  upper = Inf,
  ncores = 1,
  isChol = FALSE,
  keepNames = TRUE,
  a = 0.4,
  tol = 2.05,
  nlTol = 1e-10,
  nlMaxiter = 100L
)

Arguments

n

Number of random row vectors to be simulated OR the matrix to use for simulation (faster).

mu

location vector

sigma

Scale matrix of the multivariate t, or a list of scale matrices (as in rxRmvn()).

df

degrees of freedom; Inf gives the multivariate normal (rxRmvn()). Truncated draws require df >= 1.

lower

is a vector of the lower bound for the truncated multivariate norm

upper

is a vector of the upper bound for the truncated multivariate norm

ncores

Number of cores used in the simulation

isChol

A boolean indicating if sigma is a cholesky decomposition of the covariance matrix.

keepNames

Keep the names from either the mean or covariance matrix.

a

threshold for switching between methods; They can be tuned for maximum speed; There are three cases that are considered:

case 1: a < l < u

case 2: l < u < -a

case 3: otherwise

where l=lower and u = upper

tol

When case 3 is used from the above possibilities, the tol value controls the acceptance rejection and inverse-transformation;

When abs(u-l)>tol, uses accept-reject from randn

nlTol

Tolerance for newton line-search

nlMaxiter

Maximum iterations for newton line-search

Value

Same as rxRmvn()

References

Botev ZI and L'Ecuyer P (2015) Efficient estimation and simulation of the truncated multivariate student-t distribution. 2015 Winter Simulation Conference doi:10.1109/WSC.2015.7408180

Author

Matthew Fidler

Examples


sigma <- matrix(c(4, 1.8, 1.8, 1), 2)

rxRmvt(4, c(0, 0), sigma, df = 5)
#>            [,1]       [,2]
#> [1,]  0.5721392  0.9418488
#> [2,] -1.3858312 -0.2169252
#> [3,] -0.3383255  0.2638210
#> [4,]  2.8410266  2.0956589

rxRmvt(4, c(0, 0), sigma, df = 5, lower = c(-1, 0), upper = c(2, Inf))
#>            [,1]       [,2]
#> [1,]  0.3409194 0.01282954
#> [2,] -0.5635234 0.08024693
#> [3,]  1.3511722 0.99401078
#> [4,] -0.2287349 0.32242630