Extract the estimated transition probability matrix from a fitted
nontimehomogeneous multistate model for a given time interval.
This is a generalisation of pmatrix.msm
to
models with timedependent covariates. Note that
pmatrix.msm
is sufficient to calculate transition
probabilities for timeinhomogeneous
models fitted using the pci
argument to msm
.
1 2 3 
x 
A fitted multistate model, as returned by

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
(assuming that all elements of 
ci 
If If If 
cl 
Width of the symmetric confidence interval, relative to 1. 
B 
Number of bootstrap replicates, or number of normal simulations from the distribution of the MLEs 
cores 
Number of cores to use for bootstrapping using parallel
processing. See 
qlist 
A list of transition intensity matrices, of length one
greater than the length of 
... 
Optional arguments to be passed to 
Suppose a multistate model has been fitted, in which the transition intensity matrix Q(x(t)) is modelled in terms of timedependent covariates x(t). The transition probability matrix P(t1, tn) for the time interval (t1, tn) cannot be calculated from the estimated intensity matrix as exp((tn  t1) Q), because Q varies within the interval t1, tn. However, if the covariates are piecewiseconstant, or can be approximated as piecewiseconstant, then we can calculate P(t1, tn) 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(t1, tn) = P(t1, t2) P(t2, t3)…P(tn1, tn)
The matrix of estimated transition probabilities P(t) for the
time interval [t1, tn]
. That is, the probabilities of
occupying state s at time tn
conditionally on occupying state r at time t1.
Rows correspond to "fromstate" and columns to "tostate".
C. H. Jackson chris.jackson@mrcbsu.cam.ac.uk
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19  ## Not run:
## 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 multistate 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 in the four intervals
## defined by the three cut points
covariates < list( list (treat1=0, treat2=0), 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)
## End(Not run)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.