fit_bayes_cjs: Fit Bayesian CJS Model

View source: R/fit_bayes_cjs.R

fit_bayes_cjsR Documentation

Fit Bayesian CJS Model

Description

This wrapper function writes a text file describing a Bayesian Cormack Jolly-Seber model in the JAGS language, prepares the data, runs the MCMC and summarises the results.

Usage

fit_bayes_cjs(
  file_path = NULL,
  cap_hist_wide = NULL,
  tag_meta = NULL,
  drop_col_nm = "duty_cycle",
  drop_values = c("batch_2", "batch_3"),
  n_chains = 4,
  n_adapt = 1000,
  n_burnin = 2500,
  n_iter = 2500,
  n_thin = 5,
  params_to_save = c("phi", "p", "survship"),
  rng_seed = 4,
  ...
)

Arguments

file_path

name (with file path) to save the model as. Probably a .txt file

cap_hist_wide

wide capture history, one row per tag, one column per detection site. Includes columns named tag_id and cap_hist. Part of the output from prep_capture_history.

tag_meta

metadata for each tag, including a column named tag_id.

drop_col_nm

name of column in tag_meta to be used to filter out any particular tags.

drop_values

character vector of values in drop_col_nm column of tag_meta that should be excluded from the CJS model.

n_chains

the number of parallel chains for the model

n_adapt

the number of iterations for adaptation. If n_adapt = 0 then no adaptation takes place.

n_burnin

the number of iterations of the Markov chain to run during the burn-in phase

n_iter

the number of iterations to monitor

n_thin

the thinning interval for monitors

params_to_save

a character vector giving the names of variables to be monitored

rng_seed

random number generator seed, to make results reproducible

...

other parameters to be fed to rjags::jags.model, update.jags or rjags::coda.samples

Value

tibble

Author(s)

Kevin See and Mike Ackerman


mackerman44/telemetyr documentation built on Feb. 15, 2025, 1:08 a.m.