# Chapter 6 Estimating Annual Indices and Trends

Once the model has finished running, we can use the saved output to calculate the population trajectories and trends. As an example, we’ll load some saved model output for Scarlet Tanager, from the gamye model. If you haven’t already, you can download the model output file here, then save it into your working directory.

This saved workspace includes two objects:

1. jags_data - the data object created with the prepare_jags_data() function.

2. jags_mod - the model output created with the run_model() function.

load("jags_mod_full.RData")

## 6.1 Annual Indices

The annual indices of relative abundance (“annual indices”) from all of the bbsBayes models represent the expected mean count on the BBS routes in a given region and year. The time-series of these annual indices in a given region make up the estimated population trajectory.

indices <- generate_indices(jags_mod = jags_mod,
jags_data = jags_data)
## Note: this function can take ~20 minutes to run for a species with a broad range (many strata) and if the model run included a long time-series (many years).

By default, this function generates estimates for the continent (i.e., survey-wide) and for the individual strata. However, if using one of the two BBS stratifications “bbs_usgs” or “bbs_cws,” the user can also select summaries for composite regions (regions made up of collections of strata), such as countries, provinces/states, Bird Conservation Regions, etc.

indices <- generate_indices(jags_mod = jags_mod,
jags_data = jags_data,
regions = c("continental",
"national",
"prov_state",
"stratum"))
#also "bcr", #BCR specific estimates
# "bcr_by_country" #e.g., splits the BCRs along the national borders

The generate_indices() function creates a list that includes an object called data_summary, which is a dataframe with all of the estimated annual indices indices$data_summary. knitr::kable(head(indices$data_summary[,c(1,2,4,7,8,13,14,15,16)]))
Year Region Region_type Index Index_q_0.025 Index_q_0.975 obs_mean nrts nnzero
1966 Continental continental 1.06 0.957 1.19 0.675 325 173
1967 Continental continental 1.02 0.930 1.12 0.677 546 277
1968 Continental continental 1.04 0.964 1.13 0.797 516 270
1969 Continental continental 1.04 0.972 1.12 0.877 692 352
1970 Continental continental 1.03 0.966 1.10 0.826 733 387
1971 Continental continental 1.06 1.007 1.14 0.974 779 404

For example, one may wish to export the annual indices to a text file that can be read using Microsoft Excel.

write.csv(indices\$data_summary, "Scarlet_Tanager_trajectories.csv")

The list also includes a number of other objects that retain the stratification information, strata area weights, and the full posterior samples for every estimated annual index. Generally these other objects are only used by subsequent functions and the user won’t access them directly.

The function also accepts the alternative annual indices, such as the smooth-only indices from the gamye model.

indices_smooth <- generate_indices(jags_mod = jags_mod,
jags_data = jags_data,
alternate_n = "n3",
regions = c("continental",
"national",
"prov_state",
"stratum"))
#also "bcr", #BCR specific estimates
# "bcr_by_country" #e.g., splits the BCRs along the national borders