# Generated by rstantools. Do not edit by hand.
# names of stan models
stanmodels <- c("binomial", "binomial_sim", "binomial_sim_misspec", "gaussian", "gaussian_sim", "gaussian_sim_misspec", "mcml_binomial", "mcml_gaussian", "mcml_poisson", "poisson", "poisson_sim", "poisson_sim_misspec")
# load each stan module
Rcpp::loadModule("stan_fit4binomial_mod", what = TRUE)
Rcpp::loadModule("stan_fit4binomial_sim_mod", what = TRUE)
Rcpp::loadModule("stan_fit4binomial_sim_misspec_mod", what = TRUE)
Rcpp::loadModule("stan_fit4gaussian_mod", what = TRUE)
Rcpp::loadModule("stan_fit4gaussian_sim_mod", what = TRUE)
Rcpp::loadModule("stan_fit4gaussian_sim_misspec_mod", what = TRUE)
Rcpp::loadModule("stan_fit4mcml_binomial_mod", what = TRUE)
Rcpp::loadModule("stan_fit4mcml_gaussian_mod", what = TRUE)
Rcpp::loadModule("stan_fit4mcml_poisson_mod", what = TRUE)
Rcpp::loadModule("stan_fit4poisson_mod", what = TRUE)
Rcpp::loadModule("stan_fit4poisson_sim_mod", what = TRUE)
Rcpp::loadModule("stan_fit4poisson_sim_misspec_mod", what = TRUE)
# instantiate each stanmodel object
stanmodels <- sapply(stanmodels, function(model_name) {
# create C++ code for stan model
stan_file <- if(dir.exists("stan")) "stan" else file.path("inst", "stan")
stan_file <- file.path(stan_file, paste0(model_name, ".stan"))
stanfit <- rstan::stanc_builder(stan_file,
allow_undefined = TRUE,
obfuscate_model_name = FALSE)
stanfit$model_cpp <- list(model_cppname = stanfit$model_name,
model_cppcode = stanfit$cppcode)
# create stanmodel object
methods::new(Class = "stanmodel",
model_name = stanfit$model_name,
model_code = stanfit$model_code,
model_cpp = stanfit$model_cpp,
mk_cppmodule = function(x) get(paste0("rstantools_model_", model_name)))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.