pmatrix.fs  R Documentation 
The transition probability matrix for timeinhomogeneous Markov multistate
models fitted to timetoevent data with flexsurvreg
. This
has r,s entry giving the probability that an individual is in state
s at time t, given they are in state r at time 0.
pmatrix.fs( x, trans = NULL, t = 1, newdata = NULL, condstates = NULL, ci = FALSE, tvar = "trans", sing.inf = 1e+10, B = 1000, cl = 0.95, tidy = FALSE, ... )
x 
A model fitted with

trans 
Matrix indicating allowed transitions. See

t 
Time or vector of times to predict state occupancy probabilities for. 
newdata 
A data frame specifying the values of covariates in the
fitted model, other than the transition number. See

condstates 
xInstead of the unconditional probability of being in state s at time t given state r at time 0, return the probability conditional on being in a particular subset of states at time t. This subset is specified in the This is used, for example, in competing risks situations, e.g. if the competing states are death or recovery from a disease, and we want to compute the probability a patient has died, given they have died or recovered. If these are absorbing states, then as t increases, this converges to the case fatality ratio. To compute this, set t to a very large number, 
ci 
Return a confidence interval calculated by simulating from the
asymptotic normal distribution of the maximum likelihood estimates. Turned
off by default, since this is computationally intensive. If turned on,
users should increase 
tvar 
Variable in the data representing the transition type. Not
required if 
sing.inf 
If there is a singularity in the observed hazard, for
example a Weibull distribution with 
B 
Number of simulations from the normal asymptotic distribution used to calculate variances. Decrease for greater speed at the expense of accuracy. 
cl 
Width of symmetric confidence intervals, relative to 1. 
tidy 
If TRUE then return the results as a tidy data frame 
... 
Arguments passed to 
This is computed by solving the Kolmogorov forward differential equation
numerically, using the methods in the deSolve
package. The
equation is
\frac{dP(t)}{dt} = P(t) Q(t)
where P(t) is the transition probability matrix for time t, and Q(t) is the transition hazard or intensity as a function of t. The initial condition is P(0) = I.
Note that the package msm has a similar method pmatrix.msm
.
pmatrix.fs
should give the same results as pmatrix.msm
when
both of these conditions hold:
the timetoevent distribution is exponential for all
transitions, thus the flexsurvreg
model was fitted with
dist="exp"
and the model is timehomogeneous.
the msm
model was fitted with exacttimes=TRUE
, thus all the event times are
known, and there are no timedependent covariates.
msm only allows exponential or piecewiseexponential timetoevent distributions, while flexsurvreg allows more flexible models. msm however was designed in particular for panel data, where the process is observed only at arbitrary times, thus the times of transition are unknown, which makes flexible models difficult.
This function is only valid for Markov ("clockforward") multistate
models, though no warning or error is currently given if the model is not
Markov. See pmatrix.simfs
for the equivalent for semiMarkov
("clockreset") models.
The transition probability matrix, if t
is of length 1. If t
is longer, return a list of matrices, or a data frame if tidy
is TRUE.
If ci=TRUE
, each element has attributes "lower"
and
"upper"
giving matrices of the corresponding confidence limits.
These are formatted for printing but may be extracted using attr()
.
Christopher Jackson chris.jackson@mrcbsu.cam.ac.uk.
pmatrix.simfs
, totlos.fs
,
msfit.flexsurvreg
.
# BOS example in vignette, and in msfit.flexsurvreg bexp < flexsurvreg(Surv(Tstart, Tstop, status) ~ trans, data=bosms3, dist="exp") tmat < rbind(c(NA,1,2),c(NA,NA,3),c(NA,NA,NA)) # more likely to be dead (state 3) as time moves on, or if start with # BOS (state 2) pmatrix.fs(bexp, t=c(5,10), trans=tmat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.