Title: | Graph Based Multiple Comparison Procedures |
---|---|
Description: | Functions and a graphical user interface for graphical described multiple test procedures. |
Authors: | Kornelius Rohmeyer [aut, cre], Florian Klinglmueller [aut] |
Maintainer: | Kornelius Rohmeyer <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.8-17 |
Built: | 2024-11-21 06:30:53 UTC |
Source: | CRAN |
This package provides functions and graphical user interfaces for graphical described multiple comparison procedures.
Package: | gMCP |
Type: | Package |
License: | GPL (>= 2) |
The package gMCP helps with the following steps of performing a multiple test procedure:
1. Creating a object of graphMCP
that represents a sequentially rejective multiple test procedure.
This can be either done directly via the new
function or converter functions like matrix2graph
at the R command line or by using a graphical user interface started with function graphGUI
.
3. Exporting the results (optional with all sequential steps) as LaTeX or Word report.
We use the following Java libraries:
Apache Commons Logging under the Apache License, Version 2.0, January 2004, https://commons.apache.org/logging/, Copyright 2001-2007 The Apache Software Foundation
Apache jog4j under Apache License 2.0, https://logging.apache.org/log4j/, Copyright 2007 The Apache Software Foundation
Apache Commons Lang under Apache License 2.0, https://commons.apache.org/lang/, Copyright 2001-2011 The Apache Software Foundation
Apache POI under Apache License 2.0, https://poi.apache.org/, Copyright The Apache Software Foundation
JLaTeXMath under GPL >= 2.0, https://forge.scilab.org/index.php/p/jlatexmath/, Copyright 2004-2007, 2009 Calixte, Coolsaet, Cleemput, Vermeulen and Universiteit Gent
JRI under Lesser General Public License (LGPL) 2.1, https://www.rforge.net/rJava/, Copyright 2004-2007 Simon Urbanek
iText 2.1.4 under LGPL, https://itextpdf.com/, Copyright by Bruno Lowagie
SwingWorker under LGPL, from java.net/projects/swingworker/, Copyright (c) 2005 Sun Microsystems
JXLayer under BSD License, from java.net/projects/jxlayer/, Copyright 2006-2009, Alexander Potochkin
JGoodies Forms under BSD License, https://www.jgoodies.com/freeware/libraries/forms/, Copyright JGoodies Karsten Lentzsch
AFCommons under BSD License, https://web.archive.org/web/20180828002833/http://www.algorithm-forge.com/afcommons/, Copyright (c) 2007-2014 by Kornelius Rohmeyer and Bernd Bischl
JHLIR under BSD License, https://jhlir.r-forge.r-project.org/, Copyright (c) 2008-2014 by Bernd Bischl and Kornelius Rohmeyer
Kornelius Rohmeyer, R code for correlated tests and adaptive designs from Florian Klinglmueller.
Maintainer: Kornelius Rohmeyer [email protected]
Frank Bretz, Martin Posch, Ekkehard Glimm, Florian Klinglmueller, Willi Maurer, Kornelius Rohmeyer (2011): Graphical approaches for multiple comparison procedures using weighted Bonferroni, Simes or parametric tests. Biometrical Journal 53 (6), pages 894-913, Wiley. doi:10.1002/bimj.201000239
Frank Bretz, Willi Maurer, Werner Brannath, Martin Posch: A graphical approach to sequentially rejective multiple test procedures. Statistics in Medicine 2009 vol. 28 issue 4 page 586-604. https://www.meduniwien.ac.at/fwf_adaptive/papers/bretz_2009_22.pdf
g5 <- BonferroniHolm(5) ## Not run: graphGUI("g5") ## End(Not run) gMCP(g5, pvalues=c(0.1,0.2,0.4,0.4,0.4))
g5 <- BonferroniHolm(5) ## Not run: graphGUI("g5") ## End(Not run) gMCP(g5, pvalues=c(0.1,0.2,0.4,0.4,0.4))
Build a block diagonal matrix with NA values outside the diagonal given several building block matrices.
bdiagNA(...)
bdiagNA(...)
... |
individual matrices or a |
This function is usefull to build the correlation matrices, when only partial knowledge of the correlation exists.
A block diagonal matrix with NA values outside the diagonal.
Kornelius Rohmeyer [email protected]
bdiagNA(diag(3), matrix(1/2,nr=3,nc=3), diag(2))
bdiagNA(diag(3), matrix(1/2,nr=3,nc=3), diag(2))
Weighted Bonferroni-test
bonferroni.test( pvalues, weights, alpha = 0.05, adjPValues = TRUE, verbose = FALSE, ... )
bonferroni.test( pvalues, weights, alpha = 0.05, adjPValues = TRUE, verbose = FALSE, ... )
pvalues |
A numeric vector specifying the p-values. |
weights |
A numeric vector of weights. |
alpha |
A numeric specifying the maximal allowed type one error rate. If |
adjPValues |
Logical scalar. If |
verbose |
Logical scalar. If |
... |
Further arguments possibly passed by |
bonferroni.test(pvalues=c(0.1,0.2,0.05), weights=c(0.5,0.5,0)) bonferroni.test(pvalues=c(0.1,0.2,0.05), weights=c(0.5,0.5,0), adjPValues=FALSE)
bonferroni.test(pvalues=c(0.1,0.2,0.05), weights=c(0.5,0.5,0)) bonferroni.test(pvalues=c(0.1,0.2,0.05), weights=c(0.5,0.5,0), adjPValues=FALSE)
Trimmed Simes test for intersections of two hypotheses and otherwise weighted Bonferroni-test
bonferroni.trimmed.simes.test( pvalues, weights, alpha = 0.05, adjPValues = FALSE, verbose = FALSE, ... )
bonferroni.trimmed.simes.test( pvalues, weights, alpha = 0.05, adjPValues = FALSE, verbose = FALSE, ... )
pvalues |
A numeric vector specifying the p-values. |
weights |
A numeric vector of weights. |
alpha |
A numeric specifying the maximal allowed type one error rate. If |
adjPValues |
Logical scalar. If |
verbose |
Logical scalar. If |
... |
Further arguments possibly passed by |
Brannath, W., Bretz, F., Maurer, W., & Sarkar, S. (2009). Trimmed Weighted Simes Test for Two One-Sided Hypotheses With Arbitrarily Correlated Test Statistics. Biometrical Journal, 51(6), 885-898.
bonferroni.trimmed.simes.test(pvalues=c(0.1,0.2,0.05), weights=c(0.5,0.5,0)) bonferroni.trimmed.simes.test(pvalues=c(0.1,0.2,0.05), weights=c(0.5,0.5,0), adjPValues=FALSE)
bonferroni.trimmed.simes.test(pvalues=c(0.1,0.2,0.05), weights=c(0.5,0.5,0)) bonferroni.trimmed.simes.test(pvalues=c(0.1,0.2,0.05), weights=c(0.5,0.5,0), adjPValues=FALSE)
Given the distribution under the alternative (assumed to be multivariate normal), this function calculates the power to reject at least one hypothesis, the local power for the hypotheses as well as the expected number of rejections.
calcPower( weights, alpha, G, mean = rep(0, nrow(corr.sim)), corr.sim = diag(length(mean)), corr.test = NULL, n.sim = 10000, type = c("quasirandom", "pseudorandom"), f = list(), upscale = FALSE, graph, ... )
calcPower( weights, alpha, G, mean = rep(0, nrow(corr.sim)), corr.sim = diag(length(mean)), corr.test = NULL, n.sim = 10000, type = c("quasirandom", "pseudorandom"), f = list(), upscale = FALSE, graph, ... )
weights |
Initial weight levels for the test procedure (see graphTest
function). Alternatively a |
alpha |
Overall alpha level of the procedure, see graphTest function.
(For entangled graphs |
G |
Matrix determining the graph underlying the test procedure. Note
that the diagonal need to contain only 0s, while the rows need to sum to 1.
When multiple graphs should be used this needs to be a list containing the
different graphs as elements. Alternatively a |
mean |
Mean under the alternative |
corr.sim |
Covariance matrix under the alternative. |
corr.test |
Correlation matrix that should be used for the parametric test.
If |
n.sim |
Monte Carlo sample size. If type = "quasirandom" this number is
rounded up to the next power of 2, e.g. 1000 is rounded up to
|
type |
What type of random numbers to use. |
f |
List of user defined power functions (or just a single power
function). If one is interested in the power to reject hypotheses 1 and 3
one could specify: |
upscale |
Logical. If |
graph |
A graph of class |
... |
For backwards compatibility. For example up to version 0.8-7
the parameters |
test |
In the parametric case there is more than one way to handle
subgraphs with less than the full alpha. If the parameter |
A list containg three elements
LocalPower
A numeric giving the local powers for the hypotheses
ExpRejections
The expected number of rejections
PowAtlst1
The power to reject at least one hypothesis
Bretz, F., Maurer, W., Brannath, W. and Posch, M. (2009) A graphical approach to sequentially rejective multiple test procedures. Statistics in Medicine, 28, 586–604
Bretz, F., Maurer, W. and Hommel, G. (2010) Test and power considerations for multiple endpoint analyses using sequentially rejective graphical procedures, to appear in Statistics in Medicine
## reproduce example from Stat Med paper (Bretz et al. 2010, Table I) ## first only consider line 2 of Table I ## significance levels graph <- simpleSuccessiveII() ## alternative (mvn distribution) corMat <- rbind(c(1, 0.5, 0.5, 0.5/2), c(0.5,1,0.5/2,0.5), c(0.5,0.5/2,1,0.5), c(0.5/2,0.5,0.5,1)) theta <- c(3, 0, 0, 0) calcPower(graph=graph, alpha=0.025, mean=theta, corr.sim=corMat, n.sim= 100000) ## now reproduce all 14 simulation scenarios ## different graphs weights1 <- c(rep(1/2, 12), 1, 1) weights2 <- c(rep(1/2, 12), 0, 0) eps <- 0.01 gam1 <- c(rep(0.5, 10), 1-eps, 0, 0, 0) gam2 <- gam1 ## different multivariate normal alternatives rho <- c(rep(0.5, 8), 0, 0.99, rep(0.5,4)) th1 <- c(0, 3, 3, 3, 2, 1, rep(3, 7), 0) th2 <- c(rep(0, 6), 3, 3, 3, 3, 0, 0, 0, 3) th3 <- c(0, 0, 3, 3, 3, 3, 0, 2, 2, 2, 3, 3, 3, 3) th4 <- c(0,0,0,3,3,3,0,2,2,2,0,0,0,0) ## function that calculates power values for one scenario simfunc <- function(nSim, a1, a2, g1, g2, rh, t1, t2, t3, t4, Gr){ al <- c(a1, a2, 0, 0) G <- rbind(c(0, g1, 1-g1, 0), c(g2, 0, 0, 1-g2), c(0, 1, 0, 0), c(1, 0, 0, 0)) corMat <- rbind(c(1, 0.5, rh, rh/2), c(0.5,1,rh/2,rh), c(rh,rh/2,1,0.5), c(rh/2,rh,0.5,1)) mean <- c(t1, t2, t3, t4) calcPower(weights=al, alpha=0.025, G=G, mean=mean, corr.sim=corMat, n.sim = nSim) } ## calculate power for all 14 scenarios outList <- list() for(i in 1:14){ outList[[i]] <- simfunc(10000, weights1[i], weights2[i], gam1[i], gam2[i], rho[i], th1[i], th2[i], th3[i], th4[i]) } ## summarize data as in Stat Med paper Table I atlst1 <- as.numeric(lapply(outList, function(x) x$PowAtlst1)) locpow <- do.call("rbind", lapply(outList, function(x) x$LocalPower)) round(cbind(atlst1, locpow), 5)
## reproduce example from Stat Med paper (Bretz et al. 2010, Table I) ## first only consider line 2 of Table I ## significance levels graph <- simpleSuccessiveII() ## alternative (mvn distribution) corMat <- rbind(c(1, 0.5, 0.5, 0.5/2), c(0.5,1,0.5/2,0.5), c(0.5,0.5/2,1,0.5), c(0.5/2,0.5,0.5,1)) theta <- c(3, 0, 0, 0) calcPower(graph=graph, alpha=0.025, mean=theta, corr.sim=corMat, n.sim= 100000) ## now reproduce all 14 simulation scenarios ## different graphs weights1 <- c(rep(1/2, 12), 1, 1) weights2 <- c(rep(1/2, 12), 0, 0) eps <- 0.01 gam1 <- c(rep(0.5, 10), 1-eps, 0, 0, 0) gam2 <- gam1 ## different multivariate normal alternatives rho <- c(rep(0.5, 8), 0, 0.99, rep(0.5,4)) th1 <- c(0, 3, 3, 3, 2, 1, rep(3, 7), 0) th2 <- c(rep(0, 6), 3, 3, 3, 3, 0, 0, 0, 3) th3 <- c(0, 0, 3, 3, 3, 3, 0, 2, 2, 2, 3, 3, 3, 3) th4 <- c(0,0,0,3,3,3,0,2,2,2,0,0,0,0) ## function that calculates power values for one scenario simfunc <- function(nSim, a1, a2, g1, g2, rh, t1, t2, t3, t4, Gr){ al <- c(a1, a2, 0, 0) G <- rbind(c(0, g1, 1-g1, 0), c(g2, 0, 0, 1-g2), c(0, 1, 0, 0), c(1, 0, 0, 0)) corMat <- rbind(c(1, 0.5, rh, rh/2), c(0.5,1,rh/2,rh), c(rh,rh/2,1,0.5), c(rh/2,rh,0.5,1)) mean <- c(t1, t2, t3, t4) calcPower(weights=al, alpha=0.025, G=G, mean=mean, corr.sim=corMat, n.sim = nSim) } ## calculate power for all 14 scenarios outList <- list() for(i in 1:14){ outList[[i]] <- simfunc(10000, weights1[i], weights2[i], gam1[i], gam2[i], rho[i], th1[i], th2[i], th3[i], th4[i]) } ## summarize data as in Stat Med paper Table I atlst1 <- as.numeric(lapply(outList, function(x) x$PowAtlst1)) locpow <- do.call("rbind", lapply(outList, function(x) x$LocalPower)) round(cbind(atlst1, locpow), 5)
Starts a graphical user interface for the correlation matrices.
corMatWizard(n, matrix, names, envir = globalenv())
corMatWizard(n, matrix, names, envir = globalenv())
n |
Square root of the dimension of the quadratic |
matrix |
Variable name of matrix of dimension |
names |
Row and column names. (Default will be H1,H2,...,Hn.) |
envir |
Environment where the object matrix is located and/or it should be saved (default is the global environment). |
The function itself returns NULL. But with the dialog a symmetric
matrix of dimension can be created or edited that will
be available in R under the specified variable name after saving.
Kornelius Rohmeyer [email protected]
## Not run: corMatWizard(5) # is equivalent to corMatWizard(matrix=diag(5)) corMatWizard(names=c("H1", "H2", "H3", "E1", "E2")) C <- cor(matrix(rnorm(100),10), matrix(rnorm(100),10)) corMatWizard(matrix="C") # or corMatWizard(matrix=C) ## End(Not run)
## Not run: corMatWizard(5) # is equivalent to corMatWizard(matrix=diag(5)) corMatWizard(names=c("H1", "H2", "H3", "E1", "E2")) C <- cor(matrix(rnorm(100),10), matrix(rnorm(100),10)) corMatWizard(matrix="C") # or corMatWizard(matrix=C) ## End(Not run)
Computes partial conditional errors (PCE) for a pre-planned graphical procedure given information fractions and first stage z-scores. - Implementation of adaptive procedures is still in an early stage and may change in the near future
doInterim(graph, z1, v, alpha = 0.025)
doInterim(graph, z1, v, alpha = 0.025)
graph |
A graph of class |
z1 |
A numeric vector giving first stage z-scores. |
v |
A numeric vector giving the proportions of pre-planned measurements collected up to the interim analysis. Will be recycled of length different than the number of elementary hypotheses. |
alpha |
A numeric specifying the maximal allowed type one error rate. |
For details see the given references.
An object of class gPADInterim
, more specifically a list with
elements
Aj
a matrix of PCEs for all elementary hypotheses in each intersection hypothesis
BJ
a numeric vector giving sum of PCEs per intersection hypothesis
preplanned
Pre planned test represented by an object of class
Florian Klinglmueller [email protected]
Frank Bretz, Willi Maurer, Werner Brannath, Martin Posch: A graphical approach to sequentially rejective multiple test procedures. Statistics in Medicine 2009 vol. 28 issue 4 page 586-604. https://www.meduniwien.ac.at/fwf_adaptive/papers/bretz_2009_22.pdf
Frank Bretz, Martin Posch, Ekkehard Glimm, Florian Klinglmueller, Willi Maurer, Kornelius Rohmeyer (2011): Graphical approaches for multiple comparison procedures using weighted Bonferroni, Simes or parametric tests. Biometrical Journal 53 (6), pages 894-913, Wiley. doi:10.1002/bimj.201000239
Posch M, Futschik A (2008): A Uniform Improvement of Bonferroni-Type Tests by Sequential Tests JASA 103/481, 299-308
Posch M, Maurer W, Bretz F (2010): Type I error rate control in adaptive designs for confirmatory clinical trials with treatment selection at interim Pharm Stat 10/2, 96-104
## Simple successive graph (Maurer et al. 2011) ## two treatments two hierarchically ordered endpoints a <- .025 G <- simpleSuccessiveI() ## some z-scores: p1=c(.1,.12,.21,.16) z1 <- qnorm(1-p1) p2=c(.04,1,.14,1) z2 <- qnorm(1-p2) v <- c(1/2,1/3,1/2,1/3) intA <- doInterim(G,z1,v) ## select only the first treatment fTest <- secondStageTest(intA,c(1,0,1,0))
## Simple successive graph (Maurer et al. 2011) ## two treatments two hierarchically ordered endpoints a <- .025 G <- simpleSuccessiveI() ## some z-scores: p1=c(.1,.12,.21,.16) z1 <- qnorm(1-p1) p2=c(.04,1,.14,1) z2 <- qnorm(1-p2) v <- c(1/2,1/3,1/2,1/3) intA <- doInterim(G,z1,v) ## select only the first treatment fTest <- secondStageTest(intA,c(1,0,1,0))
A entangledMCP object describes ... TODO
subgraphs
:A list of graphs of class graphMCP.
weights
:A numeric.
graphAttr
:A list for graph attributes like color, etc.
signature(object = "entangledMCP")
: A method for printing the data of the entangled graph to the R console.
signature(object = "entangledMCP")
: A method for getting the list of transition matrices of the entangled graph.
signature(object = "entangledMCP")
: A method for getting the matrix of weights of the entangled graph.
signature(object = "entangledMCP")
:
A method for getting the information whether the hypotheses are marked in the graph as already rejected.
If a second optional argument node
is specified, only for these nodes the boolean vector will be returned.
signature(object = "entangledMCP")
:
A method for getting the x coordinates of the graph.
If a second optional argument node
is specified, only for these nodes the x coordinates will be returned.
If x coordinates are not yet set, NULL
is returned.
signature(object = "entangledMCP")
:
A method for getting the y coordinates of the graph
If a second optional argument node
is specified, only for these nodes the x coordinates will be returned.
If y coordinates are not yet set, NULL
is returned.
Kornelius Rohmeyer [email protected]
g1 <- BonferroniHolm(2) g2 <- BonferroniHolm(2) graph <- new("entangledMCP", subgraphs=list(g1,g2), weights=c(0.5,0.5)) getMatrices(graph) getWeights(graph)
g1 <- BonferroniHolm(2) g2 <- BonferroniHolm(2) graph <- new("entangledMCP", subgraphs=list(g1,g2), weights=c(0.5,0.5)) getMatrices(graph) getWeights(graph)
Functions that creates example graphs, e.g. graphs that represents a Bonferroni-Holm adjustment, parallel gatekeeping or special procedures from selected papers.
BonferroniHolm(n, weights = rep(1/n, n)) BretzEtAl2011() BauerEtAl2001() BretzEtAl2009a() BretzEtAl2009b() BretzEtAl2009c() HommelEtAl2007() HommelEtAl2007Simple() parallelGatekeeping() improvedParallelGatekeeping() fallback(weights) fixedSequence(n) simpleSuccessiveI() simpleSuccessiveII() truncatedHolm(gamma) generalSuccessive(weights = c(1/2, 1/2), gamma, delta) HuqueAloshEtBhore2011() HungEtWang2010(nu, tau, omega) MaurerEtAl1995() cycleGraph(nodes, weights) improvedFallbackI(weights = rep(1/3, 3)) improvedFallbackII(weights = rep(1/3, 3)) FerberTimeDose2011(times, doses, w = "\\nu") Ferber2011(w) Entangled1Maurer2012() Entangled2Maurer2012() WangTing2014(nu, tau)
BonferroniHolm(n, weights = rep(1/n, n)) BretzEtAl2011() BauerEtAl2001() BretzEtAl2009a() BretzEtAl2009b() BretzEtAl2009c() HommelEtAl2007() HommelEtAl2007Simple() parallelGatekeeping() improvedParallelGatekeeping() fallback(weights) fixedSequence(n) simpleSuccessiveI() simpleSuccessiveII() truncatedHolm(gamma) generalSuccessive(weights = c(1/2, 1/2), gamma, delta) HuqueAloshEtBhore2011() HungEtWang2010(nu, tau, omega) MaurerEtAl1995() cycleGraph(nodes, weights) improvedFallbackI(weights = rep(1/3, 3)) improvedFallbackII(weights = rep(1/3, 3)) FerberTimeDose2011(times, doses, w = "\\nu") Ferber2011(w) Entangled1Maurer2012() Entangled2Maurer2012() WangTing2014(nu, tau)
n |
Number of hypotheses. |
weights |
Numeric vector of node weights. |
gamma |
An optional number in [0,1] specifying the value for variable gamma. |
delta |
An optional number in [0,1] specifying the value for variable delta. |
nu |
An optional number in [0,1] specifying the value for variable nu. |
tau |
An optional number in [0,1] specifying the value for variable tau. |
omega |
An optional number in [0,1] specifying the value for variable omega. |
nodes |
Character vector of node names. |
times |
Number of time points. |
doses |
Number of dose levels. |
w |
Further variable weight(s) in graph. |
We are providing functions and not the resulting graphs directly because
this way you have additional examples: You can look at the function body
with body
and see how the graph is built.
Returns a graph that represents a
Bonferroni-Holm adjustment. The result is a complete graph, where all nodes
have the same weights and each edge weight is .
Graph in figure 2 from Bretz et al. See references (Bretz et al. 2011).
Graph from Hommel et al. See references (Hommel et al. 2007).
Graph for parallel gatekeeping. See references (Dmitrienko et al. 2003).
Graph for improved parallel gatekeeping. See references (Hommel et al. 2007).
Graph from Hung et Wang. See references (Hung et Wang 2010).
Graph from Maurer et al. See references (Maurer et al. 1995).
Cycle
graph. The weight weights[i]
specifies the edge weight from node
to node
for
and
weight[n]
from node to node 1.
Graph for the improved Fallback Procedure by Wiens & Dmitrienko. See references (Wiens et Dmitrienko 2005).
Graph for the improved Fallback Procedure by Hommel & Bretz. See references (Hommel et Bretz 2008).
Graph from Ferber et al. See references (Ferber et al. 2011).
Graph from Ferber et al. See references (Ferber et al. 2011).
Entangled graph from Maurer et al. TODO: Add references as soon as they are available.
A graph of class graphMCP
that represents a
sequentially rejective multiple test procedure.
Kornelius Rohmeyer [email protected]
Holm, S. (1979). A simple sequentally rejective multiple test procedure. Scandinavian Journal of Statistics 6, 65-70.
Dmitrienko, A., Offen, W., Westfall, P.H. (2003). Gatekeeping strategies for clinical trials that do not require all primary effects to be significant. Statistics in Medicine. 22, 2387-2400.
Bretz, F., Maurer, W., Brannath, W., Posch, M.: A graphical approach to sequentially rejective multiple test procedures. Statistics in Medicine 2009 vol. 28 issue 4 page 586-604. https://www.meduniwien.ac.at/fwf_adaptive/papers/bretz_2009_22.pdf
Bretz, F., Maurer, W. and Hommel, G. (2011), Test and power considerations for multiple endpoint analyses using sequentially rejective graphical procedures. Statistics in Medicine, 30: 1489–1501.
Hommel, G., Bretz, F. und Maurer, W. (2007). Powerful short-cuts for multiple testing procedures with special reference to gatekeeping strategies. Statistics in Medicine, 26(22), 4063-4073.
Hommel, G., Bretz, F. (2008): Aesthetics and power considerations in multiple testing - a contradiction? Biometrical Journal 50:657-666.
Hung H.M.J., Wang S.-J. (2010). Challenges to multiple testing in clinical trials. Biometrical Journal 52, 747-756.
W. Maurer, L. Hothorn, W. Lehmacher: Multiple comparisons in drug clinical trials and preclinical assays: a-priori ordered hypotheses. In Biometrie in der chemisch-pharmazeutischen Industrie, Vollmar J (ed.). Fischer Verlag: Stuttgart, 1995; 3-18.
Maurer, W., & Bretz, F. (2013). Memory and other properties of multiple test procedures generated by entangled graphs. Statistics in medicine, 32 (10), 1739-1753.
Wiens, B.L., Dmitrienko, A. (2005): The fallback procedure for evaluating a single family of hypotheses. Journal of Biopharmaceutical Statistics 15:929-942.
Wang, B., Ting, N. (2014). An Application of Graphical Approach to Construct Multiple Testing Procedures in a Hypothetical Phase III Design. Frontiers in public health, 1 (75).
Ferber, G. Staner, L. and Boeijinga, P. (2011): Structured multiplicity and confirmatory statistical analyses in pharmacodynamic studies using the quantitative electroencephalogram, Journal of neuroscience methods, Volume 201, Issue 1, Pages 204-212.
g <- BonferroniHolm(5) gMCP(g, pvalues=c(0.1, 0.2, 0.4, 0.4, 0.7)) HungEtWang2010() HungEtWang2010(nu=1)
g <- BonferroniHolm(5) gMCP(g, pvalues=c(0.1, 0.2, 0.4, 0.4, 0.7)) HungEtWang2010() HungEtWang2010(nu=1)
Calculates local power values, expected number of rejections, the power to reject at least one hypothesis and the power to reject all hypotheses.
extractPower(x, f = list())
extractPower(x, f = list())
x |
A matrix containing the rejected hypothesis, as produces by the graphTest function. |
f |
List of user defined power functions. If one is interested in the
power to reject hypotheses 1 and 3 one could specify |
A list containg at least the following four elements and
an element for each element in the parameter f
.
LocPower
A numeric giving the local powers for the hypotheses
ExpNrRej
The expected number of rejections
PowAtlst1
The power to reject at least one hypothesis
RejectAll
The power to reject all hypotheses
compute rejection bounds for z-scores of each elementary hypotheses within each intersection hypotheses
generateBounds( g, w, cr, al = 0.05, hint = generateWeights(g, w), upscale = FALSE )
generateBounds( g, w, cr, al = 0.05, hint = generateWeights(g, w), upscale = FALSE )
g |
graph defined as a matrix, each element defines how much of the local alpha reserved for the hypothesis corresponding to its row index is passed on to the hypothesis corresponding to its column index |
w |
vector of weights, defines how much of the overall alpha is initially reserved for each elementary hypothesis |
cr |
correlation matrix if p-values arise from one-sided tests with multivariate normal distributed test statistics for which the correlation is partially known. Unknown values can be set to NA. (See details for more information) |
al |
overall alpha level at which the family error is controlled |
hint |
if intersection hypotheses weights have already been computed
(output of |
upscale |
if |
It is assumed that under the global null hypothesis
follow a multivariate normal
distribution with correlation matrix
cr
where denotes
the inverse of the standard normal distribution function.
For example, this is the case if are the raw p-values
from one-sided z-tests for each of the elementary hypotheses where the
correlation between z-test statistics is generated by an overlap in the
observations (e.g. comparison with a common control, group-sequential
analyses etc.). An application of the transformation
to raw p-values from a two-sided test will not in general lead to a
multivariate normal distribution. Partial knowledge of the correlation
matrix is supported. The correlation matrix has to be passed as a numeric
matrix with elements of the form:
for diagonal
elements,
, where
is the
known value of the correlation between
and
or
NA
if the corresponding correlation is
unknown. For example correlation[1,2]=0 indicates that the first and second
test statistic are uncorrelated, whereas correlation[2,3] = NA means that
the true correlation between statistics two and three is unknown and may
take values between -1 and 1. The correlation has to be specified for
complete blocks (ie.: if cor(i,j), and cor(i,k) for i!=j!=k are specified
then cor(j,k) has to be specified as well) otherwise the corresponding
intersection null hypotheses tests are not uniquely defined and an error is
returned.
The parametric tests in (Bretz et al. (2011)) are defined such that the
tests of intersection null hypotheses always exhaust the full alpha level
even if the sum of weights is strictly smaller than one. This has the
consequence that certain test procedures that do not test each intersection
null hypothesis at the full level alpha may not be implemented (e.g., a
single step Dunnett test). If upscale
is set to FALSE
(default) the parametric tests are performed at a reduced level alpha of
sum(w) * alpha and p-values adjusted accordingly such that test procedures
with non-exhaustive weighting strategies may be implemented. If set to
TRUE
the tests are performed as defined in Equation (3) of (Bretz et
al. (2011)).
Returns a matrix of rejection bounds. Each row corresponds to an intersection hypothesis. The intersection corresponding to each line is given by conversion of the line number into binary (eg. 13 is binary 1101 and corresponds to (H1,H2,H4))
Florian Klinglmueller
Bretz F, Maurer W, Brannath W, Posch M; (2008) - A graphical approach to sequentially rejective multiple testing procedures. - Stat Med - 28/4, 586-604
Frank Bretz, Martin Posch, Ekkehard Glimm, Florian Klinglmueller, Willi Maurer, Kornelius Rohmeyer (2011): Graphical approaches for multiple comparison procedures using weighted Bonferroni, Simes or parametric tests. Biometrical Journal 53 (6), pages 894-913, Wiley. doi:10.1002/bimj.201000239
## Define some graph as matrix g <- matrix(c(0,0,1,0, 0,0,0,1, 0,1,0,0, 1,0,0,0), nrow = 4,byrow=TRUE) ## Choose weights w <- c(.5,.5,0,0) ## Some correlation (upper and lower first diagonal 1/2) c <- diag(4) c[1:2,3:4] <- NA c[3:4,1:2] <- NA c[1,2] <- 1/2 c[2,1] <- 1/2 c[3,4] <- 1/2 c[4,3] <- 1/2 ## Boundaries for correlated test statistics at alpha level .05: generateBounds(g,w,c,.05)
## Define some graph as matrix g <- matrix(c(0,0,1,0, 0,0,0,1, 0,1,0,0, 1,0,0,0), nrow = 4,byrow=TRUE) ## Choose weights w <- c(.5,.5,0,0) ## Some correlation (upper and lower first diagonal 1/2) c <- diag(4) c[1:2,3:4] <- NA c[3:4,1:2] <- NA c[1,2] <- 1/2 c[2,1] <- 1/2 c[3,4] <- 1/2 c[4,3] <- 1/2 ## Boundaries for correlated test statistics at alpha level .05: generateBounds(g,w,c,.05)
compute adjusted p-values either for the closed test defined by the graph or for each elementary hypotheses within each intersection hypotheses
generatePvals( g, w, cr, p, adjusted = TRUE, hint = generateWeights(g, w), upscale = FALSE )
generatePvals( g, w, cr, p, adjusted = TRUE, hint = generateWeights(g, w), upscale = FALSE )
g |
graph defined as a matrix, each element defines how much of the local alpha reserved for the hypothesis corresponding to its row index is passed on to the hypothesis corresponding to its column index |
w |
vector of weights, defines how much of the overall alpha is initially reserved for each elementary hypothesis |
cr |
correlation matrix if p-values arise from one-sided tests with multivariate normal distributed test statistics for which the correlation is partially known. Unknown values can be set to NA. (See details for more information) |
p |
vector of observed unadjusted p-values, that belong to
test-statistics with a joint multivariate normal null distribution with
(partially) known correlation matrix |
adjusted |
logical, if TRUE (default) adjusted p-values for the closed test are returned, else a matrix of p-values adjusted only for each intersection hypothesis is returned |
hint |
if intersection hypotheses weights have already been computed
(output of |
upscale |
if |
It is assumed that under the global null hypothesis
follow a multivariate normal
distribution with correlation matrix
cr
where denotes
the inverse of the standard normal distribution function.
For example, this is the case if are the raw p-values
from one-sided z-tests for each of the elementary hypotheses where the
correlation between z-test statistics is generated by an overlap in the
observations (e.g. comparison with a common control, group-sequential
analyses etc.). An application of the transformation
to raw p-values from a two-sided test will not in general lead to a
multivariate normal distribution. Partial knowledge of the correlation
matrix is supported. The correlation matrix has to be passed as a numeric
matrix with elements of the form:
for diagonal elements,
, where
is the known value of the
correlation between
and
or
NA
if the corresponding correlation is unknown. For example cr[1,2]=0
indicates that the first and second test statistic are uncorrelated, whereas
cr[2,3] = NA means that the true correlation between statistics two and
three is unknown and may take values between -1 and 1. The correlation has
to be specified for complete blocks (ie.: if cor(i,j), and cor(i,k) for
i!=j!=k are specified then cor(j,k) has to be specified as well) otherwise
the corresponding intersection null hypotheses tests are not uniquely
defined and an error is returned.
The parametric tests in (Bretz et al. (2011)) are defined such that the
tests of intersection null hypotheses always exhaust the full alpha level
even if the sum of weights is strictly smaller than one. This has the
consequence that certain test procedures that do not test each intersection
null hypothesis at the full level alpha may not be implemented (e.g., a
single step Dunnett test). If upscale
is set to FALSE
(default) the parametric tests are performed at a reduced level alpha of
sum(w) * alpha and p-values adjusted accordingly such that test procedures
with non-exhaustive weighting strategies may be implemented. If set to
TRUE
the tests are performed as defined in Equation (3) of (Bretz et
al. (2011)).
If adjusted is set to true returns a vector of adjusted p-values. Any elementary null hypothesis is rejected if its corresponding adjusted p-value is below the predetermined alpha level. For adjusted set to false a matrix with p-values adjusted only within each intersection hypotheses is returned. The intersection corresponding to each line is given by conversion of the line number into binary (eg. 13 is binary 1101 and corresponds to (H1,H2,H4)). If any adjusted p-value within a given line falls below alpha, then the corresponding intersection hypotheses can be rejected.
Florian Klinglmueller
Bretz F, Maurer W, Brannath W, Posch M; (2008) - A graphical approach to sequentially rejective multiple testing procedures. - Stat Med - 28/4, 586-604 Bretz F, Posch M, Glimm E, Klinglmueller F, Maurer W, Rohmeyer K; (2011) - Graphical approaches for multiple endpoint problems using weighted Bonferroni, Simes or parametric tests - to appear
## Define some graph as matrix g <- matrix(c(0,0,1,0, 0,0,0,1, 0,1,0,0, 1,0,0,0), nrow = 4, byrow=TRUE) ## Choose weights w <- c(.5,.5,0,0) ## Some correlation (upper and lower first diagonal 1/2) c <- diag(4) c[1:2,3:4] <- NA c[3:4,1:2] <- NA c[1,2] <- 1/2 c[2,1] <- 1/2 c[3,4] <- 1/2 c[4,3] <- 1/2 ## p-values as Section 3 of Bretz et al. (2011), p <- c(0.0121,0.0337,0.0084,0.0160) ## Boundaries for correlated test statistics at alpha level .05: generatePvals(g,w,c,p) g <- Entangled2Maurer2012() generatePvals(g=g, cr=diag(5), p=rep(0.1,5))
## Define some graph as matrix g <- matrix(c(0,0,1,0, 0,0,0,1, 0,1,0,0, 1,0,0,0), nrow = 4, byrow=TRUE) ## Choose weights w <- c(.5,.5,0,0) ## Some correlation (upper and lower first diagonal 1/2) c <- diag(4) c[1:2,3:4] <- NA c[3:4,1:2] <- NA c[1,2] <- 1/2 c[2,1] <- 1/2 c[3,4] <- 1/2 c[4,3] <- 1/2 ## p-values as Section 3 of Bretz et al. (2011), p <- c(0.0121,0.0337,0.0084,0.0160) ## Boundaries for correlated test statistics at alpha level .05: generatePvals(g,w,c,p) g <- Entangled2Maurer2012() generatePvals(g=g, cr=diag(5), p=rep(0.1,5))
generates a test function for the multiple comparison procedure with correlated test statistics defined by a graph
generateTest(g, w, cr, al, upscale = FALSE)
generateTest(g, w, cr, al, upscale = FALSE)
g |
graph defined as a matrix, each element defines how much of the local alpha reserved for the hypothesis corresponding to its row index is passed on to the hypothesis corresponding to its column index |
w |
vector of weights, defines how much of the overall alpha is initially reserved for each elementary hypothesis |
cr |
correlation matrix if p-values arise from one-sided tests with multivariate normal distributed test statistics for which the correlation is partially known. Unknown values can be set to NA. (See details for more information) |
al |
overall alpha level at which the family error is controlled |
upscale |
if |
It is assumed that under the global null hypothesis
follow a multivariate normal
distribution with correlation matrix
cr
where denotes
the inverse of the standard normal distribution function.
For example, this is the case if are the raw p-values
from one-sided z-tests for each of the elementary hypotheses where the
correlation between z-test statistics is generated by an overlap in the
observations (e.g. comparison with a common control, group-sequential
analyses etc.). An application of the transformation
to raw p-values from a two-sided test will not in general lead to a
multivariate normal distribution. Partial knowledge of the correlation
matrix is supported. The correlation matrix has to be passed as a numeric
matrix with elements of the form:
for diagonal elements,
, where
is the known value of the
correlation between
and
or
NA
if the corresponding correlation is unknown. For example cr[1,2]=0
indicates that the first and second test statistic are uncorrelated, whereas
cr[2,3] = NA means that the true correlation between statistics two and
three is unknown and may take values between -1 and 1. The correlation has
to be specified for complete blocks (ie.: if cor(i,j), and cor(i,k) for
i!=j!=k are specified then cor(j,k) has to be specified as well) otherwise
the corresponding intersection null hypotheses tests are not uniquely
defined and an error is returned.
The parametric tests in (Bretz et al. (2011)) are defined such that the
tests of intersection null hypotheses always upscale the full alpha level
even if the sum of weights is strictly smaller than one. This has the
consequence that certain test procedures that do not test each intersection
null hypothesis at the full level alpha may not be implemented (e.g., a
single step Dunnett test). If upscale
is set to FALSE
(default) the parametric tests are performed at a reduced level alpha of
sum(w) * alpha. If set to
TRUE
the tests are performed as defined in Equation (3) of (Bretz et
al. (2011)).
Returns a function that will take a vector of z-scores to which the test will be applied. This function in turn will return a boolean vector with elements false if the particular elementary hypothesis can not be rejected and true otherwise.
Florian Klinglmueller
Bretz F, Maurer W, Brannath W, Posch M; (2008) - A graphical approach to sequentially rejective multiple testing procedures. - Stat Med - 28/4, 586-604 Bretz F, Posch M, Glimm E, Klinglmueller F, Maurer W, Rohmeyer K; (2011) - Graphical approaches for multiple endpoint problems using weighted Bonferroni, Simes or parametric tests - to appear
## Define some graph as matrix g <- matrix(c(0,0,1,0, 0,0,0,1, 0,1,0,0, 1,0,0,0), nrow = 4,byrow=TRUE) ## Choose weights w <- c(.5,.5,0,0) ## Some correlation (upper and lower first diagonal 1/2) c <- diag(4) c[1:2,3:4] <- NA c[3:4,1:2] <- NA c[1,2] <- 1/2 c[2,1] <- 1/2 c[3,4] <- 1/2 c[4,3] <- 1/2 ## Test function for further use: myTest <- generateTest(g,w,c,.05) myTest(c(3,2,1,2))
## Define some graph as matrix g <- matrix(c(0,0,1,0, 0,0,0,1, 0,1,0,0, 1,0,0,0), nrow = 4,byrow=TRUE) ## Choose weights w <- c(.5,.5,0,0) ## Some correlation (upper and lower first diagonal 1/2) c <- diag(4) c[1:2,3:4] <- NA c[3:4,1:2] <- NA c[1,2] <- 1/2 c[2,1] <- 1/2 c[3,4] <- 1/2 c[4,3] <- 1/2 ## Test function for further use: myTest <- generateTest(g,w,c,.05) myTest(c(3,2,1,2))
compute Weights for each intersection Hypotheses in the closure of a graph based multiple testing procedure
generateWeights(g, w)
generateWeights(g, w)
g |
Graph either defined as a matrix (each element defines how much of the
local alpha reserved for the hypothesis corresponding to its row index is
passed on to the hypothesis corresponding to its column index), as |
w |
Vector of weights, defines how much of the overall alpha is
initially reserved for each elementary hypthosis. Can be missing if |
Returns matrix with each row corresponding to one intersection hypothesis in the closure of the multiple testing problem. The first half of elements indicate whether an elementary hypotheses is in the intersection (1) or not (0). The second half of each row gives the weights allocated to each elementary hypotheses in the intersection.
Florian Klinglmueller <[email protected]>, Kornelius Rohmeyer [email protected]
Bretz F, Maurer W, Brannath W, Posch M; (2008) - A graphical approach to sequentially rejective multiple testing procedures. - Stat Med - 28/4, 586-604 Bretz F, Posch M, Glimm E, Klinglmueller F, Maurer W, Rohmeyer K; (2011) - Graphical approaches for multiple endpoint problems using weighted Bonferroni, Simes or parametric tests - to appear
g <- matrix(c(0,0,1,0, 0,0,0,1, 0,1,0,0, 1,0,0,0), nrow = 4,byrow=TRUE) ## Choose weights w <- c(.5,.5,0,0) ## Weights of conventional gMCP test: generateWeights(g,w) g <- Entangled2Maurer2012() generateWeights(g)
g <- matrix(c(0,0,1,0, 0,0,0,1, 0,1,0,0, 1,0,0,0), nrow = 4,byrow=TRUE) ## Choose weights w <- c(.5,.5,0,0) ## Weights of conventional gMCP test: generateWeights(g,w) g <- Entangled2Maurer2012() generateWeights(g)
Get Memory and Runtime Info from JVM
getJavaInfo(memory = TRUE, filesystem = TRUE, runtime = TRUE)
getJavaInfo(memory = TRUE, filesystem = TRUE, runtime = TRUE)
memory |
Logical whether to include memory information + number of available cores |
filesystem |
Logical whether to include filesystem information (Total, free and usable space) |
runtime |
Logical whether to include runtime information (Class Path, Library Path, Input Arguments) |
character vector of length 1 containing the memory and runtime info.
Kornelius Rohmeyer [email protected]
## Not run: cat(getJavaInfo()) ## End(Not run)
## Not run: cat(getJavaInfo()) ## End(Not run)
Performs a graph based multiple test procedure for a given graph and unadjusted p-values.
gMCP( graph, pvalues, test, correlation, alpha = 0.05, approxEps = TRUE, eps = 10^(-3), ..., upscale = ifelse(missing(test) && !missing(correlation) || !missing(test) && test == "Bretz2011", TRUE, FALSE), useC = FALSE, verbose = FALSE, keepWeights = FALSE, adjPValues = TRUE )
gMCP( graph, pvalues, test, correlation, alpha = 0.05, approxEps = TRUE, eps = 10^(-3), ..., upscale = ifelse(missing(test) && !missing(correlation) || !missing(test) && test == "Bretz2011", TRUE, FALSE), useC = FALSE, verbose = FALSE, keepWeights = FALSE, adjPValues = TRUE )
graph |
A graph of class |
pvalues |
A numeric vector specifying the p-values for the graph based MCP. Note the assumptions in the details section for the parametric tests, when a correlation is specified. |
test |
Should be either |
correlation |
Optional correlation matrix. If the weighted Simes test
is performed, it is checked whether type I error rate can be ensured and a
warning is given if this is not the case. For parametric tests the p-values
must arise from one-sided tests with multivariate normal distributed test
statistics for which the correlation is (partially) known. In that case a
weighted parametric closed test is performed (also see
|
alpha |
A numeric specifying the maximal allowed type one error rate. |
approxEps |
A boolean specifying whether epsilon values should be
substituted with the value given in the parameter |
eps |
A numeric scalar specifying a value for epsilon edges. |
... |
Test specific arguments can be given here. |
upscale |
Logical. If For backward comptibility the default value is TRUE if a the parameter |
useC |
Logical scalar. If |
verbose |
Logical scalar. If |
keepWeights |
Logical scalar. If |
adjPValues |
Logical scalar. If |
For the Bonferroni procedure the p-values can arise from any statistical test, but if you improve the test by specifying a correlation matrix, the following assumptions apply:
It is assumed that under the global null hypothesis
follow a multivariate normal
distribution with correlation matrix
correlation
where
denotes the inverse of the standard normal distribution
function.
For example, this is the case if are the raw p-values
from one-sided z-tests for each of the elementary hypotheses where the
correlation between z-test statistics is generated by an overlap in the
observations (e.g. comparison with a common control, group-sequential
analyses etc.). An application of the transformation
to raw p-values from a two-sided test will not in general lead to a
multivariate normal distribution. Partial knowledge of the correlation
matrix is supported. The correlation matrix has to be passed as a numeric
matrix with elements of the form:
for diagonal
elements,
, where
is the
known value of the correlation between
and
or
NA
if the corresponding correlation is
unknown. For example correlation[1,2]=0 indicates that the first and second
test statistic are uncorrelated, whereas correlation[2,3] = NA means that
the true correlation between statistics two and three is unknown and may
take values between -1 and 1. The correlation has to be specified for
complete blocks (ie.: if cor(i,j), and cor(i,j') for i!=j!=j' are specified
then cor(j,j') has to be specified as well) otherwise the corresponding
intersection null hypotheses tests are not uniquely defined and an error is
returned.
For further details see the given references.
An object of class gMCPResult
, more specifically a list with
elements
graphs
list of graphs
pvalues
p-values
rejected
logical whether hyptheses could be rejected
adjPValues
adjusted p-values
Kornelius Rohmeyer [email protected]
Frank Bretz, Willi Maurer, Werner Brannath, Martin Posch: A graphical approach to sequentially rejective multiple test procedures. Statistics in Medicine 2009 vol. 28 issue 4 page 586-604. https://www.meduniwien.ac.at/fwf_adaptive/papers/bretz_2009_22.pdf
Bretz F., Posch M., Glimm E., Klinglmueller F., Maurer W., Rohmeyer K. (2011): Graphical approaches for multiple endpoint problems using weighted Bonferroni, Simes or parametric tests. Biometrical Journal 53 (6), pages 894-913, Wiley. doi:10.1002/bimj.201000239
Strassburger K., Bretz F.: Compatible simultaneous lower confidence bounds for the Holm procedure and other Bonferroni based closed tests. Statistics in Medicine 2008; 27:4914-4927.
Hommel G., Bretz F., Maurer W.: Powerful short-cuts for multiple testing procedures with special reference to gatekeeping strategies. Statistics in Medicine 2007; 26:4063-4073.
Guilbaud O.: Simultaneous confidence regions corresponding to Holm's stepdown procedure and other closed-testing procedures. Biometrical Journal 2008; 50:678-692.
g <- BonferroniHolm(5) gMCP(g, pvalues=c(0.01, 0.02, 0.04, 0.04, 0.7)) # Simple Bonferroni with empty graph: g2 <- matrix2graph(matrix(0, nrow=5, ncol=5)) gMCP(g2, pvalues=c(0.01, 0.02, 0.04, 0.04, 0.7)) # With 'upscale=TRUE' equal to BonferroniHolm: gMCP(g2, pvalues=c(0.01, 0.02, 0.04, 0.04, 0.7), upscale=TRUE) # Entangled graphs: g3 <- Entangled2Maurer2012() gMCP(g3, pvalues=c(0.01, 0.02, 0.04, 0.04, 0.7), correlation=diag(5))
g <- BonferroniHolm(5) gMCP(g, pvalues=c(0.01, 0.02, 0.04, 0.04, 0.7)) # Simple Bonferroni with empty graph: g2 <- matrix2graph(matrix(0, nrow=5, ncol=5)) gMCP(g2, pvalues=c(0.01, 0.02, 0.04, 0.04, 0.7)) # With 'upscale=TRUE' equal to BonferroniHolm: gMCP(g2, pvalues=c(0.01, 0.02, 0.04, 0.04, 0.7), upscale=TRUE) # Entangled graphs: g3 <- Entangled2Maurer2012() gMCP(g3, pvalues=c(0.01, 0.02, 0.04, 0.04, 0.7), correlation=diag(5))
Performs a graph based multiple test procedure for a given graph and unadjusted p-values.
gMCP.extended( graph, pvalues, test, alpha = 0.05, eps = 10^(-3), upscale = FALSE, verbose = FALSE, adjPValues = TRUE, ... )
gMCP.extended( graph, pvalues, test, alpha = 0.05, eps = 10^(-3), upscale = FALSE, verbose = FALSE, adjPValues = TRUE, ... )
graph |
A graph of class |
pvalues |
A numeric vector specifying the p-values for the graph based
MCP. Note the assumptions in the description of the selected test (if there are any -
for example |
test |
A weighted test function. The package gMCP provides the following weighted test functions:
To provide your own test function see |
alpha |
A numeric specifying the maximal allowed type one error rate. |
eps |
A numeric scalar specifying a value for epsilon edges. |
upscale |
Logical. If |
verbose |
Logical scalar. If |
adjPValues |
Logical scalar. If |
... |
Test specific arguments can be given here. |
An object of class gMCPResult
, more specifically a list with
elements
graphs
list of graphs
pvalues
p-values
rejected
logical whether hyptheses could be rejected
adjPValues
adjusted p-values
Kornelius Rohmeyer [email protected]
Frank Bretz, Willi Maurer, Werner Brannath, Martin Posch: A graphical approach to sequentially rejective multiple test procedures. Statistics in Medicine 2009 vol. 28 issue 4 page 586-604. https://www.meduniwien.ac.at/fwf_adaptive/papers/bretz_2009_22.pdf
Bretz F., Posch M., Glimm E., Klinglmueller F., Maurer W., Rohmeyer K. (2011): Graphical approaches for multiple endpoint problems using weighted Bonferroni, Simes or parametric tests. Biometrical Journal 53 (6), pages 894-913, Wiley. doi:10.1002/bimj.201000239
Strassburger K., Bretz F.: Compatible simultaneous lower confidence bounds for the Holm procedure and other Bonferroni based closed tests. Statistics in Medicine 2008; 27:4914-4927.
Hommel G., Bretz F., Maurer W.: Powerful short-cuts for multiple testing procedures with special reference to gatekeeping strategies. Statistics in Medicine 2007; 26:4063-4073.
Guilbaud O.: Simultaneous confidence regions corresponding to Holm's stepdown procedure and other closed-testing procedures. Biometrical Journal 2008; 50:678-692.
g <- BonferroniHolm(5) gMCP(g, pvalues=c(0.01, 0.02, 0.04, 0.04, 0.7)) # Simple Bonferroni with empty graph: g2 <- matrix2graph(matrix(0, nrow=5, ncol=5)) gMCP(g2, pvalues=c(0.01, 0.02, 0.04, 0.04, 0.7)) # With 'upscale=TRUE' equal to BonferroniHolm: gMCP(g2, pvalues=c(0.01, 0.02, 0.04, 0.04, 0.7), upscale=TRUE) # Entangled graphs: g3 <- Entangled2Maurer2012() gMCP(g3, pvalues=c(0.01, 0.02, 0.04, 0.04, 0.7), correlation=diag(5))
g <- BonferroniHolm(5) gMCP(g, pvalues=c(0.01, 0.02, 0.04, 0.04, 0.7)) # Simple Bonferroni with empty graph: g2 <- matrix2graph(matrix(0, nrow=5, ncol=5)) gMCP(g2, pvalues=c(0.01, 0.02, 0.04, 0.04, 0.7)) # With 'upscale=TRUE' equal to BonferroniHolm: gMCP(g2, pvalues=c(0.01, 0.02, 0.04, 0.04, 0.7), upscale=TRUE) # Entangled graphs: g3 <- Entangled2Maurer2012() gMCP(g3, pvalues=c(0.01, 0.02, 0.04, 0.04, 0.7), correlation=diag(5))
Creates a LaTeX file with a gMCP Report.
gMCPReport(object, file = "", ...)
gMCPReport(object, file = "", ...)
object |
A graph of class |
file |
A connection, or a character string naming the file to print to.
If |
... |
Arguments to be passed to method |
This function uses cat
and graph2latex
.
None (invisible NULL
).
Kornelius Rohmeyer [email protected]
The TikZ and PGF Packages Manual for version 2.00, Till Tantau, https://www.ctan.org/pkg/pgf/
g <- BretzEtAl2011() result <- gMCP(g, pvalues=c(0.1, 0.008, 0.005, 0.15, 0.04, 0.006)) gMCPReport(result)
g <- BretzEtAl2011() result <- gMCP(g, pvalues=c(0.1, 0.008, 0.005, 0.15, 0.04, 0.006)) gMCPReport(result)
A gMCPResult object describes an evaluated sequentially rejective multiple test procedure.
graphs
:Object of class list
.
alpha
:A numeric
specifying the maximal type I error rate.
pvalues
:The numeric
vector of pvalues.
rejected
:The logical
vector of rejected null hypotheses.
adjPValues
:The numeric
vector of adjusted pvalues.
Kornelius Rohmeyer [email protected]
A gPADInterim object describes an object holding interim information for an adaptive procedure that is based on a preplanned graphical procedure.
Aj
:Object of class numeric
. Giving partial
conditional errors (PCEs) for all elementary hypotheses in each
intersection hypothesis
BJ
:A numeric
specifying the sum of PCEs per
intersection hypothesis.
z1
:The numeric
vector of first stage
z-scores.
v
:A numeric
specifying the proportion of
measurements collected up to interim
preplanned
:Object of class graphMCP
specifying the preplanned graphical procedure.
alpha
:A numeric
giving the alpha level of the
pre-planned test
Florian Klinglmueller [email protected]
gMCP
, doInterim
, secondStageTest
Creates LaTeX code that represents the given graph.
graph2latex( graph, package = "TikZ", scale = 1, showAlpha = FALSE, alpha = 0.05, pvalues, fontsize, nodeTikZ, labelTikZ = "near start,above,fill=blue!20", tikzEnv = TRUE, offset = c(0, 0), fill = list(reject = "red!80", retain = "green!80"), fig = FALSE, fig.label = NULL, fig.caption = NULL, fig.caption.short = NULL, nodeR = 25, scaleText = TRUE )
graph2latex( graph, package = "TikZ", scale = 1, showAlpha = FALSE, alpha = 0.05, pvalues, fontsize, nodeTikZ, labelTikZ = "near start,above,fill=blue!20", tikzEnv = TRUE, offset = c(0, 0), fill = list(reject = "red!80", retain = "green!80"), fig = FALSE, fig.label = NULL, fig.caption = NULL, fig.caption.short = NULL, nodeR = 25, scaleText = TRUE )
graph |
A graph of class |
package |
A character string specifying the LaTeX package that should
be used. Up to now only |
scale |
A numeric scalar specifying a possible scaling of the graph.
It is only used if |
showAlpha |
Logical whether local alpha levels or weights should be shown. |
alpha |
An optional numeric argument to specify the type I error rate. |
pvalues |
If the optional numeric argument pvalues is given, nodes that can be rejected, will be marked. |
fontsize |
An optional character vector specifying the fontsize for the
graph, must be one of |
nodeTikZ |
A character string with additional arguments for the TikZ
|
labelTikZ |
A character string with arguments for the TikZ |
tikzEnv |
Logical whether the LaTeX code should be wrapped in a TikZ environment. |
offset |
A numeric of length 2 specifying the x and y offset in the TikZ environment. |
fill |
A list containing 2 elements |
fig |
Logical whether a figure environment should be created. |
fig.label |
Label for figure environment (if |
fig.caption |
Caption for figure environment (if |
fig.caption.short |
Optional short version of fig.caption for list of figures (if |
nodeR |
Radius of nodes (pixel in Java, bp in LaTeX). |
scaleText |
Only used if scale is unequal 1 and |
For details see the given references.
A character string that contains LaTeX code representing the given graph.
Kornelius Rohmeyer [email protected]
The TikZ and PGF Packages Manual for version 2.00, Till Tantau, https://www.ctan.org/pkg/pgf/
g <- BonferroniHolm(5) graph2latex(g)
g <- BonferroniHolm(5) graph2latex(g)
Creates LaTeX code that represents the given graph.
graphAnalysis(graph, file = "")
graphAnalysis(graph, file = "")
graph |
A graph of class |
file |
A connection, or a character string naming the file to print to.
If |
In the moment it is only tested whether each node is accessible from each other node. Further analysis will be added in future versions.
A character string that contains the printed analysis.
Kornelius Rohmeyer [email protected]
g <- BonferroniHolm(5) graphAnalysis(g)
g <- BonferroniHolm(5) graphAnalysis(g)
Starts a graphical user interface for the creation/modification of directed weighted graphs and applying graphical described multiple comparison procedures.
graphGUI( graph = "createdGraph", pvalues = numeric(0), grid = 0, debug = FALSE, experimentalFeatures = FALSE, envir = globalenv() )
graphGUI( graph = "createdGraph", pvalues = numeric(0), grid = 0, debug = FALSE, experimentalFeatures = FALSE, envir = globalenv() )
graph |
Either a variable name for the graph, given as a character
string. (If it is not a syntactically valid name, |
pvalues |
Numeric value that optionally specifies the p-values. |
grid |
Positive integer that sets the grid size for easier placement of nodes. (Therefore grid size 1 allows unrestricted placement and disables the grid.) The default grid=0 uses the last used grid value or if the GUI is started the first time a value of 50. |
debug |
Logical. If |
experimentalFeatures |
Logical. If |
envir |
Environment where the object graph is located and/or it should be saved (default is the global environment). |
See the vignette of this package for further details, since describing a GUI interface is better done with a lot of nice pictures.
The GUI can save result files if asked to, can look for a new version on CRAN (if this behaviour has been approved by the user), will change the random seed in the R session if this is specified by the user in the options (default: no) and could send bug reports if an error occurs and the user approves it.
The function itself returns NULL. But with the GUI a graph can be created or edited that will be available in R under the specified variable name after saving in the specified environment.
Kornelius Rohmeyer [email protected]
## Not run: graphGUI() pvalues <- c(9.7, 1.5, 0.5, 0.6, 0.4, 0.8, 4)/100 graphGUI(HommelEtAl2007(), pvalues=pvalues) x <- new.env() assign("graph", BonferroniHolm(3), envir=x) graphGUI("graph", envir=x) ## End(Not run)
## Not run: graphGUI() pvalues <- c(9.7, 1.5, 0.5, 0.6, 0.4, 0.8, 4)/100 graphGUI(HommelEtAl2007(), pvalues=pvalues) x <- new.env() assign("graph", BonferroniHolm(3), envir=x) graphGUI("graph", envir=x) ## End(Not run)
A graphMCP object describes a sequentially rejective multiple test procedure.
m
:A transition matrix. Can be either numerical
or character
depending whether the matrix contains variables or not. Row and column names will
be the names of the nodes.
weights
:A numeric.
edgeAttr
:A list for edge attributes.
nodeAttr
:A list for node attributes.
signature(object = "graphMCP")
: A method for getting the transition matrix of the graph.
signature(object = "graphMCP")
: A method for getting the weights.
If a third optional argument node
is specified, only for these nodes the weight will be returned.
signature(object = "graphMCP")
: A method for setting the weights.
If a third optional argument node
is specified, only for these nodes the weight will be set.
signature(object = "graphMCP")
:
A method for getting the information whether the hypotheses are marked in the graph as already rejected.
If a second optional argument node
is specified, only for these nodes the boolean vector will be returned.
signature(object = "graphMCP")
:
A method for getting the x coordinates of the graph.
If a second optional argument node
is specified, only for these nodes the x coordinates will be returned.
If x coordinates are not set yet NULL
is returned.
signature(object = "graphMCP")
:
A method for getting the y coordinates of the graph
If a second optional argument node
is specified, only for these nodes the x coordinates will be returned.
If y coordinates are not set yet NULL
is returned.
signature(from="character", to="character", graph="graphNEL", weights="numeric")
:
A method for adding new edges with the given weights.
signature(from="character", to="character", graph="graphMCP", weights="character")
:
A method for adding new edges with the given weights.
Kornelius Rohmeyer [email protected]
m <- rbind(H11=c(0, 0.5, 0, 0.5, 0, 0 ), H21=c(1/3, 0, 1/3, 0, 1/3, 0 ), H31=c(0, 0.5, 0, 0, 0, 0.5), H12=c(0, 1, 0, 0, 0, 0 ), H22=c(0.5, 0, 0.5, 0, 0, 0 ), H32=c(0, 1, 0, 0, 0, 0 )) weights <- c(1/3, 1/3, 1/3, 0, 0, 0) # Graph creation graph <- new("graphMCP", m=m, weights=weights) # Visualization settings nodeX <- rep(c(100, 300, 500), 2) nodeY <- rep(c(100, 300), each=3) graph@nodeAttr$X <- nodeX graph@nodeAttr$Y <- nodeY getWeights(graph) getRejected(graph) pvalues <- c(0.1, 0.008, 0.005, 0.15, 0.04, 0.006) result <- gMCP(graph, pvalues) getWeights(result@graphs[[4]]) getRejected(result@graphs[[4]])
m <- rbind(H11=c(0, 0.5, 0, 0.5, 0, 0 ), H21=c(1/3, 0, 1/3, 0, 1/3, 0 ), H31=c(0, 0.5, 0, 0, 0, 0.5), H12=c(0, 1, 0, 0, 0, 0 ), H22=c(0.5, 0, 0.5, 0, 0, 0 ), H32=c(0, 1, 0, 0, 0, 0 )) weights <- c(1/3, 1/3, 1/3, 0, 0, 0) # Graph creation graph <- new("graphMCP", m=m, weights=weights) # Visualization settings nodeX <- rep(c(100, 300, 500), 2) nodeY <- rep(c(100, 300), each=3) graph@nodeAttr$X <- nodeX graph@nodeAttr$Y <- nodeY getWeights(graph) getRejected(graph) pvalues <- c(0.1, 0.008, 0.005, 0.15, 0.04, 0.006) result <- gMCP(graph, pvalues) getWeights(result@graphs[[4]]) getRejected(result@graphs[[4]])
Implements the graphical test procedure described in Bretz et al. (2009). Note that the gMCP function in the gMCP package performs the same task.
graphTest( pvalues, weights = NULL, alpha = 0.05, G = NULL, cr = NULL, graph = NULL, verbose = FALSE, test, upscale = FALSE )
graphTest( pvalues, weights = NULL, alpha = 0.05, G = NULL, cr = NULL, graph = NULL, verbose = FALSE, test, upscale = FALSE )
pvalues |
Either a vector or a matrix containing the local p-values for the hypotheses in the rows. |
weights |
Initial weight levels for the test procedure, in case of multiple graphs this needs to be a matrix. |
alpha |
Overall alpha level of the procedure. For entangled graphs
|
G |
For simple graphs |
cr |
Correlation matrix that should be used for the parametric test.
If |
graph |
As an alternative to the specification via |
verbose |
If verbose is TRUE, additional information about the graphical rejection procedure is displayed. |
test |
In the parametric case there is more than one way to handle
subgraphs with less than the full alpha. If the parameter |
upscale |
Logical. If |
A vector or a matrix containing the test results for the hypotheses under consideration. Significant tests are denoted by a 1, non-significant results by a 0.
Bretz, F., Maurer, W., Brannath, W. and Posch, M. (2009) A graphical approach to sequentially rejective multiple test procedures. Statistics in Medicine, 28, 586–604
Bretz, F., Maurer, W. and Hommel, G. (2010) Test and power considerations for multiple endpoint analyses using sequentially rejective graphical procedures, to appear in Statistics in Medicine
#### example from Bretz et al. (2010) weights <- c(1/3, 1/3, 1/3, 0, 0, 0) graph <- rbind(c(0, 0.5, 0, 0.5, 0, 0), c(1/3, 0, 1/3, 0, 1/3, 0), c(0, 0.5, 0, 0, 0, 0.5), c(0, 1, 0, 0, 0, 0), c(0.5, 0, 0.5, 0, 0, 0), c(0, 1, 0, 0, 0, 0)) pvals <- c(0.1, 0.008, 0.005, 0.15, 0.04, 0.006) graphTest(pvals, weights, alpha=0.025, graph) ## observe graphical procedure in detail graphTest(pvals, weights, alpha=0.025, graph, verbose = TRUE) ## now use many p-values (useful for power simulations) pvals <- matrix(rbeta(6e4, 1, 30), ncol = 6) out <- graphTest(pvals, weights, alpha=0.025, graph) head(out) ## example using multiple graphs (instead of 1) G1 <- rbind(c(0,0.5,0.5,0,0), c(0,0,1,0,0), c(0, 0, 0, 1-0.01, 0.01), c(0, 1, 0, 0, 0), c(0, 0, 0, 0, 0)) G2 <- rbind(c(0,0,1,0,0), c(0.5,0,0.5,0,0), c(0, 0, 0, 0.01, 1-0.01), c(0, 0, 0, 0, 0), c(1, 0, 0, 0, 0)) weights <- rbind(c(1, 0, 0, 0, 0), c(0, 1, 0, 0, 0)) pvals <- c(0.012, 0.025, 0.005, 0.0015, 0.0045) out <- graphTest(pvals, weights, alpha=c(0.0125, 0.0125), G=list(G1, G2), verbose = TRUE) ## now again with many p-values pvals <- matrix(rbeta(5e4, 1, 30), ncol = 5) out <- graphTest(pvals, weights, alpha=c(0.0125, 0.0125), G=list(G1, G2)) head(out)
#### example from Bretz et al. (2010) weights <- c(1/3, 1/3, 1/3, 0, 0, 0) graph <- rbind(c(0, 0.5, 0, 0.5, 0, 0), c(1/3, 0, 1/3, 0, 1/3, 0), c(0, 0.5, 0, 0, 0, 0.5), c(0, 1, 0, 0, 0, 0), c(0.5, 0, 0.5, 0, 0, 0), c(0, 1, 0, 0, 0, 0)) pvals <- c(0.1, 0.008, 0.005, 0.15, 0.04, 0.006) graphTest(pvals, weights, alpha=0.025, graph) ## observe graphical procedure in detail graphTest(pvals, weights, alpha=0.025, graph, verbose = TRUE) ## now use many p-values (useful for power simulations) pvals <- matrix(rbeta(6e4, 1, 30), ncol = 6) out <- graphTest(pvals, weights, alpha=0.025, graph) head(out) ## example using multiple graphs (instead of 1) G1 <- rbind(c(0,0.5,0.5,0,0), c(0,0,1,0,0), c(0, 0, 0, 1-0.01, 0.01), c(0, 1, 0, 0, 0), c(0, 0, 0, 0, 0)) G2 <- rbind(c(0,0,1,0,0), c(0.5,0,0.5,0,0), c(0, 0, 0, 0.01, 1-0.01), c(0, 0, 0, 0, 0), c(1, 0, 0, 0, 0)) weights <- rbind(c(1, 0, 0, 0, 0), c(0, 1, 0, 0, 0)) pvals <- c(0.012, 0.025, 0.005, 0.0015, 0.0045) out <- graphTest(pvals, weights, alpha=c(0.0125, 0.0125), G=list(G1, G2), verbose = TRUE) ## now again with many p-values pvals <- matrix(rbeta(5e4, 1, 30), ncol = 5) out <- graphTest(pvals, weights, alpha=c(0.0125, 0.0125), G=list(G1, G2)) head(out)
This data set gives the number of micronuclei per animal and 2000 scored cells for six different groups of differently treated male mice: The negative control (C-), four doses (30, 50, 75, 100 mg hydroquinone / kg) of hydroquinone and an active control (C+) (with 25 mg/kg cyclophosphamide).
data(hydroquinone)
data(hydroquinone)
A data frame with 31 observations on the following 2 variables:
A factor with levels "C-", "30 mg/kg", "50 mg/kg", "75 mg/kg", "100 mg/kg" and "C+" specifying the groups.
A numeric vector, giving the counts of micronuclei per animal and 2000 scored cells after 24h.
Adler, I.-D. and Kliesch, U. (1990): Comparison of single and multiple treatment regimens in the mouse bone marrow micronucleus assay for hydroquinone and cyclophosphamide. Mutation Research 234, 115-123.
Bauer, P., Roehmel, J., Maurer, W., and Hothorn, L. (1998): Testing strategies in multi-dose experiments including active control. Statistics in Medicine 17, 2133-2146.
data(hydroquinone) boxplot(micronuclei~group, data=hydroquinone)
data(hydroquinone) boxplot(micronuclei~group, data=hydroquinone)
Creates a new graphMCP object by joining two given graphMCP objects.
joinGraphs(graph1, graph2, xOffset = 0, yOffset = 200)
joinGraphs(graph1, graph2, xOffset = 0, yOffset = 200)
graph1 |
A graph of class |
graph2 |
A graph of class |
xOffset |
A numeric specifying an offset (on the x-axis) for placing the nodes and edge labels of the second graph. |
yOffset |
A numeric specifying an offset (on the y-axis) for placing the nodes and edge labels of the second graph. |
If graph1
and graph2
have duplicates in the node names, the
nodes of the second graph will be renamed.
If and only if the sum of the weights of graph1 and graph2 exceeds 1, the weights are scaled so that the sum equals 1.
A description attribute of either graph will be discarded.
A graphMCP object that represents a graph that consists of the two given graphs.
Kornelius Rohmeyer [email protected]
g1 <- BonferroniHolm(2) g2 <- BonferroniHolm(3) joinGraphs(g1, g2)
g1 <- BonferroniHolm(2) g2 <- BonferroniHolm(3) joinGraphs(g1, g2)
Creates a graph of class graphMCP
from a given transition
matrix or vice versa.
matrix2graph(m, weights = rep(1/dim(m)[1], dim(m)[1])) graph2matrix(graph)
matrix2graph(m, weights = rep(1/dim(m)[1], dim(m)[1])) graph2matrix(graph)
m |
A transition matrix. |
weights |
A numeric for the initial weights. |
graph |
A graph of class |
The hypotheses names are the row names or if these are NULL
, the
column names or if these are also NULL
of type H1, H2, H3, ...
If the diagonal of the matrix is unequal zero, the values are ignored and a warning is given.
A graph of class graphMCP
with the given transition
matrix for matrix2graph. The transition matrix of a graphMCP
graph for graph2matrix.
Kornelius Rohmeyer [email protected]
# Bonferroni-Holm: m <- matrix(rep(1/3, 16), nrow=4) diag(m) <- c(0, 0, 0, 0) graph <- matrix2graph(m) print(graph) graph2matrix(graph)
# Bonferroni-Holm: m <- matrix(rep(1/3, 16), nrow=4) diag(m) <- c(0, 0, 0, 0) graph <- matrix2graph(m) print(graph) graph2matrix(graph)
It is assumed that under the global null hypothesis
follow a multivariate normal
distribution with correlation matrix
correlation
where
denotes the inverse of the standard normal distribution
function.
parametric.test( pvalues, weights, alpha = 0.05, adjPValues = TRUE, verbose = FALSE, correlation, ... )
parametric.test( pvalues, weights, alpha = 0.05, adjPValues = TRUE, verbose = FALSE, correlation, ... )
pvalues |
A numeric vector specifying the p-values. |
weights |
A numeric vector of weights. |
alpha |
A numeric specifying the maximal allowed type one error rate. If |
adjPValues |
Logical scalar. If |
verbose |
Logical scalar. If |
correlation |
Correlation matrix. For parametric tests the p-values
must arise from one-sided tests with multivariate normal distributed test
statistics for which the correlation is (partially) known. In that case a
weighted parametric closed test is performed (also see
|
... |
Further arguments possibly passed by |
For example, this is the case if are the raw p-values
from one-sided z-tests for each of the elementary hypotheses where the
correlation between z-test statistics is generated by an overlap in the
observations (e.g. comparison with a common control, group-sequential
analyses etc.). An application of the transformation
to raw p-values from a two-sided test will not in general lead to a
multivariate normal distribution. Partial knowledge of the correlation
matrix is supported. The correlation matrix has to be passed as a numeric
matrix with elements of the form:
for diagonal
elements,
, where
is the
known value of the correlation between
and
or
NA
if the corresponding correlation is
unknown. For example correlation[1,2]=0 indicates that the first and second
test statistic are uncorrelated, whereas correlation[2,3] = NA means that
the true correlation between statistics two and three is unknown and may
take values between -1 and 1. The correlation has to be specified for
complete blocks (ie.: if cor(i,j), and cor(i,j') for i!=j!=j' are specified
then cor(j,j') has to be specified as well) otherwise the corresponding
intersection null hypotheses tests are not uniquely defined and an error is
returned.
For further details see the given references.
Bretz F., Posch M., Glimm E., Klinglmueller F., Maurer W., Rohmeyer K. (2011): Graphical approaches for multiple endpoint problems using weighted Bonferroni, Simes or parametric tests. Biometrical Journal 53 (6), pages 894-913, Wiley. doi:10.1002/bimj.201000239
Places the nodes of a graph according to a specified layout.
placeNodes(graph, nrow, ncol, byrow = TRUE, topdown = TRUE, force = FALSE)
placeNodes(graph, nrow, ncol, byrow = TRUE, topdown = TRUE, force = FALSE)
graph |
A graph of class |
nrow |
The desired number of rows. |
ncol |
The desired number of columns. |
byrow |
Logical whether the graph is filled by rows (otherwise by columns). |
topdown |
Logical whether the rows are filled top-down or bottom-up. |
force |
Logical whether a graph that has already a layout should be given the specified new layout. |
If one of nrow
or ncol
is not given, an attempt is made to
infer it from the number of nodes of the graph
and the other
parameter. If neither is given, the graph is placed as a circle.
The graph with nodes placed according to the specified layout.
Kornelius Rohmeyer [email protected]
g <- matrix2graph(matrix(0, nrow=6, ncol=6)) g <- placeNodes(g, nrow=2, force=TRUE) ## Not run: graphGUI(g) ## End(Not run)
g <- matrix2graph(matrix(0, nrow=6, ncol=6)) g <- placeNodes(g, nrow=2, force=TRUE) ## Not run: graphGUI(g) ## End(Not run)
A function for convenient plotting of confidence intervals.
plotSimCI(ci)
plotSimCI(ci)
ci |
a (named) matrix containing the lower confidence bounds in the first column, the point estimates in the second and the upper confidence bounds in the third column. |
Code adapted from plotCII from Frank Schaarschmidt
est <- c("H1"=0.860382, "H2"=0.9161474, "H3"=0.9732953) # Sample standard deviations: ssd <- c("H1"=0.8759528, "H2"=1.291310, "H3"=0.8570892) pval <- c(0.01260, 0.05154, 0.02124)/2 ci <- simConfint(BonferroniHolm(3), pvalues=pval, confint="t", df=9, estimates=est, alpha=0.025, alternative="greater") plotSimCI(ci)
est <- c("H1"=0.860382, "H2"=0.9161474, "H3"=0.9732953) # Sample standard deviations: ssd <- c("H1"=0.8759528, "H2"=1.291310, "H3"=0.8570892) pval <- c(0.01260, 0.05154, 0.02124)/2 ci <- simConfint(BonferroniHolm(3), pvalues=pval, confint="t", df=9, estimates=est, alpha=0.025, alternative="greater") plotSimCI(ci)
Rejects a node/hypothesis and updates the graph accordingly.
rejectNode(graph, node, upscale = FALSE, verbose = FALSE, keepWeights = FALSE)
rejectNode(graph, node, upscale = FALSE, verbose = FALSE, keepWeights = FALSE)
graph |
A graph of class |
node |
A character string specifying the node to reject. |
upscale |
Logical. If |
verbose |
Logical scalar. If |
keepWeights |
Logical scalar. If |
For details see the given references.
An updated graph of class graphMCP
or entangledMCP
.
Kornelius Rohmeyer [email protected]
Frank Bretz, Willi Maurer, Werner Brannath, Martin Posch: A graphical approach to sequentially rejective multiple test procedures. Statistics in Medicine 2009 vol. 28 issue 4 page 586-604. https://www.meduniwien.ac.at/fwf_adaptive/papers/bretz_2009_22.pdf
g <- BonferroniHolm(5) rejectNode(g, "H1")
g <- BonferroniHolm(5) rejectNode(g, "H1")
Given a list of variables and real values a general graph is processed and each variable replaced with the specified numeric value.
replaceVariables( graph, variables = list(), ask = TRUE, partial = FALSE, expand = TRUE, list = FALSE )
replaceVariables( graph, variables = list(), ask = TRUE, partial = FALSE, expand = TRUE, list = FALSE )
graph |
A graph of class |
variables |
A named list with one or more specified real values, for example
|
ask |
If |
partial |
IF |
expand |
Used internally. Don't use yourself. |
list |
If |
A graph or a matrix with variables replaced by the specified numeric values. Or a list of theses graphs and matrices if a variable had more than one value.
Kornelius Rohmeyer [email protected]
graph <- HungEtWang2010() ## Not run: replaceVariables(graph) ## End(Not run) replaceVariables(graph, list("tau"=0.5,"omega"=0.5, "nu"=0.5)) replaceVariables(graph, list("tau"=c(0.1, 0.5, 0.9),"omega"=c(0.2, 0.8), "nu"=0.4))
graph <- HungEtWang2010() ## Not run: replaceVariables(graph) ## End(Not run) replaceVariables(graph, list("tau"=0.5,"omega"=0.5, "nu"=0.5)) replaceVariables(graph, list("tau"=c(0.1, 0.5, 0.9),"omega"=c(0.2, 0.8), "nu"=0.4))
Draw a quasi or pseudo random sample from the MVN distribution. For details on the implemented lattice rule for quasi-random numbers see Cools et al. (2006).
rqmvnorm( n, mean = rep(0, nrow(sigma)), sigma = diag(length(mean)), type = c("quasirandom", "pseudorandom") )
rqmvnorm( n, mean = rep(0, nrow(sigma)), sigma = diag(length(mean)), type = c("quasirandom", "pseudorandom") )
n |
Number of samples, when type = "quasirandom" is used this number is rounded up to the next power of 2 (e.g. 1000 to 1024=2^10) and at least 1024. |
mean |
Mean vector |
sigma |
Covariance matrix |
type |
What type of random numbers to use. |
Matrix of simulated values
We thank Dr. Frances Kuo for the permission to use the generating vectors (order 2 lattice rule) obtained from her website https://web.maths.unsw.edu.au/~fkuo/lattice/.
Cools, R., Kuo, F. Y., and Nuyens, D. (2006) Constructing embedded lattice rules for multivariate integration. SIAM Journal of Scientific Computing, 28, 2162-2188.
sims <- rqmvnorm(100, mean = 1:2, sigma = diag(2)) plot(sims)
sims <- rqmvnorm(100, mean = 1:2, sigma = diag(2)) plot(sims)
Sample size calculations
sampSize( graph, esf, effSize, powerReqFunc, target, corr.sim, alpha, corr.test = NULL, type = c("quasirandom", "pseudorandom"), upscale = FALSE, n.sim = 10000, verbose = FALSE, ... )
sampSize( graph, esf, effSize, powerReqFunc, target, corr.sim, alpha, corr.test = NULL, type = c("quasirandom", "pseudorandom"), upscale = FALSE, n.sim = 10000, verbose = FALSE, ... )
graph |
A graph of class |
esf |
... |
effSize |
... |
powerReqFunc |
One power requirement function or a list of these.
If one is interested in the power to reject hypotheses 1 and 3
one could specify: |
target |
Target power that should be at least achieved. Either a numeric scalar between 0 and 1 or if parameter |
corr.sim |
Covariance matrix under the alternative. |
alpha |
... |
corr.test |
Correlation matrix that should be used for the parametric test.
If |
type |
What type of random numbers to use. |
upscale |
Logical. If |
n.sim |
... |
verbose |
Logical, whether verbose output should be printed. |
... |
... |
test |
In the parametric case there is more than one way to handle
subgraphs with less than the full alpha. If the parameter |
...
## Not run: graph <- BonferroniHolm(4) powerReqFunc <- function(x) { (x[1] && x[2]) || x[3] } #TODO Still causing errors / loops. #sampSize(graph, alpha=0.05, powerReqFunc, target=0.8, mean=c(6,4,2) ) #sampSize(graph, alpha=0.05, powerReqFunc, target=0.8, mean=c(-1,-1,-1), nsim=100) sampSize(graph, esf=c(1,1,1,1), effSize=c(1,1,1,1), corr.sim=diag(4), powerReqFunc=powerReqFunc, target=0.8, alpha=0.05) powerReqFunc=list('all(x[c(1,2)])'=function(x) {all(x[c(1,2)])}, 'any(x[c(0,1)])'=function(x) {any(x[c(0,1)])}) sampSize(graph=graph, effSize=list("Scenario 1"=c(2, 0.2, 0.2, 0.2), "Scenario 2"=c(0.2, 4, 0.2, 0.2)), esf=c(0.5, 0.7071067811865476, 0.5, 0.7071067811865476), powerReqFunc=powerReqFunc, corr.sim=diag(4), target=c(0.8, 0.8), alpha=0.025) ## End(Not run)
## Not run: graph <- BonferroniHolm(4) powerReqFunc <- function(x) { (x[1] && x[2]) || x[3] } #TODO Still causing errors / loops. #sampSize(graph, alpha=0.05, powerReqFunc, target=0.8, mean=c(6,4,2) ) #sampSize(graph, alpha=0.05, powerReqFunc, target=0.8, mean=c(-1,-1,-1), nsim=100) sampSize(graph, esf=c(1,1,1,1), effSize=c(1,1,1,1), corr.sim=diag(4), powerReqFunc=powerReqFunc, target=0.8, alpha=0.05) powerReqFunc=list('all(x[c(1,2)])'=function(x) {all(x[c(1,2)])}, 'any(x[c(0,1)])'=function(x) {any(x[c(0,1)])}) sampSize(graph=graph, effSize=list("Scenario 1"=c(2, 0.2, 0.2, 0.2), "Scenario 2"=c(0.2, 4, 0.2, 0.2)), esf=c(0.5, 0.7071067811865476, 0.5, 0.7071067811865476), powerReqFunc=powerReqFunc, corr.sim=diag(4), target=c(0.8, 0.8), alpha=0.025) ## End(Not run)
Function for sample size calculation
sampSizeCore( upperN, lowerN = floor(upperN/2), targFunc, target, tol = 0.001, alRatio, Ntype = c("arm", "total"), verbose = FALSE, ... )
sampSizeCore( upperN, lowerN = floor(upperN/2), targFunc, target, tol = 0.001, alRatio, Ntype = c("arm", "total"), verbose = FALSE, ... )
upperN |
|
lowerN |
|
targFunc |
The target (power) function that should be monotonically increasing in |
target |
The target value. The function searches the |
tol |
Tolerance: The function searches the |
alRatio |
Allocation ratio. |
Ntype |
Either |
verbose |
Logical, whether verbose output should be printed. |
... |
... |
For details see the manual and examples.
Integer value n
(of type numeric) with targFunc(n)-target<tol
and targFunc(n)>target
.
This function is taken from package DoseFinding under GPL from Bjoern Bornkamp, Jose Pinheiro and Frank Bretz
f <- function(x){1/100*log(x)} gMCP:::sampSizeCore(upperN=1000, targFunc=f, target=0.008, verbose=TRUE, alRatio=1)
f <- function(x){1/100*log(x)} gMCP:::sampSizeCore(upperN=1000, targFunc=f, target=0.008, verbose=TRUE, alRatio=1)
Based on a pre-planned graphical multiple comparison procedure, construct a valid multiple level alpha test that conserves the family wise error in the strong sense regardless of any trial adaptations during an unblinded interim analysis. - Implementation of adaptive procedures is still in an early stage and may change in the near future
secondStageTest( interim, select, matchCE = TRUE, zWeights = "reject", G2 = interim@preplanned )
secondStageTest( interim, select, matchCE = TRUE, zWeights = "reject", G2 = interim@preplanned )
interim |
An object of class |
select |
A logical vector giving specifying which hypotheses are carried forward to the second stage |
matchCE |
Logical specifying whether second stage weights should be computed proportional to corresponding PCEs |
zWeights |
Either "reject","accept", or "strict" giving the rule what should be done in cases where none of the selected hypotheses has positive second stage weight. |
G2 |
An object of class |
For details see the given references.
A function of signature function(z2)
with arguments
z2
a numeric vector with second stage z-scores (Z-scores of
dropped hypotheses should be set no NA
)
that returns objects of class gMCPResult
.
Florian Klinglmueller [email protected]
Frank Bretz, Willi Maurer, Werner Brannath, Martin Posch: A graphical approach to sequentially rejective multiple test procedures. Statistics in Medicine 2009 vol. 28 issue 4 page 586-604. https://www.meduniwien.ac.at/fwf_adaptive/papers/bretz_2009_22.pdf
Bretz F., Posch M., Glimm E., Klinglmueller F., Maurer W., Rohmeyer K. (2011): Graphical approaches for multiple endpoint problems using weighted Bonferroni, Simes or parametric tests - to appear.
Posch M, Futschik A (2008): A Uniform Improvement of Bonferroni-Type Tests by Sequential Tests JASA 103/481, 299-308
Posch M, Maurer W, Bretz F (2010): Type I error rate control in adaptive designs for confirmatory clinical trials with treatment selection at interim Pharm Stat 10/2, 96-104
## Simple successive graph (Maurer et al. 2011) ## two treatments two hierarchically ordered endpoints a <- .025 G <- simpleSuccessiveI() ## some z-scores: p1=c(.1,.12,.21,.16) z1 <- qnorm(1-p1) p2=c(.04,1,.14,1) z2 <- qnorm(1-p2) v <- c(1/2,1/3,1/2,1/3) intA <- doInterim(G,z1,v) ## select only the first treatment fTest <- secondStageTest(intA,c(1,0,1,0))
## Simple successive graph (Maurer et al. 2011) ## two treatments two hierarchically ordered endpoints a <- .025 G <- simpleSuccessiveI() ## some z-scores: p1=c(.1,.12,.21,.16) z1 <- qnorm(1-p1) p2=c(.04,1,.14,1) z2 <- qnorm(1-p2) v <- c(1/2,1/3,1/2,1/3) intA <- doInterim(G,z1,v) ## select only the first treatment fTest <- secondStageTest(intA,c(1,0,1,0))
Calculates simultaneous confidence intervals for sequentially rejective multiple test procedures.
simConfint(object, pvalues, confint, alternative=c("less", "greater"), estimates, df, alpha=0.05, mu=0)
simConfint(object, pvalues, confint, alternative=c("less", "greater"), estimates, df, alpha=0.05, mu=0)
object |
A graph of class |
pvalues |
A numeric vector specifying the p-values for the sequentially rejective MTP. |
confint |
One of the following:
A character string |
alternative |
A character string specifying the alternative hypothesis, must be "greater" or "less". |
estimates |
Point estimates for the parameters of interest. |
df |
Degree of freedom as numeric. |
alpha |
The overall alpha level as numeric scalar. |
mu |
The numerical parameter vector under null hypothesis. |
For details see the given references.
A matrix with columns giving lower confidence limits, point estimates and upper confidence limits for each parameter. These will be labeled as "lower bound", "estimate" and "upper bound".
Kornelius Rohmeyer [email protected]
Frank Bretz, Willi Maurer, Werner Brannath, Martin Posch: A graphical approach to sequentially rejective multiple test procedures. Statistics in Medicine 2009 vol. 28 issue 4 page 586-604. http://www.meduniwien.ac.at/fwf_adaptive/papers/bretz_2009_22.pdf
est <- c("H1"=0.860382, "H2"=0.9161474, "H3"=0.9732953) # Sample standard deviations: ssd <- c("H1"=0.8759528, "H2"=1.291310, "H3"=0.8570892) pval <- c(0.01260, 0.05154, 0.02124)/2 simConfint(BonferroniHolm(3), pvalues=pval, confint=function(node, alpha) { c(est[node]-qt(1-alpha,df=9)*ssd[node]/sqrt(10), Inf) }, estimates=est, alpha=0.025, mu=0, alternative="greater") # Note that the sample standard deviations in the following call # will be calculated from the pvalues and estimates. ci <- simConfint(BonferroniHolm(3), pvalues=pval, confint="t", df=9, estimates=est, alpha=0.025, alternative="greater") ci plotSimCI(ci)
est <- c("H1"=0.860382, "H2"=0.9161474, "H3"=0.9732953) # Sample standard deviations: ssd <- c("H1"=0.8759528, "H2"=1.291310, "H3"=0.8570892) pval <- c(0.01260, 0.05154, 0.02124)/2 simConfint(BonferroniHolm(3), pvalues=pval, confint=function(node, alpha) { c(est[node]-qt(1-alpha,df=9)*ssd[node]/sqrt(10), Inf) }, estimates=est, alpha=0.025, mu=0, alternative="greater") # Note that the sample standard deviations in the following call # will be calculated from the pvalues and estimates. ci <- simConfint(BonferroniHolm(3), pvalues=pval, confint="t", df=9, estimates=est, alpha=0.025, alternative="greater") ci plotSimCI(ci)
Weighted Simes test introduced by Benjamini and Hochberg (1997)
simes.on.subsets.test( pvalues, weights, alpha = 0.05, adjPValues = TRUE, verbose = FALSE, subsets, subset, ... )
simes.on.subsets.test( pvalues, weights, alpha = 0.05, adjPValues = TRUE, verbose = FALSE, subsets, subset, ... )
pvalues |
A numeric vector specifying the p-values. |
weights |
A numeric vector of weights. |
alpha |
A numeric specifying the maximal allowed type one error rate. If |
adjPValues |
Logical scalar. If |
verbose |
Logical scalar. If |
subsets |
A list of subsets given by numeric vectors containing the indices of the elementary hypotheses for which the weighted Simes test is applicable. |
subset |
A numeric vector containing the numbers of the indices of the currently tested elementary hypotheses. |
... |
Further arguments possibly passed by |
As an additional argument a list of subsets must be provided, that states in which cases a Simes test is applicable (i.e. if all hypotheses to test belong to one of these subsets), e.g. subsets <- list(c("H1", "H2", "H3"), c("H4", "H5", "H6")) Trimmed Simes test for intersections of two hypotheses and otherwise weighted Bonferroni-test
simes.on.subsets.test(pvalues=c(0.1,0.2,0.05), weights=c(0.5,0.5,0)) simes.on.subsets.test(pvalues=c(0.1,0.2,0.05), weights=c(0.5,0.5,0), adjPValues=FALSE) graph <- BonferroniHolm(4) pvalues <- c(0.01, 0.05, 0.03, 0.02) gMCP.extended(graph=graph, pvalues=pvalues, test=simes.on.subsets.test, subsets=list(1:2, 3:4))
simes.on.subsets.test(pvalues=c(0.1,0.2,0.05), weights=c(0.5,0.5,0)) simes.on.subsets.test(pvalues=c(0.1,0.2,0.05), weights=c(0.5,0.5,0), adjPValues=FALSE) graph <- BonferroniHolm(4) pvalues <- c(0.01, 0.05, 0.03, 0.02) gMCP.extended(graph=graph, pvalues=pvalues, test=simes.on.subsets.test, subsets=list(1:2, 3:4))
Weighted Simes test introduced by Benjamini and Hochberg (1997)
simes.test( pvalues, weights, alpha = 0.05, adjPValues = TRUE, verbose = FALSE, ... )
simes.test( pvalues, weights, alpha = 0.05, adjPValues = TRUE, verbose = FALSE, ... )
pvalues |
A numeric vector specifying the p-values. |
weights |
A numeric vector of weights. |
alpha |
A numeric specifying the maximal allowed type one error rate. If |
adjPValues |
Logical scalar. If |
verbose |
Logical scalar. If |
... |
Further arguments possibly passed by |
simes.test(pvalues=c(0.1,0.2,0.05), weights=c(0.5,0.5,0)) simes.test(pvalues=c(0.1,0.2,0.05), weights=c(0.5,0.5,0), adjPValues=FALSE)
simes.test(pvalues=c(0.1,0.2,0.05), weights=c(0.5,0.5,0)) simes.test(pvalues=c(0.1,0.2,0.05), weights=c(0.5,0.5,0), adjPValues=FALSE)
This data set gives the results from a study investigating the efficacy and safety of simvastatin and colesevelam treatment in patients with primary hypercholesterolemia. It shows the sample sizes, the mean LDL cholesterol levels and the number of patients with adverse events after 6 weeks. The treatment groups are: The Placebo control, two doses 10 mg and 20 mg of simvastatin and an combined treatment 20 mg + 2.3 g colesevelam.
data(simvastatin)
data(simvastatin)
A data frame with a summary table for ...:
A factor with levels "Placebo", "10 mg", "20 mg", "20 mg + 2.3 g Colesevelam" specifying the groups.
A numeric vector, giving the number of patients in the groups.
A numeric vector, giving the mean LDL cholesterol levels.
A numeric vector, giving the standard deviation of the LDL cholesterol levels.
An integer vector, giving the number of patients with adverse events after 6 weeks.
Knapp, H.H. and Schrott, H. and Ma, P. and Knopp, R. and Chin, B. and Gaziano, J.M. and Donovan, J.M. and Burke, S.K. and Davidson, M.H. (2001): Efficacy and safety of combination simvastatin and colesevelam in patients with primary hypercholesterolemia The American journal of medicine 110, 352-360.
Bretz, F., Hothorn, L. A. and Hsu, J. C. (2003): Identifying effective and/or safe doses by stepwise confidence intervals for ratios Statistics in Medicine 22, 847-858.
data(simvastatin) barplot(simvastatin$means, names.arg=simvastatin$group)
data(simvastatin) barplot(simvastatin$means, names.arg=simvastatin$group)
Given a set of nodes and a graph this function creates the subgraph containing only the specified nodes.
subgraph(graph, subset)
subgraph(graph, subset)
graph |
A graph of class |
subset |
A logical or character vector specifying the nodes in the subgraph. |
A subgraph containing only the specified nodes.
Kornelius Rohmeyer [email protected]
graph <- improvedParallelGatekeeping() subgraph(graph, c(TRUE, FALSE, TRUE, FALSE)) subgraph(graph, c("H1", "H3"))
graph <- improvedParallelGatekeeping() subgraph(graph, c(TRUE, FALSE, TRUE, FALSE)) subgraph(graph, c("H1", "H3"))
Substitute Epsilon with a given value.
substituteEps(graph, eps = 10^(-3))
substituteEps(graph, eps = 10^(-3))
graph |
A graph of class |
eps |
A numeric scalar specifying a value for epsilon edges. |
For details see the given references.
A graph where all epsilons have been replaced with the given value.
Kornelius Rohmeyer [email protected]
graph <- improvedParallelGatekeeping() graph substituteEps(graph, eps=0.01)
graph <- improvedParallelGatekeeping() graph substituteEps(graph, eps=0.01)
Runs the R unit (and optional the JUnit) test suite for gMCP and prints the results.
unitTestsGMCP( extended = FALSE, java = FALSE, interactive = FALSE, junitLibrary, outputPath )
unitTestsGMCP( extended = FALSE, java = FALSE, interactive = FALSE, junitLibrary, outputPath )
extended |
If |
java |
If |
interactive |
If |
junitLibrary |
A character String specifying the path to a JUnit 4 jar file to run the JUnit tests. You can download it from https://junit.org/. Alternatively you can use the environment variable GMCP_JUNIT_LIBRARY to specify the path. |
outputPath |
During the RUnit tests files maybe produced at this location. If missing the current working directory is used if nothing else is specified in the environment variable GMCP_UNIT_TEST_OPATH. Also the log of the results of the test suite is saved in this place. |
The environment variable GMCP_UNIT_TESTS may be used to specify which unit tests should run: "extended", "interactive", "java" or a combination of these separated by comma (without blanks). A short cut for all three is "all".
None of interest so far - the function prints the results to the standard output. (Perhaps in future versions a value will be returned that can be processed by the GUI.)
Kornelius Rohmeyer [email protected]
## Not run: unitTestsGMCP() unitTestsGMCP(extended=TRUE, java=TRUE, interactive=TRUE, outputPath="~/RUnitTests") ## End(Not run)
## Not run: unitTestsGMCP() unitTestsGMCP(extended=TRUE, java=TRUE, interactive=TRUE, outputPath="~/RUnitTests") ## End(Not run)
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 [email protected]
# 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)) } }
# 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)) } }