interpol_msfit: Given a 'msfit' object, linearly interpolate the cumulative...

View source: R/interpolate_npfit.R

interpol_msfitR Documentation

Given a msfit object, linearly interpolate the cumulative hazard taking into account the support sets for msfit objects.

Description

After using this function, use probtrans to get interpolated transition probabilities.

Usage

interpol_msfit(msfit, times)

Arguments

msfit

A msfit object.

times

Times at which to interpolate the msfit object.

Value

An msfit object containing the interpolated hazards

Examples

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 <- interpol_msfit(ms_fit, seq(0, 5, 0.01))


icmstate documentation built on April 3, 2025, 8:06 p.m.