Skip to contents

Implementation of Bretz's graphical models for sequentially rejective test procedures. Based on <doi: 10.1002/sim.3495>.

Usage

p_adjust_graph(p, alpha, G)

Arguments

p

A vector of length m including m P-values associated with Hypotheses j = 1,...,m to be tested.

alpha

Either a vector of length m with the alpha levels against which hypothesis j should be tested. If a hypothesis should not be tested initially its alpha value should be 0. If only one value is supplied for alpha it is assmued that the alpha value is splitt equally across the hypotheses.

G

The transition matrix associated with the graphical model assumed for the sequential testing procedure to be used.

Value

A data.frame with testing results and adjusted P-values for each hypotheses. Please not that results are only provided up until the first hypothesis that failes.

Examples


# Example from Figure 3 in the original article
p_adjust_graph(p     = c(0.02, 0.055, 0.012),
               alpha = 0.05,
               G     = matrix(c(0  , 1/2, 1/2,
                                1/2, 0  , 1/2,
                                1/2, 1/2, 0  ),
                              nrow = 3,
                              byrow = TRUE))
#> 
#> H3 passed at 0.017 (p-adjust: 0.036)
#> H1 passed at 0.025 (p-adjust: 0.040)
#> H2 failed at 0.050 (p-adjust: 0.055)
#> 
#> SUMMARY TABLE
#>   H      alpha     p passed p_adj
#> 1 3 0.01666667 0.012   TRUE 0.036
#> 2 1 0.02500000 0.020   TRUE 0.040
#> 3 2 0.05000000 0.055  FALSE 0.055

# Example from Figure 5 (top left) in the original article
p_adjust_graph(p     = c(0.012, 0.02, 0.055),
               alpha = 0.05,
               G = matrix(c(0  , 1/2, 1/2,
                            0  , 0  , 1  ,
                            0  , 0  , 0  ),
                          nrow = 3,
                          byrow = TRUE))
#> 
#> H1 passed at 0.017 (p-adjust: 0.036)
#> H2 passed at 0.025 (p-adjust: 0.040)
#> H3 failed at 0.050 (p-adjust: 0.055)
#> 
#> SUMMARY TABLE
#>   H      alpha     p passed p_adj
#> 1 1 0.01666667 0.012   TRUE 0.036
#> 2 2 0.02500000 0.020   TRUE 0.040
#> 3 3 0.05000000 0.055  FALSE 0.055

# Example of a strict gatekeeping strategy
p_adjust_graph(p     = c(0.012, 0.055),
               alpha = c(0.05, 0),
               G = matrix(c(0  , 1,
                            0  , 0),
                          nrow = 2,
                          byrow = TRUE))
#> 
#> H1 passed at 0.050 (p-adjust: 0.012)
#> H2 failed at 0.050 (p-adjust: 0.055)
#> 
#> SUMMARY TABLE
#>   H alpha     p passed p_adj
#> 1 1  0.05 0.012   TRUE 0.012
#> 2 2  0.05 0.055  FALSE 0.055