With version 3.1, we have added a function to support graphical multiplicity methods using ggplot2. The graphical method is introduced nicely in Bretz et al. (2011) and supported by the gMCP package (Rohmeyer and Klinglmueller (2018)). It was extended to group sequential design by Maurer and Bretz (2013). While the gMCP package supports graphics, here we add the
hGraph() function to create multiplicity graphs using the ggplot2 package as a convenience for those desiring this format. We demonstrate basic formatting in this article and demonstrate use with gMCP elsewhere.
hGraph() is organized as follows:
We begin with the default plot to demonstrate the basic formatting below. Hypthoses and initial \(\alpha\)-allocation or weighting are presented in shaded ellipses with the first hyothesis specified in the upper-left part of the plot. While the user has full control of ellipse placement and color, the default is to present clockwise on a larger ellipse with gray shading. One advantage of default placement is that generally transition lines between hypotheses will not cross hypothesis ellipses, including when the graph is updated when some hypotheses are rejected. Transition weights between hypotheses are specified on directional lines between the hypothesis ellipses. Try this in a plot window. Note the effect if you change the size of the plot window. In a similar fashion, if you are using R Markdown,
fig.height parameters will affect formatting.
Next we specify the number of hypotheses, hypothesis names and \(\alpha\)-allocation or weighting. Whereas the default plot above used \(\alpha\)-allocation adding to 0.025, here we use weights adding to 1. Note the
\n character used to insert a carriage return in hypothesis name text. The character used for weights (specified in
wchar) is by default \(\alpha\) under Windows and
w otherwise. Note the clockwise placement of hypotheses.
You can specify location of hypothesis ellipses in two ways.
radianStartplaces the first hypothesis at the center and top of the plot (left plot).
ycoordinates, right graph, allows custom placement; note that the differences in minimum and maximum x- and y-values you use as well as window size will impact formatting.
Ellipse and the text size as well as maximum significant digits for hypotheses are controlled as follows:
sizeparameter (left graph). This text is always placed at the center of the ellipse with no user control.
halfWid(left graph) and
halfHgt(not shown; default 0.5) parameters.
digitsspecifies the maximum digits for the \(\alpha\)-allocation (not shown here; default 5)
Box and text size as well as maximum significant digit display for transition weights are controlled as follows:
boxtextsize(right graph) controls text size for transition weights
trhw(left graph) controls half-width for transition box size
trhh(not shown; default 0.075) controls half-height for transition box size
trprop(right graph) specifies the proportional placement of transition weight boxes along the transition lines At present, this is the same for all transitions
arrowsize(left plot) controls the size of the arrows between ellipses
The other parameter shown here is
offset (left graph). This is in radians; it increases and decreases offset of transition lines between hypothesis ellipses. If there are not any transition arrows in both directions between any pair of hypotheses,
offset = 0 is a reasonable option.
grid.arrange( # left graph in figure hGraph(nHypotheses = 3, size = 5, # decrease hypothesis text size from default 6 halfWid = 1.25, # increase ellipse width from default 0.5 trhw = 0.25, # increase transition box sizes from default 0.075 radianStart = pi/2, # first hypothesis top middle offset = pi/20, # decrease offset between transition lines arrowsize = .03 # increase from default 0.02 ), # right graph in figure hGraph(nHypotheses = 3, x = c(-1, 1, -1), # custom placement using x and y y = c(1, 1, -1), halfWid = 0.7, # increase ellipse width from default 0.5 boxtextsize = 3, # decrease box text size from default 4 trprop = .15 # slide transition boxes closer to initiating hypothesis ), nrow = 1 )
The default color palette for ellipse shading is monochrome (left plot below). To limit the parameters used, we have not adjusted text, ellipse and box size as above. Colors are specified as follows:
fillcolor category; here we group the first 2 hypotheses and last 2 hypotheses (both graphs)
palettespecifies a palette for the colors (right graph)
Next, we add a legend.
legend.positon = "none"is replaced. Here we use a custom position specifying the relative postioning on the (0,1) scale in the x- and y-range of the graph. Commonly used options are
"top", or ’“bottom”`
legend.name(default is none) specifies a name for the legend
labelsspecifies labels corresponding to the
Transition weights are specified in matrix format in the variable
m. The matrix must be square of dimension
nHypotheses and have 0 on the diagonal. Rows respresent the hypotheses from which transitions start; row values should sum to 1. Columns represent the hypotheses to which transition arrows go. Any transition weight of 0 has no corresponding transition line in the figure.
Bretz, Frank, Martin Posch, Ekkehard Glimm, Florian Klinglmueller, Willi Maurer, and Kornelius Rohmeyer. 2011. “Graphical Approaches for Multiple Comparison Procedures Using Weighted Bonferroni, Simes or Parametric Tests.” Biometrical Journal 53 (6). Wiley: 894–913. http://onlinelibrary.wiley.com/doi/10.1002/bimj.201000239/full.
Maurer, Willi, and Frank Bretz. 2013. “Multiple Testing in Group Sequential Trials Using Graphical Approaches.” Statistics in Biopharmaceutical Research 5: 311–20. https://doi.org/10.1080/19466315.2013.807748.
Rohmeyer, Kornelius, and Florian Klinglmueller. 2018. gMCP: Graph Based Multiple Test Procedures. https://cran.r-project.org/package=gMCP.