library(cmdstanr)
file <- file.path(cmdstan_path(), "examples/bernoulli/bernoulli.stan")
mod <- cmdstan_model(file)
mod$compile(force_recompile = TRUE)
stan_data <- list(N = 10, y = c(0,1,0,0,0,0,0,0,0,1))
# Run MCMC using the 'sample' method
fit_mcmc <- mod$sample(
data = stan_data,
seed = 123,
chains = 2,
parallel_chains = 2
)
insight::get_parameters(fit_mcmc)
#> [1] Parameter
#> <0 rows> (or 0-length row.names)