Learn R Programming

bfp (version 0.0-48)

rmvt: Multivariate Student Random Deviates

Description

This function provides a random vector generator for the multivariate Student distribution with mean vector mean, scale matrix sigma and degrees of freedom df.

Usage

rmvt(n, sigma = diag(2), mu = rep(0, 2), df = 1)

Value

The vector samples, stacked in the rows of a matrix.

Arguments

n

Number of observations.

sigma

symmetric and positive definite scale matrix

mu

mean vector

df

degree of freedom as integer

Author

Daniel Saban\'es Bov\'e

Examples

Run this code
## samples from the multivariate Cauchy distribution:
bfp:::rmvt(20)

## here the covariance exists:
sigma <- matrix(c(1, 0.5, 0.5, 1), nrow=2)
df <- 10

## theoretical covariance:
sigma * df / (df - 2)

## this should be close:
cov(bfp:::rmvt(n=100000, sigma=sigma, df=df))

Run the code above in your browser using DataLab