bbsBayes / bbsBayes

An R Package for Hierarchical Bayesian Analysis of North American Breeding Bird Survey Data
Other
31 stars 14 forks source link

Model updating #185

Closed AdamCSmithCWS closed 2 years ago

AdamCSmithCWS commented 2 years ago

Description

This update makes some changes to the models:

  1. first difference models are corrected, previously there was an error in the calculation of the "n2" annual index, where the intercept was missing. These models also have a new parameterisation, more closely following that used in Link and Sauer, 2020. The priors and the year-effects are now centered in the middle of the time-series. This improves the estimates of the strata-level intercepts, particularly for species that have sparse data at the beginning of the time series.
  2. the GAMYE models have more intuitive parameter names to match the language in Smith and Edwards 2020. The spline components are now called "smooth" and the year-effects are now called yeareffects. The annual index parameters are also more intuitively named, so that the full annual indices are call "n" (as they are for all models) but the smooth-only annual indices are called "nsmooth", where previously they were called "n3".
  3. The slope models have more intuitive annual index parameter names, similar to the changes made to the GAMYE models. The full annual indices are called "n" and the slope-only annual indices are called "nslope", where previously they were called "n3".
  4. The GAM models also have the spline components named "smooth" to match the names in the GAMYE models.

Also, the prepare_data function has been updated to allow the user to choose between the default original GAM basis function prepare_data(..., model = "GAM", basis = "original") , or the same basis function used as the default in the packages mgcv, brms, and Rstanarm, prepare_data(..., model = "GAM", basis = "mgcv").

The documentation for the generate_indices function has also been updated to indicate the new annual index parameter names

Best Practices

Not sure how we should make these changes known...

trashbirdecology commented 2 years ago

@AdamCSmithCWS, re: BEST PRACTICES--I would consider adding a message on load, suggesting the user visit the package's .io website NEWS or UPDATES.md. Or you can be really invasive and open it for them :D e.g., browseURL("bbsbbsbbs.org")

Or, perhaps, the recent change can be loaded in as a message when the relevant model function is called.

AdamCSmithCWS commented 2 years ago

@trashbirdecology , thank you. Those are neat ideas. @BrandonEdwards , what do you think?