R/entropyBayes.R

Defines functions entropyBayes

Documented in entropyBayes

entropyBayes <-
function(cellCounts, unit = unit,
                         priorHyperParam = priorHyperParam){
  hatTheta <- thetaBayes(cellCounts, priorHyperParam = priorHyperParam)
  p0 <- hatTheta$p - prod(dim(hatTheta$thetak))
  hatTheta <- c(hatTheta$thetak, hatTheta$theta0)
  
  if(unit == "bit") logHatTheta <- log2(hatTheta) else
    if(unit == "ban") logHatTheta <- log10(hatTheta) else
      if(unit == "nat") logHatTheta <- log(hatTheta)
  hatTheta[length(hatTheta)] <- p0*hatTheta[length(hatTheta)]
  
  ans <- - sum(hatTheta*logHatTheta)
  return(ans)
}

Try the synRNASeqNet package in your browser

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

synRNASeqNet documentation built on May 2, 2019, 6:01 a.m.