R/stanmodels.R

# Generated by rstantools.  Do not edit by hand.

# names of stan models
stanmodels <- c("IBD1", "IBD2", "IBD3", "IBD4", "IBD5", "IBD6", "IBD7", "IBD8", "RCBD1", "RCBD2", "RCBD3", "RCBD4", "RCBD5", "RCBD6", "RCBD7", "RCBD8", "entrymean1", "entrymean2")

# load each stan module
Rcpp::loadModule("stan_fit4IBD1_mod", what = TRUE)
Rcpp::loadModule("stan_fit4IBD2_mod", what = TRUE)
Rcpp::loadModule("stan_fit4IBD3_mod", what = TRUE)
Rcpp::loadModule("stan_fit4IBD4_mod", what = TRUE)
Rcpp::loadModule("stan_fit4IBD5_mod", what = TRUE)
Rcpp::loadModule("stan_fit4IBD6_mod", what = TRUE)
Rcpp::loadModule("stan_fit4IBD7_mod", what = TRUE)
Rcpp::loadModule("stan_fit4IBD8_mod", what = TRUE)
Rcpp::loadModule("stan_fit4RCBD1_mod", what = TRUE)
Rcpp::loadModule("stan_fit4RCBD2_mod", what = TRUE)
Rcpp::loadModule("stan_fit4RCBD3_mod", what = TRUE)
Rcpp::loadModule("stan_fit4RCBD4_mod", what = TRUE)
Rcpp::loadModule("stan_fit4RCBD5_mod", what = TRUE)
Rcpp::loadModule("stan_fit4RCBD6_mod", what = TRUE)
Rcpp::loadModule("stan_fit4RCBD7_mod", what = TRUE)
Rcpp::loadModule("stan_fit4RCBD8_mod", what = TRUE)
Rcpp::loadModule("stan_fit4entrymean1_mod", what = TRUE)
Rcpp::loadModule("stan_fit4entrymean2_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 ProbBreed package in your browser

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

ProbBreed documentation built on April 4, 2025, 5:07 a.m.