Skip to contents

Fit model

Usage

fit_model(
  data = NULL,
  model = c("sampling_effort", "Young2021", "varying_preferences"),
  beta = 0.01,
  ...
)

Arguments

data

A named list containing the required data, as obtained from prepare_data().

model

character. One of "Young2021", "sampling_effort", or "varying_preferences", or a path to a file describing the Stan model in case you want to use a modified Stan model.

beta

Rate of exponential prior on r (preference) parameter. Default beta is 0.01. Increase it if you have large count numbers (can examine the resultant prior using plot_prior()).

...

Further arguments for cmdstanr::sample(), like iter_warmup, iter_sampling, or thin, among others. It is recommended to increase the number of iterations (e.g. iter_sampling = 10000).

Value

A fitted model (cmdstanr::CmdStanMCMC() object).

Examples

if (FALSE) { # interactive()
data(web)
dt <- prepare_data(mat = web, sampl.eff = rep(20, nrow(web)))
fit <- fit_model(dt)
}