rT {bbricks}R Documentation

Random Generation for (multivariate) t distribution

Description

Generate random samples from a (multivariate) t distribution. For a random vector x, the density function is defined as:

Gamma((df + p)/2) / (Gamma(df/2)df^{p/2} pi ^{p/2} |Sigma|^{1/2}) [1+1/df (x-df)^T Sigma^{-1} (x-df)]^{-(df +p)/2}

Where p is the dimension of x.

Usage

rT(n, mu, Sigma = NULL, A = NULL, df = 1)

Arguments

n

integer, number of samples.

mu

numeric, mean vector.

Sigma

matrix, Sigma is proportional to the covariance matrix of x, one of Sigma and A should be non-NULL.

A

matrix, the Cholesky decomposition of Sigma, an upper triangular matrix, one of Sigma and A should be non-NULL.

df

numeric, degrees of freedom.

Value

A matrix of n rows and length(mu) columns, each row is a sample.

See Also

dT

Examples


x <- rT(1000,mu = c(1,1),Sigma = matrix(c(1,0.5,0.5,3),2,2))
plot(x)


[Package bbricks version 0.1.4 Index]