R/matchCopula.R

Defines functions matchCopula

Documented in matchCopula

#' Match copulas to estimated SP distribution
#'
#' @param cumDens The cumulative densities evaluated
#' @param exprmt.design the design
#' @param copSam the sampled copula
#' @param sel.genes.ii the gene
#'
#' @return the outcome values as a vector
#' @importFrom stats runif
matchCopula = function(cumDens, exprmt.design, copSam, sel.genes.ii){
  vapply(seq_along(exprmt.design$sub.batchs), function(i){
    copula = copSam[sel.genes.ii,i]
    cd = cumDens[[i]]
    id = which.min(abs(cd$Gy-copula))
    
    if(!is.null(cd$breaks)){
      runif(1, cd$breaks[id], cd$breaks[id+1])
    }else{
      0
    }
  }, FUN.VALUE = numeric(1))
}
CenterForStatistics-UGent/SPsimSeq documentation built on April 23, 2024, 4:09 p.m.