Learn R Programming

EcoEnsemble (version 1.1.2)

get_mcmc_ensemble_model: Return the compiled ensemble model Stan object.

Description

Gets the unfit, compiled stanmodel object encoding the ensemble model. This allows for manual fitting of the ensemble model directly using rstan::sampling.

Usage

get_mcmc_ensemble_model(priors, likelihood = TRUE, drivers = FALSE)

Value

The stanmodel object encoding the ensemble model.

Arguments

priors

An EnsemblePrior object specifying the prior distributions for the ensemble for which the compiled stanmodel object will be obtained.

likelihood

A logical that returns the compiled stanmodel object including the likelihood (the Kalman filter) for given priors if TRUE. If FALSE returns the compiled stanmodel object without the likelihood for sampling from the prior.

drivers

A logical indicating whether drivers have been used in combination with simulators. Default value is FALSE.

Examples

Run this code
priors <- EnsemblePrior(4)
mod <- get_mcmc_ensemble_model(priors)

ensemble_data <- EnsembleData(observations = list(SSB_obs, Sigma_obs),
                             simulators = list(list(SSB_ewe, Sigma_ewe, "EwE"),
                                           list(SSB_fs,  Sigma_fs, "FishSUMS"),
                                           list(SSB_lm,  Sigma_lm, "LeMans"),
                                           list(SSB_miz, Sigma_miz, "mizer")),
                              priors = priors)
# \donttest{
out <- rstan::sampling(mod, ensemble_data@stan_input, chains = 1)
# }

Run the code above in your browser using DataLab