R/stanmodels.R

# Generated by rstantools.  Do not edit by hand.

# names of stan models
stanmodels <- c("Beta0", "Beta01", "Beta01_phi", "Beta0_phi", "Beta1", "Beta1_phi", "BetaBin", "BetaBin_theta", "BetaNo", "BetaNo_phi", "Bin", "FB0", "FB01", "FB01_phi", "FB0_phi", "FB1", "FB1_phi", "FBB", "FBB_theta", "FBNo", "FBNo_phi", "VIB0", "VIB01", "VIB01_phi", "VIB0_phi", "VIB1", "VIB1_phi", "VIBNo", "VIBNo_phi")

# load each stan module
Rcpp::loadModule("stan_fit4Beta0_mod", what = TRUE)
Rcpp::loadModule("stan_fit4Beta01_mod", what = TRUE)
Rcpp::loadModule("stan_fit4Beta01_phi_mod", what = TRUE)
Rcpp::loadModule("stan_fit4Beta0_phi_mod", what = TRUE)
Rcpp::loadModule("stan_fit4Beta1_mod", what = TRUE)
Rcpp::loadModule("stan_fit4Beta1_phi_mod", what = TRUE)
Rcpp::loadModule("stan_fit4BetaBin_mod", what = TRUE)
Rcpp::loadModule("stan_fit4BetaBin_theta_mod", what = TRUE)
Rcpp::loadModule("stan_fit4BetaNo_mod", what = TRUE)
Rcpp::loadModule("stan_fit4BetaNo_phi_mod", what = TRUE)
Rcpp::loadModule("stan_fit4Bin_mod", what = TRUE)
Rcpp::loadModule("stan_fit4FB0_mod", what = TRUE)
Rcpp::loadModule("stan_fit4FB01_mod", what = TRUE)
Rcpp::loadModule("stan_fit4FB01_phi_mod", what = TRUE)
Rcpp::loadModule("stan_fit4FB0_phi_mod", what = TRUE)
Rcpp::loadModule("stan_fit4FB1_mod", what = TRUE)
Rcpp::loadModule("stan_fit4FB1_phi_mod", what = TRUE)
Rcpp::loadModule("stan_fit4FBB_mod", what = TRUE)
Rcpp::loadModule("stan_fit4FBB_theta_mod", what = TRUE)
Rcpp::loadModule("stan_fit4FBNo_mod", what = TRUE)
Rcpp::loadModule("stan_fit4FBNo_phi_mod", what = TRUE)
Rcpp::loadModule("stan_fit4VIB0_mod", what = TRUE)
Rcpp::loadModule("stan_fit4VIB01_mod", what = TRUE)
Rcpp::loadModule("stan_fit4VIB01_phi_mod", what = TRUE)
Rcpp::loadModule("stan_fit4VIB0_phi_mod", what = TRUE)
Rcpp::loadModule("stan_fit4VIB1_mod", what = TRUE)
Rcpp::loadModule("stan_fit4VIB1_phi_mod", what = TRUE)
Rcpp::loadModule("stan_fit4VIBNo_mod", what = TRUE)
Rcpp::loadModule("stan_fit4VIBNo_phi_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)))
})

Try the FlexReg package in your browser

Any scripts or data that you put into this service are public.

FlexReg documentation built on Sept. 29, 2023, 9:06 a.m.