Skip to contents

sim_markov("violet") simulates daily 4-state trajectories resembling the VIOLET trial of early high-dose vitamin D3 versus placebo in critically ill adults with vitamin D deficiency. The transition model is the partial proportional-odds Markov model that Frank Harrell fitted to the VIOLET data to simulate his large simlongord trial (Harrell, 2022), and patients are drawn from the same 1,351 VIOLET patients. Its daily state proportions agree with simlongord within simulation error. The states are:

  1. at home

  2. in hospital or another health care facility

  3. on a ventilator or with acute respiratory distress syndrome (ARDS)

  4. dead

The output has columns id, time, y, yprev, age, sofa, and tx, 28 rows per patient by default, and dead patients stay in state 4.

Details

Patients. Each simulated patient's starting state (yprev), age, and SOFA (Sequential Organ Failure Assessment) score are drawn together, with replacement, from the 1,351 VIOLET patients summarized in violet_baseline. About 65% of patients start in hospital (state 2) and 35% on a ventilator or with ARDS (state 3). Treatment (tx = 1) is assigned independently of these characteristics with probability treatment_prob; control patients have tx = 0. A baseline_data that you supply must contain the columns id, yprev, age, sofa, and tx.

Transition model. Write \(Y_t\) for the state on day \(t\) and \(k\) for the state on the previous day. The log odds of being in state \(j\) or worse on day \(t\) is $$\mathrm{logit}\,\Pr(Y_t \ge j \mid Y_{t-1} = k) = \alpha_j + \gamma_k + \delta_j t + \delta'_j \max(t - 2, 0) + 0.0105\,\mathrm{age} + 0.046\,\mathrm{SOFA} + \beta(t)\,\mathrm{tx}$$ for the cutoffs \(j = 2, 3, 4\). Here \(\beta(t)\) is the treatment effect on day \(t\) described under treatment_effect_decay in sim_markov(). Positive values make worse states more likely: for example, each additional SOFA point multiplies the odds of being in a worse state by \(\exp(0.046) = 1.05\).

The thresholds \(\alpha_j\) and time slopes \(\delta_j\) and \(\delta'_j\) differ between the cutoffs, so the mix of states can change over follow-up (a partial proportional odds model for time):

Cutoff \(j\)States counted\(\alpha_j\)\(\delta_j\)\(\delta'_j\)
4dead-4.7130.412-0.410
3ventilator/ARDS or dead1.741-0.4810.525
2hospital or worse10.034-1.3151.384

Time enters as a straight line whose slope changes after day 2, because very few patients went home on day 1. The previous state shifts all three cutoffs equally: \(\gamma_k\) is -15.797 after a day at home (\(k = 1\)), -6.364 after a day in hospital (\(k = 2\)), and 0 after a day on a ventilator or with ARDS (\(k = 3\)). The large negative values mean that patients usually stay in, or improve from, their previous state.

Treatment effect. The default treatment_effect of log(0.75) is the odds ratio of 0.75 that Harrell built into simlongord, the same for every previous state. In VIOLET itself, vitamin D had no detectable effect (fitted log odds ratio -0.028, standard error 0.050).

Relation to Harrell's model. Harrell numbered the states from dead (lowest) to home (highest), modeled the probability of a better state, and published the coefficients rounded to three decimals. This preset numbers the states from best to worst, so each intercept and coefficient above is his printed value with the opposite sign; the transition probabilities are the same. The one exception is age. Harrell printed 0.011 (with his sign, -0.011), but simlongord was evidently simulated with a value close to 0.0105: refitting his model to all 250,000 simulated patients gives 0.0105 (standard error 0.00015), while every other coefficient agrees with its printed value. A difference of 0.0005 per year of age moves a typical patient's log odds by about 0.03 every day, so with 0.011 about 1 percentage point fewer patients are at home by day 28 than in simlongord. With 0.0105 the daily state proportions agree with simlongord within simulation error.

He fitted the model to days 1 to 27, because ventilator use on day 28 looked anomalous, and simulated 28 days, which is the default here. Later days extend the fitted time trends. Harrell assigned treatment once to each of the 1,351 VIOLET patients before resampling them, so in simlongord the arms differ slightly in their starting states and covariates (for example, 33.9% versus 36.0% start on a ventilator). This preset assigns treatment independently to every simulated patient, so the arms differ only by chance.

References

National Heart, Lung, and Blood Institute PETAL Clinical Trials Network (2019). "Early High-Dose Vitamin D3 for Critically Ill, Vitamin D-Deficient Patients." New England Journal of Medicine, 381(26), 2529-2540. doi:10.1056/NEJMoa1911124

Harrell FE Jr (2022). "Simulating a Large Clinical Trial From VIOLET." https://hbiostat.org/data/repo/simlongord

See also

sim_markov() to simulate, and violet_baseline for the VIOLET patients.

Examples

violet <- sim_markov("violet", n_patients = 20, seed = 123)
head(violet)
#>   id time y yprev age sofa tx
#> 1  1    1 2     2  68    6  0
#> 2  1    2 2     2  68    6  0
#> 3  1    3 2     2  68    6  0
#> 4  1    4 2     2  68    6  0
#> 5  1    5 3     2  68    6  0
#> 6  1    6 3     3  68    6  0

# A trial in which treatment has no effect
null_trial <- sim_markov(
  "violet",
  n_patients = 20,
  treatment_effect = 0,
  seed = 123
)