Learn R Programming

socialSim (version 0.1.8)

run_model: Fit one of the available Stan models to simulated datasets

Description

Fit one of the available Stan models to simulated datasets

Usage

run_model(sim, model = NULL, iter = 2000, seed = 1234, cores = 1)

Value

A list of fitted model summaries, one per dataset.

Arguments

sim

Output from simulate_data().

model

Name of the Stan model to use (choose from available options).

iter

Number of iterations per chain (default = 1000).

seed

Random seed for reproducibility.

cores

Number of CPU cores used for parallel execution.

Examples

Run this code
# \donttest{
if (requireNamespace("rstan", quietly = TRUE)) {
  sim <- simulate_data(ind = 50, Valpha = 0.2, Vepsilon = 0.1, iterations = 2)
  res <- run_model(sim, model = "Trait.stan", iter = 100, cores = 2)
  summarise_results(res)
} else {
  message("rstan not available; example skipped.")
}
# }

Run the code above in your browser using DataLab