R/hellinger.R

Defines functions hellinger

Documented in hellinger

#' @export
hellinger <- function(mu1, cov1, mu2, cov2) {

  d <- nrow(cov1)

  mudiff <- mu2 - mu1
  
  inner <- 0.5* cov1 + 0.5*cov2
  
  a <- (det(cov1)^0.25*det(cov2)*0.25/sqrt(det(inner)))
  b <- exp( -.125*t(mudiff)%*%inner^-1%*%mudiff)
  
  diff <- 1-(
    a*b
  )
  
  
  return(diff)
}

Try the semtree package in your browser

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

semtree documentation built on Nov. 26, 2023, 5:07 p.m.