rtmvt: Random number generation for truncated multivariate Student's...

Description Usage Arguments Value Examples

View source: R/rtmvt.R

Description

rtmvt simulates truncated multivariate (p-dimensional) Student's t distribution subject to linear inequality constraints. The constraints should be written as a matrix (D) with lower and upper as the lower and upper bounds for those constraints respectively. Note that D can be non-full rank, which generalizes many traditional methods.

Usage

1
rtmvt(n, Mean, Sigma, nu, D, lower, upper, int = NULL, burn = 10, thin = 1)

Arguments

n

number of random samples desired (sample size).

Mean

location vector of the multivariate Student's t distribution.

Sigma

positive definite dispersion matrix of the multivariate t distribution.

nu

degrees of freedom for Student-t distribution.

D

matrix or vector of coefficients of linear inequality constraints.

lower

lower bound vector for truncation.

upper

upper bound vector for truncation.

int

initial value vector for Gibbs sampler (satisfying truncation), if NULL then determine automatically.

burn

burn-in iterations discarded (default as 10).

thin

thinning lag (default as 1).

Value

rtmvt returns a (n*p) matrix (or vector when n=1) containing random numbers which follows truncated multivariate Student-t distribution.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Example for full rank
d <- 3
rho <- 0.5
nu <- 10
Sigma <- matrix(0, nrow=d, ncol=d)
Sigma <- rho^abs(row(Sigma) - col(Sigma))

D1 <- diag(1,d) # Full rank

set.seed(1203)
ans.t <- rtmvt(n=1000, Mean=1:d, Sigma, nu=nu, D=D1, lower=rep(-1,d), upper=rep(1,d),
burn=50, thin=0)

apply(ans.t, 2, summary)

tmvmixnorm documentation built on Sept. 19, 2020, 1:07 a.m.

Related to rtmvt in tmvmixnorm...