Title: | Boreal Caribou Survival, Recruitment and Population Growth |
---|---|
Description: | Estimates annual survival, recruitment and population growth for boreal caribou populations using Bayesian and Maximum Likelihood models with fixed and random effects. |
Authors: | Seb Dalgarno [aut, cre] , Joe Thorley [aut] , John Boulanger [aut] , Ayla Pearson [aut], Environment and Climate Change Canada [cph] |
Maintainer: | Seb Dalgarno <[email protected]> |
License: | Apache License (== 2.0) | file LICENSE |
Version: | 0.1.0 |
Built: | 2024-11-27 04:10:37 UTC |
Source: | https://github.com/poissonconsulting/bboutools |
Get a tibble of the original data with augmentation.
## S3 method for class 'bboufit' augment(x, ...)
## S3 method for class 'bboufit' augment(x, ...)
x |
The object. |
... |
Unused parameters. |
A tibble of the augmented data.
Other generics:
augment.bboufit_ml()
,
glance.bboufit()
,
glance.bboufit_ml()
,
tidy.bboufit()
,
tidy.bboufit_ml()
if (interactive()) { fit <- bb_fit_survival(bboudata::bbousurv_a) augment(fit) }
if (interactive()) { fit <- bb_fit_survival(bboudata::bbousurv_a) augment(fit) }
Get a tibble of the original data with augmentation.
## S3 method for class 'bboufit_ml' augment(x, ...)
## S3 method for class 'bboufit_ml' augment(x, ...)
x |
The object. |
... |
Unused parameters. |
A tibble of the augmented data.
Other generics:
augment.bboufit()
,
glance.bboufit()
,
glance.bboufit_ml()
,
tidy.bboufit()
,
tidy.bboufit_ml()
if (interactive()) { fit <- bb_fit_survival_ml(bboudata::bbousurv_a) augment(fit) }
if (interactive()) { fit <- bb_fit_survival_ml(bboudata::bbousurv_a) augment(fit) }
Fit heirarchical Bayesian recruitment model using Nimble.
bb_fit_recruitment( data, adult_female_proportion = 0.65, sex_ratio = 0.5, min_random_year = 5, year_trend = FALSE, year_start = 4L, nthin = 10, niters = 1000, priors = NULL, quiet = FALSE )
bb_fit_recruitment( data, adult_female_proportion = 0.65, sex_ratio = 0.5, min_random_year = 5, year_trend = FALSE, year_start = 4L, nthin = 10, niters = 1000, priors = NULL, quiet = FALSE )
data |
The data.frame. |
adult_female_proportion |
A number between 0 and 1 of the expected proportion of adults that are female.
If NULL, the proportion is estimated from the data (i.e., |
sex_ratio |
A number between 0 and 1 of the proportion of females at birth. This proportion is applied to yearlings. |
min_random_year |
A whole number of the minimum number of years required to fit year as a random effect (as opposed to a fixed effect). |
year_trend |
A flag indicating whether to fit a year trend effect. Year trend cannot be fit if there is also a fixed year effect (as opposed to random effect). |
year_start |
A whole number between 1 and 12 indicating the start of the caribou (i.e., biological) year. By default, April is set as the start of the caribou year. |
nthin |
A whole number of the thinning rate. |
niters |
A whole number of the number of iterations per chain after thinning and burn-in. |
priors |
A named vector of the parameter prior distribution values.
Any missing values are assigned their default values in |
quiet |
A flag indicating whether to suppress messages and progress bars. |
If the number of years is > min_random_year
, a fixed-effects model is fit.
Otherwise, a mixed-effects model is fit with random intercept for each year.
If year_trend
is TRUE and the number of years is > min_random_year
, the model
will be fit with year as a continuous effect (i.e. trend) and no fixed effect of year.
If year_trend
is TRUE and the number of years is <= min_random_year
, the model
will be fit with year as a continuous effect and a random intercept for each year.
The start month of the Caribou year can be adjusted with year_start
.
A list of the Nimble model object, data and mcmcr samples.
Other model:
bb_fit_recruitment_ml()
,
bb_fit_survival()
,
bb_fit_survival_ml()
if (interactive()) { fit <- bb_fit_recruitment(bboudata::bbourecruit_a) }
if (interactive()) { fit <- bb_fit_recruitment(bboudata::bbourecruit_a) }
Fit recruitment model with Maximum Likelihood using Nimble Laplace Approximation.
bb_fit_recruitment_ml( data, adult_female_proportion = 0.65, sex_ratio = 0.5, min_random_year = 5, year_trend = FALSE, year_start = 4L, inits = NULL, quiet = FALSE )
bb_fit_recruitment_ml( data, adult_female_proportion = 0.65, sex_ratio = 0.5, min_random_year = 5, year_trend = FALSE, year_start = 4L, inits = NULL, quiet = FALSE )
data |
The data.frame. |
adult_female_proportion |
A number between 0 and 1 of the expected proportion of adults that are female.
If NULL, the proportion is estimated from the data (i.e., |
sex_ratio |
A number between 0 and 1 of the proportion of females at birth. This proportion is applied to yearlings. |
min_random_year |
A whole number of the minimum number of years required to fit year as a random effect (as opposed to a fixed effect). |
year_trend |
A flag indicating whether to fit a year trend effect. Year trend cannot be fit if there is also a fixed year effect (as opposed to random effect). |
year_start |
A whole number between 1 and 12 indicating the start of the caribou (i.e., biological) year. By default, April is set as the start of the caribou year. |
inits |
A named vector of the parameter initial values. Any missing values are assigned a default value of 0. If NULL, all parameters are assigned a default value of 0. |
quiet |
A flag indicating whether to suppress messages and progress bars. |
If the number of years is > min_random_year
, a fixed-effects model is fit.
Otherwise, a mixed-effects model is fit with random intercept for each year.
If year_trend
is TRUE and the number of years is > min_random_year
, the model
will be fit with year as a continuous effect (i.e. trend) and no fixed effect of year.
If year_trend
is TRUE and the number of years is <= min_random_year
, the model
will be fit with year as a continuous effect and a random intercept for each year.
The start month of the Caribou year can be adjusted with year_start
.
A list of the Nimble model object and Maximum Likelihood output with estimates and standard errors on the transformed scale.
Other model:
bb_fit_recruitment()
,
bb_fit_survival()
,
bb_fit_survival_ml()
if (interactive()) { fit <- bb_fit_recruitment_ml(bboudata::bbourecruit_a) }
if (interactive()) { fit <- bb_fit_recruitment_ml(bboudata::bbourecruit_a) }
Fits hierarchical Bayesian survival model using Nimble.
bb_fit_survival( data, min_random_year = 5, year_trend = FALSE, include_uncertain_morts = TRUE, year_start = 4L, nthin = 10, niters = 1000, priors = NULL, quiet = FALSE )
bb_fit_survival( data, min_random_year = 5, year_trend = FALSE, include_uncertain_morts = TRUE, year_start = 4L, nthin = 10, niters = 1000, priors = NULL, quiet = FALSE )
data |
The data.frame. |
min_random_year |
A whole number of the minimum number of years required to fit year as a random effect (as opposed to a fixed effect). |
year_trend |
A flag indicating whether to fit a year trend effect. Year trend cannot be fit if there is also a fixed year effect (as opposed to random effect). |
include_uncertain_morts |
A flag indicating whether to include uncertain mortalities in total mortalities. |
year_start |
A whole number between 1 and 12 indicating the start of the caribou (i.e., biological) year. By default, April is set as the start of the caribou year. |
nthin |
A whole number of the thinning rate. |
niters |
A whole number of the number of iterations per chain after thinning and burn-in. |
priors |
A named vector of the parameter prior distribution values.
Any missing values are assigned their default values in |
quiet |
A flag indicating whether to suppress messages and progress bars. |
If the number of years is > min_random_year
, a fixed-effects model is fit.
Otherwise, a mixed-effects model is fit with random intercept for each year.
If year_trend
is TRUE and the number of years is > min_random_year
, the model
will be fit with year as a continuous effect (i.e. trend) and no fixed effect of year.
If year_trend
is TRUE and the number of years is <= min_random_year
, the model
will be fit with year as a continuous effect and a random intercept for each year.
The model is always fit with random intercept for each month.
The start month of the Caribou year can be adjusted with year_start
.
A list of the Nimble model object, data and mcmcr samples.
Other model:
bb_fit_recruitment()
,
bb_fit_recruitment_ml()
,
bb_fit_survival_ml()
if (interactive()) { fit <- bb_fit_survival(bboudata::bbousurv_a) }
if (interactive()) { fit <- bb_fit_survival(bboudata::bbousurv_a) }
Fits hierarchical survival model with Maximum Likelihood using Nimble Laplace approximation.
bb_fit_survival_ml( data, min_random_year = 5, year_trend = FALSE, include_uncertain_morts = FALSE, year_start = 4L, inits = NULL, quiet = FALSE )
bb_fit_survival_ml( data, min_random_year = 5, year_trend = FALSE, include_uncertain_morts = FALSE, year_start = 4L, inits = NULL, quiet = FALSE )
data |
The data.frame. |
min_random_year |
A whole number of the minimum number of years required to fit year as a random effect (as opposed to a fixed effect). |
year_trend |
A flag indicating whether to fit a year trend effect. Year trend cannot be fit if there is also a fixed year effect (as opposed to random effect). |
include_uncertain_morts |
A flag indicating whether to include uncertain mortalities in total mortalities. |
year_start |
A whole number between 1 and 12 indicating the start of the caribou (i.e., biological) year. By default, April is set as the start of the caribou year. |
inits |
A named vector of the parameter initial values. Any missing values are assigned a default value of 0. If NULL, all parameters are assigned a default value of 0. |
quiet |
A flag indicating whether to suppress messages and progress bars. |
If the number of years is > min_random_year
, a fixed-effects model is fit.
Otherwise, a mixed-effects model is fit with random intercept for each year.
If year_trend
is TRUE and the number of years is > min_random_year
, the model
will be fit with year as a continuous effect (i.e. trend) and no fixed effect of year.
If year_trend
is TRUE and the number of years is <= min_random_year
, the model
will be fit with year as a continuous effect and a random intercept for each year.
The model is always fit with random intercept for each month.
The start month of the Caribou year can be adjusted with year_start
.
A list of the Nimble model object and Maximum Likelihood output with estimates and standard errors on the transformed scale.
Other model:
bb_fit_recruitment()
,
bb_fit_recruitment_ml()
,
bb_fit_survival()
if (interactive()) { fit <- bb_fit_survival_ml(bboudata::bbousurv_a) }
if (interactive()) { fit <- bb_fit_survival_ml(bboudata::bbousurv_a) }
Plots month estimates with credible limits.
bb_plot_month(x, ...) ## S3 method for class 'data.frame' bb_plot_month(x, ...) ## S3 method for class 'bboufit_survival' bb_plot_month(x, conf_level = 0.95, estimate = median, ...)
bb_plot_month(x, ...) ## S3 method for class 'data.frame' bb_plot_month(x, ...) ## S3 method for class 'bboufit_survival' bb_plot_month(x, conf_level = 0.95, estimate = median, ...)
x |
The object. |
... |
Unused parameters. |
conf_level |
A number between 0 and 1 of the confidence level. |
estimate |
A function to calculate the estimate. |
bb_plot_month(data.frame)
: Plot monthly estimate for a data frame.
bb_plot_month(bboufit_survival)
: Plot monthly estimates for a bboufit_survival object.
Plots monthly survival estimates with credible limits. Estimates represent annual survival if a given month lasted the entire year.
bb_plot_month_survival(x, ...) ## S3 method for class 'data.frame' bb_plot_month_survival(x, ...) ## S3 method for class 'bboufit_survival' bb_plot_month_survival(x, conf_level = 0.95, estimate = median, ...)
bb_plot_month_survival(x, ...) ## S3 method for class 'data.frame' bb_plot_month_survival(x, ...) ## S3 method for class 'bboufit_survival' bb_plot_month_survival(x, conf_level = 0.95, estimate = median, ...)
x |
The object. |
... |
Unused parameters. |
conf_level |
A number between 0 and 1 of the confidence level. |
estimate |
A function to calculate the estimate. |
bb_plot_month_survival(data.frame)
: Plot monthly survival estimate for a data frame.
bb_plot_month_survival(bboufit_survival)
: Plot monthly survival estimates for a bboufit_survival object.
Plots annual estimates with credible limits.
bb_plot_year(x, ...) ## S3 method for class 'data.frame' bb_plot_year(x, ...) ## S3 method for class 'bboufit' bb_plot_year(x, conf_level = 0.95, estimate = median, ...) ## S3 method for class 'bboufit_ml' bb_plot_year(x, conf_level = 0.95, estimate = median, ...)
bb_plot_year(x, ...) ## S3 method for class 'data.frame' bb_plot_year(x, ...) ## S3 method for class 'bboufit' bb_plot_year(x, conf_level = 0.95, estimate = median, ...) ## S3 method for class 'bboufit_ml' bb_plot_year(x, conf_level = 0.95, estimate = median, ...)
x |
The object. |
... |
Unused parameters. |
conf_level |
A number between 0 and 1 of the confidence level. |
estimate |
A function to calculate the estimate. |
bb_plot_year(data.frame)
: Plot annual estimate for a data frame.
bb_plot_year(bboufit)
: Plot annual estimates for a bboufit object.
bb_plot_year(bboufit_ml)
: Plot annual estimates for a bboufit_ml object.
Plots annual population growth with credible limits.
bb_plot_year_growth(x)
bb_plot_year_growth(x)
x |
A data frame of the lambda estimates (output of |
Plots annual population change (%) with credible limits.
bb_plot_year_population_change(x)
bb_plot_year_population_change(x)
x |
A data frame of the population change estimates (output of |
Plot annual recruitment estimates with credible limits. Recruitment is adjusted following DeCesare et al. (2012) methods.
bb_plot_year_recruitment(x, ...) ## S3 method for class 'data.frame' bb_plot_year_recruitment(x, ...) ## S3 method for class 'bboufit_recruitment' bb_plot_year_recruitment(x, conf_level = 0.95, estimate = median, ...)
bb_plot_year_recruitment(x, ...) ## S3 method for class 'data.frame' bb_plot_year_recruitment(x, ...) ## S3 method for class 'bboufit_recruitment' bb_plot_year_recruitment(x, conf_level = 0.95, estimate = median, ...)
x |
The object. |
... |
Unused parameters. |
conf_level |
A number between 0 and 1 of the confidence level. |
estimate |
A function to calculate the estimate. |
bb_plot_year_recruitment(data.frame)
: Plot annual recruitment estimate for a data frame.
bb_plot_year_recruitment(bboufit_recruitment)
: Plot annual recruitment estimates for a bboufit_recruitment object.
DeCesare, Nicholas J., Mark Hebblewhite, Mark Bradley, Kirby G. Smith, David Hervieux, and Lalenia Neufeld. 2012 “Estimating Ungulate Recruitment and Growth Rates Using Age Ratios.” The Journal of Wildlife Management 76 (1): 144–53 https://doi.org/10.1002/jwmg.244.
Plots annual survival estimates with credible limits.
bb_plot_year_survival(x, ...) ## S3 method for class 'data.frame' bb_plot_year_survival(x, ...) ## S3 method for class 'bboufit_survival' bb_plot_year_survival(x, conf_level = 0.95, estimate = median, ...)
bb_plot_year_survival(x, ...) ## S3 method for class 'data.frame' bb_plot_year_survival(x, ...) ## S3 method for class 'bboufit_survival' bb_plot_year_survival(x, conf_level = 0.95, estimate = median, ...)
x |
The object. |
... |
Unused parameters. |
conf_level |
A number between 0 and 1 of the confidence level. |
estimate |
A function to calculate the estimate. |
bb_plot_year_survival(data.frame)
: Plot annual survival estimate for a data frame.
bb_plot_year_survival(bboufit_survival)
: Plot annual survival estimates for a bboufit_survival object.
Plots annual recruitment estimates as trend line with credible limits.
bb_plot_year_trend_recruitment(x, ...) ## S3 method for class 'data.frame' bb_plot_year_trend_recruitment(x, ...) ## S3 method for class 'bboufit_recruitment' bb_plot_year_trend_recruitment(x, conf_level = 0.95, estimate = median, ...)
bb_plot_year_trend_recruitment(x, ...) ## S3 method for class 'data.frame' bb_plot_year_trend_recruitment(x, ...) ## S3 method for class 'bboufit_recruitment' bb_plot_year_trend_recruitment(x, conf_level = 0.95, estimate = median, ...)
x |
The object. |
... |
Unused parameters. |
conf_level |
A number between 0 and 1 of the confidence level. |
estimate |
A function to calculate the estimate. |
bb_plot_year_trend_recruitment(data.frame)
: Plot annual recruitment estimate as trend line for a data frame.
bb_plot_year_trend_recruitment(bboufit_recruitment)
: Plot annual estimates as trend line for a bboufit_recruitment object.
Plots annual survival estimates as trend line with credible limits.
bb_plot_year_trend_survival(x, ...) ## S3 method for class 'data.frame' bb_plot_year_trend_survival(x, ...) ## S3 method for class 'bboufit_survival' bb_plot_year_trend_survival(x, conf_level = 0.95, estimate = median, ...)
bb_plot_year_trend_survival(x, ...) ## S3 method for class 'data.frame' bb_plot_year_trend_survival(x, ...) ## S3 method for class 'bboufit_survival' bb_plot_year_trend_survival(x, conf_level = 0.95, estimate = median, ...)
x |
The object. |
... |
Unused parameters. |
conf_level |
A number between 0 and 1 of the confidence level. |
estimate |
A function to calculate the estimate. |
bb_plot_year_trend_survival(data.frame)
: Plot annual survival estimate as trend line for a data frame.
bb_plot_year_trend_survival(bboufit_survival)
: Plot annual estimates as trend line for a bboufit_survival object.
Predict calves per adult female by year. If year is FALSE, predictions are made for a 'typical' year.
bb_predict_calf_cow_ratio( recruitment, year = TRUE, conf_level = 0.95, estimate = median, sig_fig = 3 )
bb_predict_calf_cow_ratio( recruitment, year = TRUE, conf_level = 0.95, estimate = median, sig_fig = 3 )
recruitment |
An object of class 'bboufit_recruitment' (output of |
year |
A flag indicating whether to predict by year. |
conf_level |
A number between 0 and 1 of the confidence level. |
estimate |
A function to calculate the estimate. |
sig_fig |
A whole number of the significant figures to round estimates by. |
A tibble of the predicted estimates.
Other analysis:
bb_predict_growth()
,
bb_predict_population_change()
,
bb_predict_recruitment()
,
bb_predict_recruitment_trend()
,
bb_predict_survival()
,
bb_predict_survival_trend()
Predicts population growth (lambda) from survival and recruitment fit objects using the Hatter-Bergerud equation (Hatter and Bergerud, 1991).
bb_predict_growth( survival, recruitment, sex_ratio = 0.5, conf_level = 0.95, estimate = median, sig_fig = 3 ) bb_predict_lambda( survival, recruitment, conf_level = 0.95, estimate = median, sig_fig = 3 )
bb_predict_growth( survival, recruitment, sex_ratio = 0.5, conf_level = 0.95, estimate = median, sig_fig = 3 ) bb_predict_lambda( survival, recruitment, conf_level = 0.95, estimate = median, sig_fig = 3 )
survival |
An object of class 'bboufit_survival' (output of |
recruitment |
An object of class 'bboufit_recruitment' (output of |
sex_ratio |
A number between 0 and 1 of the proportion of females at birth. |
conf_level |
A number between 0 and 1 of the confidence level. |
estimate |
A function to calculate the estimate. |
sig_fig |
A whole number of the significant figures to round estimates by. |
A tibble of the lambda estimates with upper and lower credible intervals.
Hatter, Ian, and Wendy Bergerud. 1991. “Moose Recruitment, Adult Mortality and Rate of Change” 27: 65–73.
Other analysis:
bb_predict_calf_cow_ratio()
,
bb_predict_population_change()
,
bb_predict_recruitment()
,
bb_predict_recruitment_trend()
,
bb_predict_survival()
,
bb_predict_survival_trend()
if (interactive()) { survival <- bb_fit_survival(bboudata::bbousurv_a) recruitment <- bb_fit_recruitment(bboudata::bbourecruit_a) growth <- bb_predict_growth(survival, recruitment) }
if (interactive()) { survival <- bb_fit_survival(bboudata::bbousurv_a) recruitment <- bb_fit_recruitment(bboudata::bbourecruit_a) growth <- bb_predict_growth(survival, recruitment) }
Predicts population change (%) from survival and recruitment fit objects.
Population change is the cumulative product of population growth rate (i.e., output of bb_predict_growth()
)
bb_predict_population_change( survival, recruitment, sex_ratio = 0.5, conf_level = 0.95, estimate = median, sig_fig = 3 )
bb_predict_population_change( survival, recruitment, sex_ratio = 0.5, conf_level = 0.95, estimate = median, sig_fig = 3 )
survival |
An object of class 'bboufit_survival' (output of |
recruitment |
An object of class 'bboufit_recruitment' (output of |
sex_ratio |
A number between 0 and 1 of the proportion of females at birth. |
conf_level |
A number between 0 and 1 of the confidence level. |
estimate |
A function to calculate the estimate. |
sig_fig |
A whole number of the significant figures to round estimates by. |
A tibble of the population change estimates with upper and lower credible intervals.
Other analysis:
bb_predict_calf_cow_ratio()
,
bb_predict_growth()
,
bb_predict_recruitment()
,
bb_predict_recruitment_trend()
,
bb_predict_survival()
,
bb_predict_survival_trend()
if (interactive()) { survival <- bb_fit_survival(bboudata::bbousurv_a) recruitment <- bb_fit_recruitment(bboudata::bbourecruit_a) change <- bb_predict_population_change(survival, recruitment) }
if (interactive()) { survival <- bb_fit_survival(bboudata::bbousurv_a) recruitment <- bb_fit_recruitment(bboudata::bbourecruit_a) change <- bb_predict_population_change(survival, recruitment) }
Predict adjusted recruitment by year using DeCesare et al. (2012) methods.
If year is FALSE, predictions are made for a 'typical' year.
See bb_predict_calf_cow_ratio()
for unadjusted recruitment.
bb_predict_recruitment( recruitment, year = TRUE, sex_ratio = 0.5, conf_level = 0.95, estimate = median, sig_fig = 3 )
bb_predict_recruitment( recruitment, year = TRUE, sex_ratio = 0.5, conf_level = 0.95, estimate = median, sig_fig = 3 )
recruitment |
An object of class 'bboufit_recruitment' (output of |
year |
A flag indicating whether to predict by year. |
sex_ratio |
A number between 0 and 1 of the proportion of females at birth. |
conf_level |
A number between 0 and 1 of the confidence level. |
estimate |
A function to calculate the estimate. |
sig_fig |
A whole number of the significant figures to round estimates by. |
A tibble of the predicted estimates.
DeCesare, Nicholas J., Mark Hebblewhite, Mark Bradley, Kirby G. Smith, David Hervieux, and Lalenia Neufeld. 2012 “Estimating Ungulate Recruitment and Growth Rates Using Age Ratios.” The Journal of Wildlife Management 76 (1): 144–53 https://doi.org/10.1002/jwmg.244.
Other analysis:
bb_predict_calf_cow_ratio()
,
bb_predict_growth()
,
bb_predict_population_change()
,
bb_predict_recruitment_trend()
,
bb_predict_survival()
,
bb_predict_survival_trend()
Predict recruitment by year as trend line.
Recruitment fit object provided must be created with year_trend = TRUE
.
bb_predict_recruitment_trend( recruitment, sex_ratio = 0.5, conf_level = 0.95, estimate = median, sig_fig = 5 )
bb_predict_recruitment_trend( recruitment, sex_ratio = 0.5, conf_level = 0.95, estimate = median, sig_fig = 5 )
recruitment |
An object of class 'bboufit_recruitment' (output of |
sex_ratio |
A number between 0 and 1 of the proportion of females at birth. |
conf_level |
A number between 0 and 1 of the confidence level. |
estimate |
A function to calculate the estimate. |
sig_fig |
A whole number of the significant figures to round estimates by. |
A tibble of the predicted estimates.
Other analysis:
bb_predict_calf_cow_ratio()
,
bb_predict_growth()
,
bb_predict_population_change()
,
bb_predict_recruitment()
,
bb_predict_survival()
,
bb_predict_survival_trend()
Predict survival by year and/or month. If year and month are FALSE, predictions are made for a 'typical' year and month.
bb_predict_survival( survival, year = TRUE, month = FALSE, conf_level = 0.95, estimate = median, sig_fig = 3 )
bb_predict_survival( survival, year = TRUE, month = FALSE, conf_level = 0.95, estimate = median, sig_fig = 3 )
survival |
An object of class 'bboufit_survival' (output of |
year |
A flag indicating whether to predict by year. |
month |
A flag indicating whether to predict by month. |
conf_level |
A number between 0 and 1 of the confidence level. |
estimate |
A function to calculate the estimate. |
sig_fig |
A whole number of the significant figures to round estimates by. |
A tibble of the predicted estimates.
Other analysis:
bb_predict_calf_cow_ratio()
,
bb_predict_growth()
,
bb_predict_population_change()
,
bb_predict_recruitment()
,
bb_predict_recruitment_trend()
,
bb_predict_survival_trend()
Predict survival by year as trend line.
Survival fit object provided must be created with year_trend = TRUE
.
bb_predict_survival_trend( survival, conf_level = 0.95, estimate = median, sig_fig = 5 )
bb_predict_survival_trend( survival, conf_level = 0.95, estimate = median, sig_fig = 5 )
survival |
An object of class 'bboufit_survival' (output of |
conf_level |
A number between 0 and 1 of the confidence level. |
estimate |
A function to calculate the estimate. |
sig_fig |
A whole number of the significant figures to round estimates by. |
A tibble of the predicted estimates.
Other analysis:
bb_predict_calf_cow_ratio()
,
bb_predict_growth()
,
bb_predict_population_change()
,
bb_predict_recruitment()
,
bb_predict_recruitment_trend()
,
bb_predict_survival()
Prior distribution parameters and default values for recruitment model parameters.
bb_priors_recruitment()
bb_priors_recruitment()
Intercept
b0 ~ Normal(mu = b0_mu, sd = b0_sd)
Year Trend
bYear ~ Normal(mu = bYear_mu, sd = bYear_sd)
Year fixed effect
bAnnual ~ Normal(mu = 0, sd = bAnnual_sd)
Standard deviation of annual random effect
sAnnual ~ Exponential(rate = sAnnual_rate)
Adult female proportion
adult_female_proportion ~ Beta(alpha = adult_female_proportion_alpha, beta = adult_female_proportion_beta)
A named vector.
bb_priors_survival()
bb_priors_survival()
Prior distribution parameters and default values for survival model parameters.
bb_priors_survival()
bb_priors_survival()
Intercept
b0 ~ Normal(mu = b0_mu, sd = b0_sd)
Year Trend
bYear ~ Normal(mu = bYear_mu, sd = bYear_sd)
Year fixed effect
bAnnual ~ Normal(mu = 0, sd = bAnnual_sd)
Standard deviation of annual random effect
sAnnual ~ Exponential(rate = sAnnual_rate)
Standard deviation of month random effect
sMonth ~ Exponential(rate = sMonth_rate)
A named vector.
bb_priors_survival()
bb_priors_survival()
A wrapper on tidy.bboufit()
.
## S3 method for class 'bboufit' coef(object, ...)
## S3 method for class 'bboufit' coef(object, ...)
object |
The object. |
... |
Unused parameters. |
if (interactive()) { fit <- bb_fit_recruitment(bboudata::bbourecruit_a) coef(fit) }
if (interactive()) { fit <- bb_fit_recruitment(bboudata::bbourecruit_a) coef(fit) }
A wrapper on tidy.bboufit_ml()
.
## S3 method for class 'bboufit_ml' coef(object, ...)
## S3 method for class 'bboufit_ml' coef(object, ...)
object |
The object. |
... |
Unused parameters. |
if (interactive()) { fit <- bb_fit_recruitment_ml(bboudata::bbourecruit_a) coef(fit) }
if (interactive()) { fit <- bb_fit_recruitment_ml(bboudata::bbourecruit_a) coef(fit) }
Get Convergence of bboufit Object
## S3 method for class 'bboufit' converged(x, rhat = 1.05, ...)
## S3 method for class 'bboufit' converged(x, rhat = 1.05, ...)
x |
The object. |
rhat |
A number greater than 1 of the maximum rhat value required for model convergence. |
... |
Unused parameters. |
A flag indicating convergence.
Successful convergence indicates that no convergence warnings were produced by optim and all standard errors could be estimated.
## S3 method for class 'bboufit_ml' converged(x, ...)
## S3 method for class 'bboufit_ml' converged(x, ...)
x |
The object. |
... |
Unused parameters. |
A flag indicating convergence.
Get Effective Sample Rate of bboufit Object
## S3 method for class 'bboufit' esr(x, ...)
## S3 method for class 'bboufit' esr(x, ...)
x |
The object. |
... |
Unused parameters. |
A number of the number of chains.
Gets a named list of the estimated values by term.
## S3 method for class 'bboufit' estimates(x, term = NULL, ...)
## S3 method for class 'bboufit' estimates(x, term = NULL, ...)
x |
The object. |
term |
A string of the term name. |
... |
Unused parameters. |
A named list of the estimates.
if (interactive()) { fit <- bb_fit_survival(bboudata::bbousurv_a) estimates(fit) }
if (interactive()) { fit <- bb_fit_survival(bboudata::bbousurv_a) estimates(fit) }
Gets a named list of the estimated values by term.
## S3 method for class 'bboufit_ml' estimates(x, term = NULL, original_scale = FALSE, ...)
## S3 method for class 'bboufit_ml' estimates(x, term = NULL, original_scale = FALSE, ...)
x |
The object. |
term |
A string of the term name. |
original_scale |
A flag indicating whether to return the estimates in the original scale. |
... |
Unused parameters. |
A named list of the estimates.
if (interactive()) { fit <- bb_fit_survival_ml(bboudata::bbousurv_a) estimates(fit) }
if (interactive()) { fit <- bb_fit_survival_ml(bboudata::bbousurv_a) estimates(fit) }
Get a tibble of a one-row summary of the model fit.
## S3 method for class 'bboufit' glance(x, rhat = 1.05, ...)
## S3 method for class 'bboufit' glance(x, rhat = 1.05, ...)
x |
The object. |
rhat |
A number greater than 1 of the maximum rhat value required for model convergence. |
... |
Unused parameters. |
A tibble of the glance summary.
Other generics:
augment.bboufit()
,
augment.bboufit_ml()
,
glance.bboufit_ml()
,
tidy.bboufit()
,
tidy.bboufit_ml()
if (interactive()) { fit <- bb_fit_survival(bboudata::bbousurv_a) glance(fit) }
if (interactive()) { fit <- bb_fit_survival(bboudata::bbousurv_a) glance(fit) }
Get a tibble of a one-row summary of the model fit.
## S3 method for class 'bboufit_ml' glance(x, ...)
## S3 method for class 'bboufit_ml' glance(x, ...)
x |
The object. |
... |
Unused parameters. |
A tibble of the glance summary.
Other generics:
augment.bboufit()
,
augment.bboufit_ml()
,
glance.bboufit()
,
tidy.bboufit()
,
tidy.bboufit_ml()
if (interactive()) { fit <- bb_fit_survival_ml(bboudata::bbousurv_a) glance(fit) }
if (interactive()) { fit <- bb_fit_survival_ml(bboudata::bbousurv_a) glance(fit) }
Get code from Nimble model.
model_code(x, ...) ## S3 method for class 'bboufit' model_code(x, ...) ## S3 method for class 'bboufit_ml' model_code(x, ...)
model_code(x, ...) ## S3 method for class 'bboufit' model_code(x, ...) ## S3 method for class 'bboufit_ml' model_code(x, ...)
x |
The object. |
... |
Unused parameters. |
model_code(bboufit)
: Get model code from bboufit object.
model_code(bboufit_ml)
: Get model code from bboufit_ml object.
This is for use by developers.
model_recruitment( data, year_random = TRUE, year_trend = TRUE, adult_female_proportion = 0.65, sex_ratio = 0.5, demographic_stochasticity = TRUE, priors = NULL )
model_recruitment( data, year_random = TRUE, year_trend = TRUE, adult_female_proportion = 0.65, sex_ratio = 0.5, demographic_stochasticity = TRUE, priors = NULL )
data |
The data.frame. |
year_random |
A flag indicating whether to include year random effect. If FALSE, year is fitted as a fixed effect. |
year_trend |
A flag indicating whether to fit a year trend effect. Year trend cannot be fit if there is also a fixed year effect (as opposed to random effect). |
adult_female_proportion |
A number between 0 and 1 of the expected proportion of adults that are female.
If NULL, the proportion is estimated from the data (i.e., |
sex_ratio |
A number between 0 and 1 of the proportion of females at birth. |
demographic_stochasticity |
A flag indicating whether to include demographic_stochasticity in the recruitment model. |
priors |
A named vector of the parameter prior distribution values.
Any missing values are assigned their default values in |
This is for use by developers.
model_survival( data, year_random = TRUE, year_trend = FALSE, priors = NULL, build_derivs = TRUE )
model_survival( data, year_random = TRUE, year_trend = FALSE, priors = NULL, build_derivs = TRUE )
data |
The data.frame. |
year_random |
A flag indicating whether to include year random effect. If FALSE, year is fitted as a fixed effect. |
year_trend |
A flag indicating whether to fit a year trend effect. Year trend cannot be fit if there is also a fixed year effect (as opposed to random effect). |
priors |
A named vector of the parameter prior distribution values.
Any missing values are assigned their default values in |
build_derivs |
A flag indicating whether to build derivatives Laplace approximation. |
Get Number of Chains from bboufit Object
## S3 method for class 'bboufit' nchains(x, ...)
## S3 method for class 'bboufit' nchains(x, ...)
x |
The object. |
... |
Unused parameters. |
A number of the number of chains.
Get Number of Iterations from bboufit Object
## S3 method for class 'bboufit' niters(x, ...)
## S3 method for class 'bboufit' niters(x, ...)
x |
The object. |
... |
Unused parameters. |
A number of the number of iterations.
Get Number of Parameters from bboufit Object
## S3 method for class 'bboufit' npars(x, ...)
## S3 method for class 'bboufit' npars(x, ...)
x |
The object. |
... |
Unused parameters. |
A number of the number of parameters.
Get Number of Parameters from bboufit_ml Object
## S3 method for class 'bboufit_ml' npars(x, ...)
## S3 method for class 'bboufit_ml' npars(x, ...)
x |
The object. |
... |
Unused parameters. |
A number of the number of parameters.
Get Number of Terms from bboufit Object
## S3 method for class 'bboufit' nterms(x, ...)
## S3 method for class 'bboufit' nterms(x, ...)
x |
The object. |
... |
Unused parameters. |
A number of the number of terms.
Get Number of Terms from bboufit_ml Object
## S3 method for class 'bboufit_ml' nterms(x, ...)
## S3 method for class 'bboufit_ml' nterms(x, ...)
x |
The object. |
... |
Unused parameters. |
A number of the number of terms.
Get Parameters from bboufit Object
## S3 method for class 'bboufit' pars(x, ...)
## S3 method for class 'bboufit' pars(x, ...)
x |
The object. |
... |
Unused parameters. |
A vector of the parameter names.
Get Parameters from bboufit_ml Object
## S3 method for class 'bboufit_ml' pars(x, ...)
## S3 method for class 'bboufit_ml' pars(x, ...)
x |
The object. |
... |
Unused parameters. |
A vector of the parameter names.
A wrapper on bb_predict_recruitment()
.
## S3 method for class 'bboufit_recruitment' predict( object, year = TRUE, sex_ratio = 0.5, conf_level = 0.95, estimate = median, sig_fig = 3, ... )
## S3 method for class 'bboufit_recruitment' predict( object, year = TRUE, sex_ratio = 0.5, conf_level = 0.95, estimate = median, sig_fig = 3, ... )
object |
The object. |
year |
A flag indicating whether to predict by year. |
sex_ratio |
A number between 0 and 1 of the proportion of females at birth. |
conf_level |
A number between 0 and 1 of the confidence level. |
estimate |
A function to calculate the estimate. |
sig_fig |
A whole number of the significant figures to round estimates by. |
... |
Unused parameters. |
A wrapper on bb_predict_survival()
.
## S3 method for class 'bboufit_survival' predict( object, year = TRUE, month = FALSE, conf_level = 0.95, estimate = median, sig_fig = 3, ... )
## S3 method for class 'bboufit_survival' predict( object, year = TRUE, month = FALSE, conf_level = 0.95, estimate = median, sig_fig = 3, ... )
object |
The object. |
year |
A flag indicating whether to predict by year. |
month |
A flag indicating whether to predict by month. |
conf_level |
A number between 0 and 1 of the confidence level. |
estimate |
A function to calculate the estimate. |
sig_fig |
A whole number of the significant figures to round estimates by. |
... |
Unused parameters. |
Get Rhat of bboufit Object
## S3 method for class 'bboufit' rhat(x, ...)
## S3 method for class 'bboufit' rhat(x, ...)
x |
The object. |
... |
Unused parameters. |
A number of rhat value.
Get MCMC samples from Nimble model.
samples(x) ## S3 method for class 'bboufit' samples(x) ## S3 method for class 'bboufit_ml' samples(x)
samples(x) ## S3 method for class 'bboufit' samples(x) ## S3 method for class 'bboufit_ml' samples(x)
x |
The object. |
samples(bboufit)
: Get MCMC samples from bboufit object.
samples(bboufit_ml)
: Create MCMC samples (1 iteration, 1 chain) from bboufit_ml object.
Get a tidy tibble of the coefficient estimates and confidence intervals from Bayesian model fit.
## S3 method for class 'bboufit' tidy( x, conf_level = 0.95, estimate = median, sig_fig = 3, include_random_effects = TRUE, ... )
## S3 method for class 'bboufit' tidy( x, conf_level = 0.95, estimate = median, sig_fig = 3, include_random_effects = TRUE, ... )
x |
The object. |
conf_level |
A number between 0 and 1 of the confidence level. |
estimate |
A function to calculate the estimate. |
sig_fig |
A whole number of the significant figures to round estimates by. |
include_random_effects |
A flag indicating whether to include random effects in coefficient table. Standard deviation estimates will always be included. |
... |
Unused parameters. |
A tibble of the tidy coefficient summary.
Other generics:
augment.bboufit()
,
augment.bboufit_ml()
,
glance.bboufit()
,
glance.bboufit_ml()
,
tidy.bboufit_ml()
if (interactive()) { fit <- bb_fit_survival(bboudata::bbousurv_a) tidy(fit) }
if (interactive()) { fit <- bb_fit_survival(bboudata::bbousurv_a) tidy(fit) }
Get a tidy tibble of the coefficient estimates and confidence intervals from Maximum Likelihood model fit.
## S3 method for class 'bboufit_ml' tidy(x, conf_level = 0.95, sig_fig = 3, include_random_effects = TRUE, ...)
## S3 method for class 'bboufit_ml' tidy(x, conf_level = 0.95, sig_fig = 3, include_random_effects = TRUE, ...)
x |
The object. |
conf_level |
A number between 0 and 1 of the confidence level. |
sig_fig |
A whole number of the significant figures to round estimates by. |
include_random_effects |
A flag indicating whether to include random effects in coefficient table. Standard deviation estimates will always be included. |
... |
Unused parameters. |
A tibble of the tidy coefficient summary.
Other generics:
augment.bboufit()
,
augment.bboufit_ml()
,
glance.bboufit()
,
glance.bboufit_ml()
,
tidy.bboufit()
if (interactive()) { fit <- bb_fit_survival_ml(bboudata::bbousurv_a) tidy(fit) }
if (interactive()) { fit <- bb_fit_survival_ml(bboudata::bbousurv_a) tidy(fit) }