Get a set of simulation results from fitted demographic models in raw form Assumes that rec_pred and surv_pred each include the same years and populations.TO DO: check this.
Source:R/caribouPopSimMCMC.R
, R/internal_demog_fns.R
caribouPopSimMCMC.Rd
Get a set of simulation results from fitted demographic models in raw form
Assumes that rec_pred and surv_pred each include the same years and populations.TO DO: check this.
Format trajectory tables
Get 95% prediction intervals from trajectories
Usage
caribouPopSimMCMC(
popInfo = NA,
rec_pred,
surv_pred,
initYear = NULL,
correlateRates = FALSE,
returnExpected = FALSE,
c = formals(caribouPopGrowth)$c,
...
)
convertTrajectories(pars)
summarizeCaribouPopSim(pars, returnSamples = T)
Arguments
- popInfo
If NA (default) predictions are made without populations size, density dependence, or demographic stochasticity. See
caribouPopGrowth()
for details.- rec_pred
results returned by
bb_fit_recruitment()
orbb_predict_calf_cow_ratio()
functions of bboutools R package, or recruit_fit returned bybbouMakeSummaryTable()
.- surv_pred
bboufit object return by
bb_fit_survival()
orbb_predict_survival()
functions of bboutools R package, or surv_fit returned bybbouMakeSummaryTable()
.- initYear
numeric. Initial year.
- correlateRates
logical. Set TRUE to force correlation between recruitment and survival. Ignored
- returnExpected
logical. Default FALSE. Set TRUE to return expected values of R, S, and lambda (without interannual variation). Ignored if rec_pred/surv_pred are
bb_predict_calf_cow_ratio()
/bb_predict_survival()
results.- c
Number. Bias correction term.
- pars
- returnSamples
Value
caribouPopSimMCMC: a data frame with results from caribouPopGrowth()
for each set of survival/recruitment predictions.
convertTrajectories: formatted tables
summarizeCaribouPopSim:
See also
Caribou demography functions:
bbouMakeSummaryTable()
,
caribouBayesianPM()
,
caribouPopGrowth()
,
compositionBiasCorrection()
,
demographicCoefficients()
,
demographicProjectionApp()
,
demographicRates()
,
doSim()
,
getBBNationalInformativePriors()
,
getOutputTables()
,
getPriors()
,
getScenarioDefaults()
,
getSimsInitial()
,
getSimsNational()
,
plotRes()
,
popGrowthTableJohnsonECCC
,
runScnSet()
,
simulateObservations()
Caribou demography functions:
bbouMakeSummaryTable()
,
caribouBayesianPM()
,
caribouPopGrowth()
,
compositionBiasCorrection()
,
demographicCoefficients()
,
demographicProjectionApp()
,
demographicRates()
,
doSim()
,
getBBNationalInformativePriors()
,
getOutputTables()
,
getPriors()
,
getScenarioDefaults()
,
getSimsInitial()
,
getSimsNational()
,
plotRes()
,
popGrowthTableJohnsonECCC
,
runScnSet()
,
simulateObservations()
Examples
# \donttest{
# Note these examples take a long time to run!
mod <- bbouMakeSummaryTable(
surv_data = bboudata::bbousurv_a,
recruit_data = bboudata::bbourecruit_a,
N0 = NA, return_mcmc = TRUE
)
outmcmc = caribouPopSimMCMC(popInfo=NA,mod$recruit_fit,mod$surv_fit)
names(outmcmc)
#> [1] "N0" "lambda" "lambdaE"
#> [4] "N" "R_t" "X_t"
#> [7] "S_t" "n_recruits" "surviving_adFemales"
#> [10] "lab" "Year" "PopulationName"
#> [13] "id"
#get 95% prediction intervals from demographic trajectories
PImcmc <- summarizeCaribouPopSim(convertTrajectories(outmcmc))
str(PImcmc, max.level = 3, give.attr = FALSE)
#> List of 2
#> $ summary:'data.frame': 189 obs. of 8 variables:
#> ..$ MetricTypeID : chr [1:189] "N" "N" "N" "N" ...
#> ..$ Year : num [1:189] 1989 2012 1995 1997 2001 ...
#> ..$ PopulationName: chr [1:189] "A" "A" "A" "A" ...
#> ..$ Mean : num [1:189] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ...
#> ..$ lower : Named num [1:189] NA NA NA NA NA NA NA NA NA NA ...
#> ..$ upper : Named num [1:189] NA NA NA NA NA NA NA NA NA NA ...
#> ..$ probViable : num [1:189] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ...
#> ..$ Parameter : chr [1:189] "Female population size" "Female population size" "Female population size" "Female population size" ...
#> $ samples: tibble [567,000 × 7] (S3: tbl_df/tbl/data.frame)
#> ..$ Replicate : chr [1:567000] "x1" "x1" "x1" "x1" ...
#> ..$ LambdaPercentile: logi [1:567000] NA NA NA NA NA NA ...
#> ..$ Year : num [1:567000] 1989 1989 1989 1989 1989 ...
#> ..$ PopulationName : chr [1:567000] "A" "A" "A" "A" ...
#> ..$ Timestep : num [1:567000] 1989 1989 1989 1989 1989 ...
#> ..$ MetricTypeID : chr [1:567000] "c" "survival" "recruitment" "X" ...
#> ..$ Amount : num [1:567000] NA 0.8901 0.1397 0.0699 NA ...
# }