Skip to contents

Calculate pairwise comparisons between group levels with corrections for multiple testing.

Usage

pairwise_survdiff(formula, data, p.adjust.method = "BH", na.action, rho = 0)

Arguments

formula

a formula expression as for other survival models, of the form Surv(time, status) ~ predictors.

data

a data frame in which to interpret the variables occurring in the formula.

p.adjust.method

method for adjusting p values (see p.adjust). Allowed values include "holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none". If you don't want to adjust the p value (not recommended), use p.adjust.method = "none".

na.action

a missing-data filter function. Default is options()$na.action.

rho

a scalar parameter that controls the type of test. Allowed values include 0 (for Log-Rank test) and 1 (for peto & peto test).

Value

Returns an object of class "pairwise.htest", which is a list containing the p values.

See also

survival::survdiff

Author

Alboukadel Kassambara, alboukadel.kassambara@gmail.com

Examples


library(survival)
library(survminer)
data(myeloma)

# Pairwise survdiff
res <- pairwise_survdiff(Surv(time, event) ~ molecular_group,
     data = myeloma)
res
#> 
#> 	Pairwise comparisons using Log-Rank test 
#> 
#> data:  myeloma and molecular_group 
#> 
#>                  Cyclin D-1 Cyclin D-2 Hyperdiploid Low bone disease MAF  
#> Cyclin D-2       0.723      -          -            -                -    
#> Hyperdiploid     0.943      0.723      -            -                -    
#> Low bone disease 0.723      0.988      0.644        -                -    
#> MAF              0.644      0.447      0.523        0.485            -    
#> MMSET            0.328      0.103      0.103        0.103            0.723
#> Proliferation    0.103      0.038      0.038        0.062            0.485
#>                  MMSET
#> Cyclin D-2       -    
#> Hyperdiploid     -    
#> Low bone disease -    
#> MAF              -    
#> MMSET            -    
#> Proliferation    0.527
#> 
#> P value adjustment method: BH 

# Symbolic number coding
symnum(res$p.value, cutpoints = c(0, 0.0001, 0.001, 0.01, 0.05, 0.1, 1),
   symbols = c("****", "***", "**", "*", "+", " "),
   abbr.colnames = FALSE, na = "")
#>                  Cyclin D-1 Cyclin D-2 Hyperdiploid Low bone disease MAF MMSET
#> Cyclin D-2                                                                    
#> Hyperdiploid                                                                  
#> Low bone disease                                                              
#> MAF                                                                           
#> MMSET                                                                         
#> Proliferation               *          *            +                         
#> attr(,"legend")
#> [1] 0 ‘****’ 1e-04 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘+’ 0.1 ‘ ’ 1 \t    ## NA: ‘’