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, t=1, newdata=NULL, ci=FALSE, tvar="trans",
sing.inf=1e+10, B=1000, cl=0.95, ...)
flexsurvreg
. See
msfit.flexsurvreg
for the required form of the model and the data.
Additionally, this musmsfit.flexsurvreg
.msfit.flexsurvreg
.x
is a list of models.shape < 1
has infinite
hazard at t=0
, then as a workaround, the hazard is assumed to
be a large finite number, sing.in
ode
in t
is of length 1, or a
list of matrices if t
is longer.
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()
.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 pmatrix.msm
. pmatrix.fs
should give the same results as
pmatrix.msm
when both of these conditions hold:
flexsurvreg
model was fitted withdist="exp"
and the model is time-homogeneous.exacttimes=TRUE
,
thus all the event times are known, and there are no time-dependent
covariates.pmatrix.simfs
for the equivalent for
semi-Markov ("clock-reset") models.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)
Run the code above in your browser using DataLab