R/log_likelihood_forB.R

Defines functions log_likelihood_forB

log_likelihood_forB <- function(B, pik = log(rep(1/ncol(B),ncol(B)))){

  if(is.null(B)){
    return (1)
  }

  n <- nrow(B)
  k <- ncol(B)
  temp <- 0

  for(i in 1:n){

      temp <- temp + log_sum_exp(pik+B[i,])

  }

  return(temp)

}
HanweiH/ld documentation built on Dec. 17, 2021, 10:29 p.m.