# \donttest{
# Fit a model
fit <- bgm(x = Wenchuan[, 1:5], chains = 2)
# Simulate 100 new observations using posterior means
new_data <- simulate(fit, nsim = 100)
# Simulate with parameter uncertainty (10 datasets)
new_data_list <- simulate(fit, nsim = 100, method = "posterior-sample", ndraws = 10)
# Use parallel processing for faster simulation
new_data_list <- simulate(fit, nsim = 100, method = "posterior-sample",
ndraws = 100, cores = 2)
# }
Run the code above in your browser using DataLab