crudeinits.msm {msm} | R Documentation |
Calculates crude initial values for transition intensities by assuming that the data represent the exact transition times of the Markov process.
crudeinits.msm(state, time, subject, qmatrix, data=NULL, fromto=FALSE, fromstate=NULL, tostate=NULL, timelag=NULL, check=FALSE)
state |
Observed states, assumed to be ordered by time within each subject. |
time |
Times at which the elements of state were observed. |
subject |
Subject identification numbers corresponding to
state . If not given, all observations are assumed to be on
the same subject. |
data |
An optional data frame in which the variables represented
by subject and state can be found. |
qmatrix |
Matrix of indicators for the allowed
transitions. Specified as described in the help page for
msm . An initial value will be estimated for each
value of qmatrix that is 1. |
fromto |
If TRUE , then the data are given as three vectors,
from-state, to-state, time-difference,
representing the set of observed transitions between states, and the
time taken by each one. Otherwise, the data are given by formula ,
containing observation times, corresponding observed states, and a
vector of corresponding subject identification numbers subject .
|
fromstate |
Starting states for the observed transitions
(required if fromto == TRUE ). |
tostate |
Finishing states for the observed transitions
(required if fromto == TRUE ). |
timelag |
Time difference between observing fromstate
and tostate (required if fromto == TRUE ). |
check |
Should the supplied state, time and subject data
be checked for inconsistency with the supplied qmatrix , for
example, backward transitions in the data with a forward progression
model. This check is rather slow, and not performed by default. |
If we observe n_rs transitions from state r to state s, and a total of n_r transitions from state r, then q_rs / q_rr can be estimated by n_rs / n_r. Then, given a total of T_r years spent in state r, the mean sojourn time 1 / q_rr can be estimated as T_r / n_r. Thus, n_rs / T_r is a crude estimate of q_rs.
A named vector of estimates for the initial values of each transition
intensity. For simple models with no covariates, this can be used as
the inits
argument to msm
.
C. H. Jackson chris.jackson@imperial.ac.uk
## Aortic aneurysm growth data data(aneur) ## Three-state one-way progression model oneway.q <- rbind( c(0, 1, 0, 0), c(0, 0, 1, 0), c(0, 0, 0, 1), c(0, 0, 0, 0)) ## Crude initial values for 1-2, 2-3 and 3-4 transition intensities crudeinits.msm(fromstate=from, tostate=to, timelag=dt, fromto=TRUE, data=aneur, qmatrix=oneway.q)