R/thetaShrink.R

Defines functions thetaShrink

Documented in thetaShrink

thetaShrink <-
function(cellCounts, shrinkageTarget = shrinkageTarget){
  hatThetaML <- thetaML(cellCounts)
  n <- sum(cellCounts)
  
  if(is.null(shrinkageTarget)){
    cellCounts <- as.matrix(cellCounts)
    p <- nrow(cellCounts)*ncol(cellCounts)
    shrinkageTarget <- 1/p
  }
  
  lambda <- shrinkageIntensity(hatThetaML = hatThetaML, n = n,
                               shrinkageTarget = shrinkageTarget)
  
  ans <- lambda*shrinkageTarget + (1 - lambda)*hatThetaML
  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.