knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", fig.width = 5, fig.height = 4 ) library(bboutools)
bboutools
is an R package to estimate the annual survival, recruitment and population growth for boreal caribou populations using Bayesian and Maximum Likelihood models with fixed and random effects.
It was developed to facilitate direct comparison of estimates across jurisdictions.
To install the latest development version:
# install.packages("remotes") remotes::install_github("poissonconsulting/bboutools")
bboutools
accepts survival data for a single population in a specific format.
library(tibble) # for printing data frames library(ggplot2) # for plotting library(bboudata) # for boreal caribou datasets library(bboutools) surv_data <- bboudata::bbousurv_a head(surv_data)
The survival model, which includes a random effect of month, is fitted using bb_fit_survival()
.
To achieve convergence increase nthin
.
set.seed(99) surv_fit <- bb_fit_survival(surv_data, quiet = TRUE) glance(surv_fit)
Predictions can then be generated using bb_predict_survival()
.
surv_pred <- bb_predict_survival(surv_fit) surv_pred
And plotted using bb_plot_year()
bb_plot_year_survival(surv_pred) + expand_limits(y = c(0, 1))
The survival in each month can be plotted using bb_plot_month()
bb_plot_month_survival(surv_fit)
These estimates represent the annual survival rate if that month lasted the whole year.
The equivalent functions for recruitment data are
recruit_data <- bboudata::bbourecruit_a head(recruit_data) set.seed(99) recruit_fit <- bb_fit_recruitment(recruit_data, quiet = TRUE) bb_plot_year_recruitment(recruit_fit)
The function bb_predict_growth()
predicts the annual population growth (lambda) rate from the survival and recruitment models.
lambda <- bb_predict_growth(surv_fit, recruit_fit) bb_plot_year_growth(lambda)
bb_predict_population_change()
calculates the population change (%) with uncertainty as the cumulative product of population growth.
change <- bb_predict_population_change(surv_fit, recruit_fit) bb_plot_year_population_change(change)
Additional information is available from the bboutools website, which includes the following articles:
- Get Started.
- Analytic Methods for Estimation of Boreal Caribou Survival, Recruitment and Population Growth.
- Prior Selection and Influence.
There is also a user-friendly graphical interface, called bboushiny
, for non-R users.
bboutools
is part of the bbou suite of tools.
Other packages in this suite include:
Please report any issues.
Pull requests are always welcome.
Please note that the bboutools
project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.
cat(bboutools::licensing_md())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.