Simulating data using CmdStanR

I’ve been toying with transferring my workflow from RStan to CmdStanR. However, I don’t see an obvious way to simulate data using CmdStanR.

Using RStan I can use

sim_data <- stan(
  file = generate_data.stan,
  data = sim_values,
  iter = 1,
  chains = 1,
  algorithm = "Fixed_param"

to simulate data, but I don’t see an equivalent to algorithm = "Fixed_param" in CmdStanR’s $sample() or a way to use $generate_quantities() without starting with fitted parameters.

The equivalent to algorithm = "Fixed_param" in cmdstanr can be specified inside $sample() by setting fixed_param = TRUE. e.g.,

sim_data <- model$sample(data = data, fixed_param = TRUE)

See the documentation here.


Ah, right in front of me. Thank you!