R/dmvt.R

Defines functions dmvt

Documented in dmvt

#[export]
dmvt <- function(x, mu, sigma, nu, logged = FALSE) {
  p <- length(mu)
  den <- lgamma( (nu + p)/2 ) - lgamma(nu/2) - 0.5 * p * log(pi * nu) - 
  0.5 * log( det(sigma) ) - 0.5 * (nu + p) * log1p( Rfast::mahala(x, mu, sigma)/nu ) 
  if ( logged ) {
    den <- den
  } else  den <- exp(den)
  den
}

Try the Rfast package in your browser

Any scripts or data that you put into this service are public.

Rfast documentation built on Nov. 9, 2023, 5:06 p.m.