rcmvt {CondMVT} | R Documentation |
Conditional Multivariate t Density and Random Deviates
Description
This function provides the random number generator for the conditional multivariate t distribution, [Y given X], where Z = (X,Y) is the fully-joint multivariate t distribution with location vector equal to mean and scatter matrix sigma.
Usage
rcmvt(n, mean, sigma, df,dependent.ind, given.ind, X.given,
check.sigma = TRUE,type = c("Kshirsagar", "shifted"),
method = c("eigen", "svd", "chol"))
Arguments
n |
number of random deviates. |
mean |
location vector, which must be specified. |
sigma |
a symmetric, positive-definte matrix of dimension n x n, which must be specified. |
df |
degrees of freedom, which must be specified |
dependent.ind |
a vector of integers denoting the indices of dependent variable Y. |
given.ind |
a vector of integers denoting the indices of conditoning variable X. |
X.given |
a vector of reals denoting the conditioning value of X. When both given.ind and X.given are missing, the distribution of Y becomes Z[dependent.ind] |
check.sigma |
logical; if |
type |
type of the noncentral multivariate t-distribution. |
method |
string specifying the matrix decomposition used to determine the matrix root of |
Value
A 'vector'
of length n
, equal to the length of 'mean'
Examples
# 10-dimensional multivariate t distribution
n <- 10
df=3
A <- matrix(rt(n^2,df), n, n)
A <- tcrossprod(A,A) #A %*% t(A)
# density of Z[c(2,5)] given Z[c(1,4,7,9)]=c(1,1,0,-1)
dcmvt(x=c(1.2,-1), mean=rep(1,n), sigma=A, df=df,
dependent.ind=c(2,5), given.ind=c(1,4,7,9),
X.given=c(1,1,0,-1))
dcmvt(x=-1, mean=rep(1,n), sigma=A,df=df, dep=3, given=c(1,4,7,9,10), X=c(1,1,0,0,-1))
dcmvt(x=c(1.2,-1), mean=rep(1,n), sigma=A,df=df, dep=c(2,5))
# gives an error since `x' and `dep' are incompatibe
#dcmvt(x=-1, mean=rep(1,n), sigma=A,df=df, dep=c(2,3),
#given=c(1,4,7,9,10), X=c(1,1,0,0,-1))
rcmvt(n=10, mean=rep(1,n), sigma=A,df=df, dep=c(2,5),
given=c(1,4,7,9,10), X=c(1,1,0,0,-1),type="shifted",
method="eigen")
rcmvt(n=10, mean=rep(1,n), sigma=A,df=df, dep=3,
given=c(1,4,7,9,10), X=c(1,1,0,0,-1),type="Kshirsagar",
method="chol")