View source: R/upweightSummit.R
upweightSummit | R Documentation |
Upweight the highest-abudance window(s) in a cluster.
upweightSummit(ids, summits)
ids |
an integer vector or factor of cluster IDs |
summits |
a logical vector indicating whether each window is a summit, or an integer vector containing the indices of summit windows |
This function computes weights for each window in a cluster, where the highest-abundance windows are upweighted.
These weights are intended for use in combineTests
, such that the summits of a cluster have a greater influence on the combined p-value.
This is more graduated than simply using the summits alone, as potential DB between summits can still be detected.
Summits can be obtained through findMaxima
or by running getBestTest
with by.pval=FALSE
.
The exact value of the weight is arbitrary. Greater weight represents a stronger belief that DB occurs at the most abundant window. Here, the weighting scheme is designed such that the maximum Simes correction is not more than twice that without weighting. It will also be no more than twice that from applying Simes' method on the summits alone. This (restrained) conservativeness is an acceptable cost for considering DB events elsewhere in the cluster, while still focusing on the most abundant site.
A numeric vector of weights, where the highest-abundance window in each cluster is assigned a greater weight.
Any windows with NA
values for ids
or summits
will have a weight of zero.
Aaron Lun
Benjamini Y and Hochberg Y (1997). Multiple hypotheses testing with weights. Scand. J. Stat. 24, 407-418.
combineTests
,
findMaxima
,
getBestTest
nwin <- 20
set.seed(20)
ids <- sample(5, nwin, replace=TRUE)
summits <- sample(5, nwin, replace=TRUE)==1L
weights <- upweightSummit(ids, summits)
# Checking that the summit is upweighted in each cluster.
split(data.frame(summits, weights), ids)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.