Learn R Programming

msm (version 0.5.2)

pmatrix.piecewise.msm: Transition probability matrix for processes with piecewise-constant intensities

Description

Extract the estimated transition probability matrix from a fitted non-time-homogeneous multi-state model for a given time interval. This is a generalisation of pmatrix.msm to non-homogeneous models with time-dependent covariates.

Usage

pmatrix.piecewise.msm(x, t1, t2, times, covariates)

Arguments

x
A fitted multi-state model, as returned by msm. This should be a non-homogeneous model, whose transition intensity matrix depends on a time-dependent covariate.
t1
The start of the time interval to estimate the transition probabilities for.
t2
The end of the time interval to estimate the transition probabilities for.
times
Cut points at which the transition intensity matrix changes.
covariates
A list with number of components one greater than the length of times. Each component of the list is specified in the same way as the covariates argument to pmatrix.msm

Value

  • The matrix of estimated transition probabilities $P(t)$ for the time interval [t1, tn]. That is, the probabilities of occupying state $s$ at time $t_n$ conditionally on occupying state $r$ at time $t_1$. Rows correspond to "from-state" and columns to "to-state".

Details

Suppose a multi-state model has been fitted, in which the transition intensity matrix $Q(x(t))$ is modelled in terms of time-dependent covariates $x(t)$. The transition probability matrix $P(t_1, t_n)$ for the time interval $(t_1, t_n)$ cannot be calculated from the estimated intensity matrix as $\exp((t_n - t_1) Q)$, because $Q$ varies within the interval $t_1, t_n$. However, if the covariates are piecewise-constant, or can be approximated as piecewise-constant, then we can calculate $P(t_1, t_n)$ by multiplying together individual matrices $P(t_i, t_{i+1}) = \exp((t_{i+1} - t_i) Q)$, calculated over intervals where Q is constant:

$$P(t_1, t_n) = P(t_1, t_2) P(t_2, t_3)\ldots P(t_{n-1}, t_n)$$

See Also

pmatrix.msm

Examples

Run this code
## In a clinical study, suppose patients are given a placebo in the
## first 5 weeks, then they begin treatment 1 at 5 weeks, and
## a combination of treatments 1 and 2 from 10 weeks.
## Suppose a multi-state model x has been fitted for the patients'
## progress, with treat1 and treat2 as time dependent covariates.

## Cut points for when treatment covariate changes 
times <- c(0, 5, 10)

## Indicators for which treatments are active at the three cut points
covariates <- list( list (treat1=0, treat2=0), list(treat1=1, treat2=0),
list(treat1=1, treat2=1) )

## Calculate transition probabilities from the start of the study to 15 weeks
pmatrix.piecewise.msm(x, 0, 15, times, covariates)

Run the code above in your browser using DataLab