| weighted.test.functions | R Documentation |
The package gMCP provides the following weighted test functions:
Bonferroni test - see ?bonferroni.test for details.
Parametric test - see ?parametric.test for details.
Simes test - see ?simes.test for details.
Trimmed Simes test for intersections of two hypotheses and otherwise Bonferroni - see ?bonferroni.trimmed.simes.test for details.
Simes test for intersections of hypotheses from certain sets and otherwise Bonferroni - see ?simes.on.subsets.test for details.
Depending on whether adjPValues==TRUE these test functions return different values:
If adjPValues==TRUE the minimal value for alpha is returned for which the null hypothesis can be rejected. If that's not possible (for example in case of the trimmed Simes test adjusted p-values can not be calculated), the test function may throw an error.
If adjPValues==FALSE a logical value is returned whether the null hypothesis can be rejected.
To provide your own test function write a function that takes at least the following arguments:
A numeric vector specifying the p-values.
A numeric vector of weights.
A numeric specifying the maximal allowed type one error rate. If adjPValues==TRUE (default) the parameter alpha should not be used.
Logical scalar. If TRUE an adjusted p-value for the weighted test is returned (if possible - if not the function should call stop).
Otherwise if adjPValues==FALSE a logical value is returned whether the null hypothesis can be rejected.
Further arguments possibly passed by gMCP which will be used by other test procedures but not this one.
Further the following parameters have a predefined meaning:
Logical scalar. If TRUE verbose output should be generated and printed to the standard output
Kornelius Rohmeyer rohmeyer@small-projects.de
# The test function 'bonferroni.test' is used in by gMCP in the following call:
graph <- BonferroniHolm(4)
pvalues <- c(0.01, 0.05, 0.03, 0.02)
alpha <- 0.05
r <- gMCP.extended(graph=graph, pvalues=pvalues, test=bonferroni.test, verbose=TRUE)
# For the intersection of all four elementary hypotheses this results in a call
bonferroni.test(pvalues=pvalues, weights=getWeights(graph))
bonferroni.test(pvalues=pvalues, weights=getWeights(graph), adjPValues=FALSE)
# bonferroni.test function:
bonferroni.test <- function(pvalues, weights, alpha=0.05, adjPValues=TRUE, verbose=FALSE, ...) {
if (adjPValues) {
return(min(pvalues/weights))
} else {
return(any(pvalues<=alpha*weights))
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.