rtmvt: Truncated Multivariate Student t Distribution

Description Usage Arguments Value References Examples

View source: R/rtmvt.R

Description

This function generates random vectors form the truncates multivariate Student t distribution. It uses random sampling from rtmvn since the Student t distribution can be represented as a scale-mixture of normals.

Usage

1
rtmvt(n, Mean, Sigma, nu, D, lower, upper, init)

Arguments

n

number of samples to be generated

Mean

mean vector

Sigma

covariance matrix

nu

degress of freedom for the t-distribution

D

matrix of linear constraints

lower

vector of lower bounds

upper

vector of upper bounds

init

vector of initial values for the Gibbs sampler. Must satisfy the linear constraints.

Value

a matrix of samples with each column being an idependent sample.

References

Li, Y., & Ghosh, S. K. (2015). Efficient sampling methods for truncated multivariate normal and student-t distributions subject to linear inequality constraints. Journal of Statistical Theory and Practice, 9(4), 712-732.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
Mean = rep(0,2)
rho = 0.5
Sigma = matrix(c(10,rho,rho,0.1),2,2)
D = matrix(c(1,1,1,-1),2,2)
varp = Sigma[1,1]+Sigma[2,2]+2*Sigma[1,2] # var of the sum
varm = Sigma[1,1]+Sigma[2,2]-2*Sigma[1,2] # var of the diff
sd = c(sqrt(varp),sqrt(varm))
lower = -1.5*sd; upper = 1.5*sd; int = rep(0,2)
nu = 5
n = 20
rtmvt(n,Mean,Sigma,nu,D,lower,upper,int)

suchitm/tmvn documentation built on Dec. 10, 2020, 10:25 a.m.