| sim_mspdata | R Documentation |
Generates exact continuous-time trajectories under a built-in or
user-supplied generator and records the occupied state at a set of
observation times, producing a panel dataset in long format.
sim_semimarkov is the Weibull-sojourn wrapper used to assess
sensitivity to the Markov assumption. sim.mspdata is a deprecated
alias.
sim_mspdata(process = NULL, n = 100L, t = 10, Q = NULL,
schedule = c("regular", "random"), by = 1, visit_rate = 1.2,
p_miss = 0, start_state = 1L, exact_absorption = FALSE,
sojourn = c("exponential", "weibull"), shape = 1)
sim_semimarkov(process = NULL, n = 100L, t = 10, shape = 1, Q = NULL,
schedule = c("regular", "random"), by = 1, visit_rate = 1.2,
p_miss = 0, start_state = 1L)
sim.mspdata(...)
process |
Character. One of |
n |
Integer. Number of subjects. |
t |
Numeric. Length of the observation window. |
Q |
Optional user-supplied generator matrix, checked against the
structural zeros of |
schedule |
|
by |
Numeric. Spacing of the regular grid. |
visit_rate |
Numeric. Visit intensity for the random schedule. |
p_miss |
Numeric in |
start_state |
Integer state at time zero, or a vector of probabilities over states. |
exact_absorption |
Logical. Append the exact entry time into an absorbing state as an extra record. |
sojourn |
|
shape |
Weibull shape. The scale is calibrated so the mean holding time
matches the Markov mean, so |
... |
Passed to |
Trajectory generation and panel construction are kept separate: the state
recorded at observation time u is the destination of the last jump at
or before u. Discretising the process directly onto the observation
grid shifts the implied holding-time distribution by up to one inter-visit
interval and biases every leaving rate.
A data frame with columns subject, time and state, one
row per subject-visit, with the generating generator attached as attribute
"Q".
fit_msm, ms_occupancy
dat <- sim_mspdata("illness_death_3state", n = 50, t = 10)
head(dat)
irr <- sim_mspdata("illness_death_3state", n = 50, t = 10,
schedule = "random", visit_rate = 1.2, p_miss = 0.2)
range(table(irr$subject))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.