R/calc_approx_bic_deprec.R

Defines functions calcApproxBIC

# Deprecated functions

# function for calculating approximate BIC
calcApproxBIC <- function(resObj, BIC=TRUE) {
  nObs <- length(resObj$finalMemb)
  nConP <- prod(dim(resObj$finalCenters))
  nCatP <- sum(sapply(resObj$finalProbs,function(xx) nrow(xx)*( ncol(xx)-1 ) )) # subtract one param for each cat var
  nParmTotal <- nConP + nCatP + 1 # change if different density technique is used
  if (BIC) {
    thisCrit <- log(nObs)*nParmTotal - 2*resObj$finalLogLik
  } else {
    thisCrit <- 2*nParmTotal - 2*resObj$finalLogLik
  }
  return(list(
    criteria = thisCrit
   ,k = nParmTotal
   ,logLik = resObj$finalLogLik
   ,nConParm = nConP
   ,nCatParm = nCatP
  ))
}

Try the kamila package in your browser

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

kamila documentation built on March 13, 2020, 9:08 a.m.