Learn R Programming

icmstate (version 0.2.0)

summary.probtrans.subjects: Summary method for a probtrans.subjects object

Description

Summary method for an object of class 'probtrans.subjects'. It prints a selection of the estimated transition probabilities. Wrapper for summary.probtrans.

Usage

# S3 method for probtrans.subjects
summary(object, id, times, from = 1, to = 0, extend = FALSE, ...)

Value

Function summary.probtrans returns an object of class "summary.probtrans.subjects", which is a list (for each from state) of transition probabilities at the specified (or all) time points. The print method of a summary.probtrans.subjects doesn't return a value.

Arguments

object

Object of class 'probtrans.subjects', containing estimated transition probabilities from and to all states in a multi-state model

id

Subject identifier

times

Time points at which to evaluate the transition probabilites

from

Specifies from which state the transition probabilities are to be printed. Should be subset of 1:S, with S the number of states in the multi-state model. Default is print from state 1 only. User can specify from=0 to print transition probabilities from all states

to

Specifies the transition probabilities to which state are to be printed. User can specify to=0 to print transition probabilities to all states. This is also the default

extend

logical value: if TRUE, prints information for all specified times, even if there are no subjects left at the end of the specified times. This is only valid if the times argument is present

...

Further arguments to summary.probtrans

Author

Hein Putter and Daniel Gomon

See Also

summary.probtrans, predict_tp

Examples

Run this code
if(require("mstate")){
  data(ebmt3)
  n <- nrow(ebmt3)
  tmat <- transMat(x = list(c(2, 3), c(3), c()), names = c("Tx",
                                                           "PR", "RelDeath"))
  ebmt3$prtime <- ebmt3$prtime/365.25
  ebmt3$rfstime <- ebmt3$rfstime/365.25
  covs <- c("dissub", "age", "drmatch", "tcd", "prtime")
  msbmt <- msprep(time = c(NA, "prtime", "rfstime"), status = c(NA,
                  "prstat", "rfsstat"), data = ebmt3, trans = tmat, keep = covs)
  #Expand covariates so that we can have transition specific covariates
  msbmt <- expand.covs(msbmt, covs, append = TRUE, longnames = FALSE)
  
  #Simple model, transition specific covariates, each transition own baseline hazard
  c1 <- coxph(Surv(Tstart, Tstop, status) ~ dissub1.1 + dissub2.1 +
                age1.1 + age2.1 + drmatch.1 + tcd.1 + dissub1.2 + dissub2.2 +
                age1.2 + age2.2 + drmatch.2 + tcd.2 + dissub1.3 + dissub2.3 +
                age1.3 + age2.3 + drmatch.3 + tcd.3 + strata(trans), data = msbmt,
                method = "breslow")
  #We need to make a data.frame containing all subjects of interest
  ttmat <- to.trans2(tmat)[, c(2, 3, 1)]
  names(ttmat)[3] <- "trans"
  nd_n <- NULL
  for (j in 1:30) {
    # Select global covariates of subject j
    cllj <- ebmt3[j, covs]
    nd2 <- cbind(ttmat, rep(j, 3), rbind(cllj, cllj, cllj))
    colnames(nd2)[4] <- "id"
    # Make nd2 of class msdata to use expand.covs
    attr(nd2, "trans") <- tmat
    class(nd2) <- c("msdata", "data.frame")
    nd2 <- expand.covs(nd2, covs=covs, longnames = FALSE)
    nd_n <- rbind(nd_n, nd2)
   }
   
   icmstate_pt <- probtrans_coxph(c1, predt = 0, direction = "forward", 
                                  newdata = nd_n, trans = tmat)

   #Obtain summary of probtrans.subjects object
   plot(icmstate_pt, id = 2)
}


Run the code above in your browser using DataLab