Learn R Programming

RVAideMemoire (version 0.9-29-2)

surv.multcomp: Pairwise comparisons for survival analysis

Description

Perform pairwise comparisons between groups for equality of time to event. The function deals with coxph and survreg models.

Usage

surv.multcomp(formula, mat, data, strata = NULL, type = c("coxph", "survreg"),
  dist = "exponential", p.method = "fdr")

Arguments

formula
a formula of the form a ~ b, where a is a Surv object and b is a factor giving levels to be compared.
mat
matrix of comparisons (see help of mat.cont), either a matrix or a data frame.
data
an optional data frame containing the variables in the formula formula. By default the variables are taken from environment(formula).
strata
strata, if needed.
type
model type: "coxph" (default) or "survreg".
dist
distribution when a "survreg" model is used.
p.method
method for p-values correction. See help of p.adjust.

Value

  • modelmodel formula.
  • statistictest statistics.
  • methoda character string giving the name of the test computed.
  • p.adjust.methodmethod for p-values correction.
  • p.value2corrected p-values.
  • p.valuetable of results.

Details

When pairwise comparisons are based on a coxph model, a likelihood ratio test is used. When pairwise comparisons are based on a survreg model, a logrank test is used.

See Also

survreg, coxph, mat.cont

Examples

Run this code
require(survival)
death <- c(sample(8:15,20,replace=TRUE),sample(12:20,20,replace=TRUE),
  sample(18:22,20,replace=TRUE))
groups <- gl(3,20,labels=LETTERS[1:3])
model1 <- coxph(Surv(death)~groups)
model1
mat <- matrix(c(1,-1,0,0,1,-1,2,-1,-1),byrow=TRUE,ncol=3,dimnames=list(1:3,levels(groups)))
mat
surv.multcomp(Surv(death)~groups,mat,type="coxph")

model2 <- survreg(Surv(death)~groups,dist="weibull")
model2
surv.multcomp(Surv(death)~groups,mat,type="survreg",dist="weibull")

Run the code above in your browser using DataLab