| simMarkovOrd | R Documentation |
Simulate Ordinal Markov Process
simMarkovOrd(
n = 1,
y,
times,
initial,
X = NULL,
absorb = NULL,
intercepts,
g,
carry = FALSE,
rdsample = NULL,
...
)
n |
number of subjects to simulate |
y |
vector of possible y values in order (numeric, character, factor) |
times |
vector of measurement times |
initial |
initial value of |
X |
an optional vector of matrix of baseline covariate values passed to |
absorb |
vector of absorbing states, a subset of |
intercepts |
vector of intercepts in the proportional odds model. There must be one fewer of these than the length of |
g |
a user-specified function of three or more arguments which in order are |
carry |
set to |
rdsample |
an optional function to do response-dependent sampling. It is a function of these arguments, which are vectors that stop at any absorbing state: |
... |
additional arguments to pass to |
Simulates longitudinal data for subjects following a first-order Markov process under a proportional odds model. Optionally, response-dependent sampling can be done, e.g., if a subject hits a specified state at time t, measurements are removed for times t+1, t+3, t+5, ... This is applicable when for example a study of hospitalized patients samples every day, Y=1 denotes patient discharge to home, and sampling is less frequent outside the hospital. This example assumes that arriving home is not an absorbing state, i.e., a patient could return to the hospital.
data frame with one row per subject per time, and columns id, time, gap, yprev, y
Frank Harrell
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.