R/mnl_hess.R

Defines functions mnlHess_int

#' @keywords internal
mnlHess_int <- function(int, Obs, n_cat){
  n_Obs 	<- length(Obs)
  betas   <- matrix(c(0, int), byrow = T, ncol = n_cat)
  prob    <- exp(betas) / sum(exp(betas))
  Hess    <- (diag(x = prob[-1], nrow = n_cat-1) - outer(prob[-1],prob[-1])) * n_Obs
  return(Hess)
}

Try the mHMMbayes package in your browser

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

mHMMbayes documentation built on Oct. 2, 2023, 5:06 p.m.