draw.d.variate.t: Pseudo-Random Number Generation under Multivariate t...

Description Usage Arguments Value Examples

View source: R/draw.d.variate.t.R

Description

This function implements pseudo-random number generation for a multivariate t distribution with pdf

f(x|μ, Σ, ν)=c≤ft(1+\frac{1}{ν}(x-μ)^{T}Σ^{-1}(x-μ)\right)^{-(ν+d)/2}

for -∞ < x < ∞ and c=\frac{Γ((ν+d)/2)}{Γ(ν/2)(νπ)^{d/2}}|Σ|^{-1/2}, Σ is symmetric and positive definite, ν>0, where μ, Σ, and ν are the mean vector, the variance-covariance matrix, and the degrees of freedom, respectively.

Usage

1
draw.d.variate.t(dof,no.row,d,mean.vec,cov.mat)

Arguments

dof

Degrees of freedom.

no.row

Number of rows to generate.

d

Number of variables to generate.

mean.vec

Vector of means.

cov.mat

Variance-covariance matrix.

Value

A no.row \times d matrix of generated data.

Examples

1
2
3
4
5
cmat<-matrix(c(1,0.2,0.3,0.2,1,0.2,0.3,0.2,1), nrow=3, ncol=3)
meanvec=c(0,3,7)
mydata=draw.d.variate.t(dof=5,no.row=1e5,d=3,mean.vec=meanvec,cov.mat=cmat)
apply(mydata,2,mean)-meanvec
cor(mydata)-cmat

MultiRNG documentation built on March 6, 2021, 1:06 a.m.