R/transTP.R

Defines functions transTP

Documented in transTP

#' Define transition matrix for multi-state model.
#'
#' @description Define transition matrices for multi-state model. Specific
#' functions for defining  such transition matrices are pre-defined for common
#' multi-state models like the competing risks model and the illness-death 
#' model.
#'
#' @param positions List of possible transitions; x[[i]] consists of a vector of
#' state numbers reachable from state i.
#' @param states.names A character vector containing the names of either the
#' competing risks or the states in the multi-state model specified by the
#' competing risks or illness-death model. names should have the same 
#' length as the list x (for transMat), or either K or K+1 (for trans.comprisk),
#' or 3 (for trans.illdeath).

#' @return A transition matrix describing the states and transitions in the
#' multi-state model.
#'
#' @examples
#' data("ebmt4")
#' db_wide <- ebmt4
#' positions<-list(c(2, 3, 5, 6), c(4, 5, 6), c(4, 5, 6), c(5, 6), c(6), c())
#' states.names = c("Tx", "Rec", "AE", "Rec+AE", "Rel", "Death")
#' transTP(positions, states.names)

#' @author Gustavo Soutinho and Luis Meira-Machado.

transTP<- function(positions, states.names){
  
  x<-positions
  
  names<-states.names
  
  res<-transMat(x, names)
  
  return(res)
  
}

Try the presmoothedTP package in your browser

Any scripts or data that you put into this service are public.

presmoothedTP documentation built on April 3, 2025, 7:44 p.m.