a guest Jun 25th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. NLLmvnorm <- function(data, mu, sigma) {
  2.   a <- qr(sigma)
  3.   logdet <- sum(log(abs(diag(a$qr))))
  4.   sigma.inv <- fast.ginv(sigma) #fast.ginv gives inverse of a matrix
  5.   -0.5*logdet - 0.5*t(data-mu) %*% sigma.inv %*% (data-mu) - (length(data) / 2) * log(2 * pi) #MVN log likelihood
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand