Learn R Programming

bbricks (version 0.1.4)

dT: Density function for (multivariate) t distribution

Description

Get the density of a set of samples from a 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

dT(x, mu, Sigma = NULL, A = NULL, df = 1, LOG = TRUE)

Arguments

x

matrix, when x is a numeric vector, it will be converted to a matrix with 1 column!

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.

LOG

logical, return log density of LOG=TRUE, default TRUE.

Value

A numeric vector, the probability densities.

See Also

rT

Examples

Run this code
# NOT RUN {
plot(
   dT(x=seq(-5,5,length.out = 1000),mu = 0,Sigma = 1,LOG = FALSE)
   ,type = "l"
)
# }

Run the code above in your browser using DataLab