View source: R/demographicRates.R
demographicRates | R Documentation |
Apply the sampled coefficients to the disturbance covariates
to calculate expected recruitment and survival according to the beta
regression models estimated by Johnson et al. (2020).demographicRates
is a wrapper
around sampleRates
to sample both survival and recruitment rates based on
the result of demographicCoefficients()
and using recommended defaults.
demographicRates(
covTable,
popGrowthPars,
ignorePrecision = FALSE,
returnSample = FALSE,
useQuantiles = TRUE,
predInterval = list(PI_R = c(0.025, 0.975), PI_S = c(0.025, 0.975)),
transformFns = list(S_transform = function(y) {
(y * 46 - 0.5)/45
}, R_transform
= function(y) {
y
})
)
sampleRates(
covTable,
coefSamples,
coefValues,
modelVersion,
resVar,
ignorePrecision,
returnSample,
quantilesToUse = NULL,
predInterval = c(0.025, 0.975),
transformFn = function(y) {
y
}
)
covTable |
data.frame. A table of covariate values to be used. Column names must match the coefficient names in popGrowthTableJohnsonECCC. Each row is a different scenario. |
popGrowthPars |
list. Coefficient values and (optionally) quantiles
returned by |
ignorePrecision |
logical. Should the precision of the model be used if it is available? When precision is used variation among populations around the National mean responses is considered in addition to the uncertainty about the coefficient estimates. |
returnSample |
logical. If TRUE the returned data.frame has replicates * scenarios rows. If FALSE the returned data.frame has one row per scenario and additional columns summarizing the variation among replicates. See Value for details. |
useQuantiles |
logical or numeric. If it is a numeric vector it must be
length 2 and give the low and high limits of the quantiles to use. Only
relevant when |
predInterval |
numeric vector with length 2. The default 95% interval
is ( |
transformFns |
list of functions used to transform demographic rates.
The default is |
coefSamples |
matrix. Bootstrapped coefficients with one row per replicate and one column per coefficient |
coefValues |
data.table. One row table with expected values for each coefficient |
modelVersion |
character. Which model version to use. Currently the only option is "Johnson" for the model used in Johnson et. al. (2020), but additional options may be added in the future. |
resVar |
character. Response variable, typically "femaleSurvival" or "recruitment" |
quantilesToUse |
numeric vector of length |
transformFn |
function used to transform demographic rates. |
Each population is optionally assigned to quantiles of the Beta error distributions for survival and recruitment. Using quantiles means that the population will stay in these quantiles as disturbance changes over time, so there is persistent variation in recruitment and survival among example populations.
A transformation function is also applied to survival to avoid survival probabilities of 1.
A detailed description of the model is available in Hughes et al. (2025)
A data.frame of predictions. The data.frame includes all columns in
covTable
with additional columns depending on returnSample
.
If returnSample = FALSE
the number of rows is the same as the number of
rows in covTable
, additional columns are:
"S_bar" and "R_bar": The mean estimated values of survival and recruitment (calves per cow)
"S_stdErr" and "R_stdErr": Standard error of the estimated values
"S_PIlow"/"S_PIhigh" and "R_PIlow"/"R_PIhigh": If not using quantiles, 95\ minimum values are returned.
If returnSample = TRUE
the number of rows is nrow(covTable) * replicates
additional columns are:
"scnID": A unique identifier for scenarios provided in
covTable
"replicate": A replicate identifier, unique within each scenario
"S_bar" and "R_bar": The expected values of survival and recruitment (calves per cow)
For sampleRates
a similar data frame for one response variable
Hughes, J., Endicott, S., Calvert, A.M. and Johnson, C.A., 2025. Integration of national demographic-disturbance relationships and local data can improve caribou population viability projections and inform monitoring decisions. Ecological Informatics, 87, p.103095. https://doi.org/10.1016/j.ecoinf.2025.103095
Johnson, C.A., Sutherland, G.D., Neave, E., Leblond, M., Kirby, P., Superbie, C. and McLoughlin, P.D., 2020. Science to inform policy: linking population dynamics to habitat for a threatened species in Canada. Journal of Applied Ecology, 57(7), pp.1314-1327. https://doi.org/10.1111/1365-2664.13637
Caribou demography functions:
caribouBayesianPM()
,
caribouPopGrowth()
,
compositionBiasCorrection()
,
demographicCoefficients()
,
demographicProjectionApp()
,
getOutputTables()
,
getPriors()
,
getScenarioDefaults()
,
getSimsNational()
,
plotRes()
,
popGrowthTableJohnsonECCC
,
runScnSet()
,
simulateObservations()
# get coefficient samples
coefs <- demographicCoefficients(10)
# table of different scenarios to test
covTableSim <- expand.grid(Anthro = seq(0, 90, by = 20),
fire_excl_anthro = seq(0, 70, by = 20))
covTableSim$Total_dist = covTableSim$Anthro + covTableSim$fire_excl_anthro
demographicRates(covTableSim, coefs)
cfs <- getCoefs(popGrowthTableJohnsonECCC, "recruitment", "Johnson", "M3")
cfSamps <- sampleCoefs(cfs[[1]], 10)
# disturbance scenarios
distScen <- data.frame(Total_dist = 1:10/10)
# return summary across replicates
sampleRates(distScen, cfSamps$coefSamples, cfSamps$coefValues,
"Johnson", "recruitment", ignorePrecision = TRUE,
returnSample = FALSE)
# return one row per replicate * scenario
sampleRates(distScen, cfSamps$coefSamples, cfSamps$coefValues,
"Johnson", "recruitment", ignorePrecision = TRUE,
returnSample = TRUE)
# return one row per replicate * scenario with replicates assigned to a quantile
sampleRates(distScen, cfSamps$coefSamples, cfSamps$coefValues,
"Johnson", "recruitment", ignorePrecision = TRUE,
returnSample = TRUE,
quantilesToUse = quantile(x = c(0, 1),
probs = seq(0.025, 0.975, length.out = 10)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.