rtmvt | R Documentation |
Draws from truncated multivariate t distribution subject to linear inequality constraints represented by a matrix.
rtmvt( mean, sigma, nu, blc = NULL, lower, upper, init = NULL, burn = 10, n = NULL )
mean |
|
sigma |
|
nu |
degrees of freedom for Student-t distribution. |
blc |
|
lower |
|
upper |
|
init |
|
burn |
number of burn-in iterations. Defaults to 10. |
n |
number of random samples when |
Returns an n x p
matrix of random numbers following the
specified truncated multivariate t distribution.
# Example 1: full rank blc d = 3; rho = 0.5; sigma = matrix(0, d, d); sigma = rho^abs(row(sigma) - col(sigma)); nu = 10; blc = diag(1,d); n = 1000; mean = matrix(rep(1:d,n), nrow=n, ncol=d, byrow=TRUE); set.seed(1203) result = rtmvt(mean, sigma, nu, blc, -1, 1, burn=50) apply(result, 2, summary) # Example 2: use the alternative form of input set.seed(1203) result = rtmvt(mean=1:d, sigma, nu, blc, -1, 1, burn=50, n) apply(result, 2, summary) # Example 3: non-full rank blc, different means d = 3; rho = 0.5; sigma = matrix(0, d, d); sigma = rho^abs(row(sigma) - col(sigma)); nu = 10; blc = matrix(c(1,0,1,1,1,0), nrow=d-1, ncol=d, byrow=TRUE) n = 100; set.seed(3084) mean = matrix(runif(n*d), nrow=n, ncol=d); result = rtmvt(mean, sigma, nu, blc, -1, 1, burn=50) apply(result, 2, summary)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.