Execute BT-SPAS-X in WinBUGs

bt_spas_x_bugs(
  data,
  inits,
  parameters,
  model_name,
  bt_spas_x_bayes_params,
  number_mcmc,
  bugs_directory,
  debug_mode
)

Arguments

data

a list containing the following elements:

  • Nmr number of unique mark-recapture experiments performed across tributaries, years and weeks

  • Ntribs number of tributaries to use for the pCap component of the model

  • Nstrata number of weeks with catch data

  • Uwc_ind number of weeks in catch data with associated pCap and flow data

  • Nwomr number of weeks in catch data without associated pCap and flow data

  • Nstrata_wc number of weeks in catch data with catch data (RST fished)

  • indices_site_pCap tributary index (of all possible tributaries) to use to predict efficiency for missing strata. Note length=0 if selected tributary is not part of trib set that has mark-recap data. In this case model that samples from trib hyper will be called.

  • ind_trib indices (1:Ntribs) assigned to the mark-recapture experiment table for use in BUGs

  • ind_pCap indices of weeks in mark-recapture table for U strata being estimated

  • Uind_woMR indices of weeks in catch data without associated pCap and flow data

  • Uind_wMR indices of weeks in catch data with associated pCap and flow data

  • Uwc_ind indices of weeks in catch data with catch data

  • Releases number of fish released for each mark-recapture experiment

  • Recaptures number of fish recaptured for each mark-recapture experiment

  • u weekly abundance

  • mr_flow standardized flow, averaged over recapture days (< 1 week)

  • catch_flow standardized flow, averaged by week

  • K number of columns in the bspline basis matrix

  • ZP The b_spline_matrix (bspline basis matrix. One row for each data point (1:Nstrata), and one column for each term in the cubic polynomial function (4) + number of knots)

  • lgN_max maxmimum possible value for log N across strata

inits

a list containing initial values for the following parameters:

  • trib_mu.P mean of hyper-distribution for site-effect

  • b0_pCap site effect on trap efficiency for each site

  • flow_mu.P mean of hyper-distribution for flow effect

  • b_flow flow effect on trap efficiency for each site

  • trib_tau.P used to estimate standard deviation of hyper-distribution for site effect

  • flow_tau.P used to estimate standard deviation of hyper-distribution for flow effect

  • pro_tau.P used to estimate standard deviation of zero-centered normal distribution for unexplained error

  • b_sp basis function of each spline node

  • lg_N predicted weekly abundance

parameters

a list of parameters to be estimated in the model:

  • trib_mu.P mean of hyper-distribution for site-effect

  • trib_sd.P standard deviation of hyper-distribution for site effect

  • flow_mu.P mean of hyper-distribution for flow effect

  • flow_sd.P standard deviation of hyper-distribution for flow effect

  • pro_sd.P standard deviation of zero-centered normal distribution for unexplained error

  • b0_pCap site effect on trap efficiency for each site

  • b_flow flow effect on trap efficiency for each site

  • pCap_U weekly trap efficiency (capture probability)

  • N weekly juvenile abundance

  • Ntot total juvenile abundance for the year

  • sd.N standard deviation controlling flexibility of spline weekly abundance curve

  • sd.Ne standard deviation controlling extent of non-spline variation in weekly abundance

model_name

model to be called based on number of efficiency trials available for the selected site. Either

  • all_mark_recap.bug all weeks with catch have corresponding efficiency trials

  • missing_mark_recap.bug some weeks with catch have corresponding efficiency trials

  • no_mark_recap_no_trib.bug the selected site has no efficiency data at all

  • no_mark_recap.bug no weeks with catch have corresponding efficiency trials

bugs_directory

a filepath indicating where to find the WinBUGS14/ file. This needs to be in a character format ending with /WinBUGS14.

bt_spas_x_bayes_params:

a list containing number_mcmc, number_burnin, number_thin, and number_chains.

Value

if running on a Mac operating system, returns a list of all inputs formatted to pass to bugs. If running on a PC or another operating system capable of running WinBUGS, returns a nested list containing the following elements:

  • model_results the BUGs object from fitting the model

  • model_called the model called on the data

  • data_inputs the data passed to the model

  • init_inputs the initial values passed to the model

Details

This function is called within run_single_bt_spas_x() and calls the WinBUGS code