R/F_calcWeights.R

Defines functions calcWeights

Documented in calcWeights

#' Obtain weights as posterior probabilities to calculate the consensus null
#'
#' @param logDensPerm A matrix with B rows  of logged density estimates of the B
#'    permutation distributions, and p columns for the p observed test
#'    statistics
#' @param fdr A vector of local false discovery rates for the observed tests
#'  statistics of length p
#'
#' @return A vector of weights of length B
calcWeights = function(logDensPerm, fdr){
    weights = exp(stabExp(colSums(logDensPerm*fdr)))
    weights/sum(weights)
}

Try the reconsi package in your browser

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

reconsi documentation built on Nov. 8, 2020, 5:04 p.m.