Learn R Programming

icmstate (version 0.2.0)

extend_msfit: Given a msfit object, extend the times considered in the object

Description

After using this function, use probtrans to get interpolated transition probabilities. This function is useful when you want to obtain transition probabilities at more than just the minimal number of times that strictly have to be considered. The inserted hazard values are simply the hazards at the nearest time that is smaller or equal.

Usage

extend_msfit(msfit, times)

Value

An msfit object containing the extended hazards

Arguments

msfit

A msfit object.

times

Times at which to extend the msfit object.

Examples

Run this code
library(mstate)
tmat <- trans.illdeath()
times <- seq(0, 5, 0.1)
ms_fit <- list(Haz = data.frame(time = rep(times, 3),
                                Haz = c(replicate(3, cumsum(runif(length(times), 0, 0.02)))),
                                trans = rep(1:3, each = length(times))),
               trans = tmat)
class(ms_fit) <- "msfit"

ms_fit_interpolated <- extend_msfit(ms_fit, seq(0, 5, 0.01))

Run the code above in your browser using DataLab