| ppass.msm {msm} | R Documentation |
Passage probabilities
Description
Probabilities of having visited each state by a particular time in a continuous time Markov model.
Usage
ppass.msm(
x = NULL,
qmatrix = NULL,
tot,
start = "all",
covariates = "mean",
piecewise.times = NULL,
piecewise.covariates = NULL,
ci = c("none", "normal", "bootstrap"),
cl = 0.95,
B = 1000,
cores = NULL,
...
)
Arguments
x |
A fitted multi-state model, as returned by |
qmatrix |
Instead of |
tot |
Finite time to forecast the passage probabilites for. |
start |
Starting state (integer). By default ( Alternatively, this can be used to obtain passage probabilities from a
set of states, rather than single states. To achieve this,
|
covariates |
Covariate values defining the intensity matrix for the
fitted model |
piecewise.times |
Currently ignored: not implemented for time-inhomogeneous models. |
piecewise.covariates |
Currently ignored: not implemented for time-inhomogeneous models. |
ci |
If If If |
cl |
Width of the symmetric confidence interval, relative to 1. |
B |
Number of bootstrap replicates. |
cores |
Number of cores to use for bootstrapping using parallel
processing. See |
... |
Arguments to pass to |
Details
The passage probabilities to state s are computed by setting the
sth row of the transition intensity matrix Q to zero, giving an
intensity matrix Q* for a simplified model structure where state
s is absorbing. The probabilities of passage are then equivalent to
row s of the transition probability matrix Exp(tQ*) under this
simplified model for t=tot.
Note this is different from the probability of occupying each state at
exactly time t, given by pmatrix.msm. The passage
probability allows for the possibility of having visited the state before
t, but then occupying a different state at t.
The mean of the passage distribution is the expected first passage time,
efpt.msm.
This function currently only handles time-homogeneous Markov models. For time-inhomogeneous models the covariates are held constant at the value supplied, by default the column means of the design matrix over all observations.
Value
A matrix whose r, s entry is the probability of having visited
state s at least once before time t, given the state at time
0 is r. The diagonal entries should all be 1.
Author(s)
C. H. Jackson chris.jackson@mrc-bsu.cam.ac.uk
References
Norris, J. R. (1997) Markov Chains. Cambridge University Press.
See Also
efpt.msm, totlos.msm,
boot.msm.
Examples
Q <- rbind(c(-0.5, 0.25, 0, 0.25), c(0.166, -0.498, 0.166, 0.166),
c(0, 0.25, -0.5, 0.25), c(0, 0, 0, 0))
## ppass[1,2](t) converges to 0.5 with t, since given in state 1, the
## probability of going to the absorbing state 4 before visiting state
## 2 is 0.5, and the chance of still being in state 1 at t decreases.
ppass.msm(qmatrix=Q, tot=2)
ppass.msm(qmatrix=Q, tot=20)
ppass.msm(qmatrix=Q, tot=100)
Q <- Q[1:3,1:3]; diag(Q) <- 0; diag(Q) <- -rowSums(Q)
## Probability of about 1/2 of visiting state 3 by time 10.5, the
## median first passage time
ppass.msm(qmatrix=Q, tot=10.5)
## Mean first passage time from state 2 to state 3 is 10.02: similar
## to the median
efpt.msm(qmatrix=Q, tostate=3)