prepare_jags_data {bbsBayes} | R Documentation |

`prepare_jags_data`

subsets raw BBS data by selected species and
and wrangles stratified data for use as input to run JAGS models.

prepare_jags_data( strat_data = NULL, species_to_run = NULL, model = NULL, heavy_tailed = FALSE, n_knots = NULL, min_year = NULL, max_year = NULL, min_n_routes = 3, min_max_route_years = 3, min_mean_route_years = 1, strata_rem = NULL, quiet = FALSE, ... )

`strat_data` |
Large list of stratified data returned by |

`species_to_run` |
Character string of the English name of the species to run |

`model` |
Character string of model to be used. Options are "slope", "firstdiff", "gam", "gamye. |

`heavy_tailed` |
Logical indicating whether the extra-Poisson error distribution should be modeled as a t-distribution, with heavier tails than the standard normal distribution. Default is currently FALSE, but recent results suggest users should strongly consider setting this to TRUE, even though it requires much longer convergence times |

`n_knots` |
Number of knots to be used in GAM function |

`min_year` |
Minimum year to keep in analysis |

`max_year` |
Maximum year to keep in analysis |

`min_n_routes` |
Minimum routes per strata where species has been observed. Defaults to 3 |

`min_max_route_years` |
Minimum number of years with non-zero observations of species on at least 1 route. Defaults to 3 |

`min_mean_route_years` |
Minimum average of years per route with the species observed. Defaults to 1. |

`strata_rem` |
Strata to remove from analysis. Defaults to NULL |

`quiet` |
Should progress bars be suppressed? |

`...` |
Additional arguments |

List of data to be used in JAGS, including:

`model` |
The model to be used in JAGS |

`heavy_tailed` |
Logical indicating whether the extra-Poisson error distribution should be modeled as a t-distribution |

`ncounts` |
The number of counts containing useful data for the species |

`nstrata` |
The number of strata used in the analysis |

`ymin` |
Minimum year used |

`ymax` |
Maximum year used |

`nonzeroweight` |
Proportion of routes in each strata with species obervation |

`count` |
Vector of counts for the species |

`strat` |
Vector of strata to be used in the analysis |

`osber` |
Vector of unique observer-route pairings |

`year` |
Vector of years for each count |

`firstyr` |
Vector of indicator variables as to whether an observer was a first year |

`month` |
vector of numeric month of observation |

`day` |
vector of numeric day of observation |

`nobservers` |
Total number of observer-route pairings |

`fixedyear` |
Median of all years (ymin:ymax), included only with slope model |

`nknots` |
Number of knots to use for smooting functions, included only with GAM |

`X.basis` |
Basis function for n smoothing functions, included only with GAM |

# Toy example with Pacific Wren sample data # First, stratify the sample data strat_data <- stratify(by = "bbs_cws", sample_data = TRUE) # Prepare the stratified data for use in a JAGS model. In this # toy example, we will set the minimum year as 2009 and # maximum year as 2018, effectively only setting up to # model 10 years of data. We will use the "first difference # model. jags_data <- prepare_jags_data(strat_data = strat_data, species_to_run = "Pacific Wren", model = "firstdiff", min_year = 2009, max_year = 2018) # You can also specify the GAM model, with an optional number of # knots to use for the GAM basis. # By default, the number of knots will be equal to the floor # of the total unique years for the species / 4 jags_data <- prepare_jags_data(strat_data = strat_data, species_to_run = "Pacific Wren", model = "gam", n_knots = 9)

[Package *bbsBayes* version 2.3.6.2020 Index]