Skip to contents

Produces summary tables for Bayesian caribou population model results.

Usage

compareTrajectories(
  caribouBayesDemogMod,
  startYear = min(caribouBayesDemogMod$inData$disturbanceIn$Year),
  endYear = max(caribouBayesDemogMod$inData$disturbanceIn$Year),
  paramTable = data.frame(param = "observed"),
  exData = NULL,
  simInitial = NULL
)

Arguments

caribouBayesDemogMod

caribou Bayesian demographic model results produced by calling bayesianTrajectoryWorkflow(), trajectoriesFromNational(), trajectoriesFromBayesian(), or trajectoriesFromSummary()

startYear, endYear

year defining the beginning of the observation period and the end of the projection period.

paramTable

data.frame. Optional. Scenario parameters see simulateObservations()

exData

data.frame. Optional. Output of simulateObservations() that records the true population metrics of the population that observations were simulated from.

simInitial

Initial simulation results, produced by calling trajectoriesFromNational(), trajectoriesFromBayesian(), or trajectoriesFromSummary()

Value

a list of tables:

  • rr.summary.all: Mean parameter values for each year and standard deviation, upper and lower credible intervals projected by the Bayesian model, as well as scenario input parameters.

  • sim.all: Mean parameter values and upper and lower credible intervals from the initial model for each year, as well as scenario input parameters.

  • obs.all: Observed parameter values with column "Type" identifying if it is the "true" value of the simulated population or the "observed" value simulated based on the collaring program parameters.

Interpretation of Years

Throughout the package a year is treated as the calendar year only if it is in a table that also contains a month column. In all other contexts year is treated as the caribou year which is the annual demographic cycle of caribou, measured from one calving season to the next. By default, April is set as the start of the caribou year.

Examples

scns <- getScenarioDefaults(projYears = 10, obsYears = 10,
                            obsAnthroSlope = 1, projAnthroSlope = 5,
                            collarCount = 20, cowMult = 5)

simO <- simulateObservations(scns)

out <- bayesianTrajectoryWorkflow(surv_data = simO$simSurvObs, recruit_data = simO$simRecruitObs,
                          disturbance = simO$simDisturbance,
                          niters=10)
#> Warning: Adaptation incomplete
#> NOTE: Stopping adaptation
#> 
#> 
#> Warning: Adaptation incomplete
#> NOTE: Stopping adaptation
#> 
#> 

outTables <- compareTrajectories(out, exData = simO$exData, paramTable = simO$paramTable,
                             simInitial = trajectoriesFromNational())
#> Using saved object
                             
str(outTables, max.level = 2, give.attr = FALSE)
#> List of 3
#>  $ rr.summary.all:'data.frame':	200 obs. of  41 variables:
#>   ..$ Year              : num [1:200] 2014 2014 2014 2014 2014 ...
#>   ..$ MetricTypeID      : chr [1:200] "Xbar" "lambda_bar" "c" "N" ...
#>   ..$ PopulationName    : chr [1:200] "A" "A" "A" "A" ...
#>   ..$ AnthroID          : num [1:200] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ Fire_excl_anthroID: num [1:200] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ Mean              : num [1:200] 0.202 1.001 NaN NaN 0.405 ...
#>   ..$ lower             : Named num [1:200] 0.164 0.913 NA NA 0.329 ...
#>   ..$ upper             : Named num [1:200] 0.249 1.069 NA NA 0.498 ...
#>   ..$ probViable        : num [1:200] 0 0.7 NaN NaN 0 0 0 0 0 0.8 ...
#>   ..$ Metric            : chr [1:200] "Expected adjusted recruitment" "Expected growth rate" "c" "Female population size" ...
#>   ..$ Anthro            : num [1:200] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ Fire_excl_anthro  : num [1:200] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ time              : num [1:200] 1 1 1 1 1 1 1 1 1 1 ...
#>   ..$ Total_dist        : num [1:200] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ collarCount       : num [1:200] 20 20 20 20 20 20 20 20 20 20 ...
#>   ..$ N0                : num [1:200] 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ...
#>   ..$ qMin              : num [1:200] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ qMax              : num [1:200] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ uMin              : num [1:200] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ uMax              : num [1:200] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ zMin              : num [1:200] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ zMax              : num [1:200] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ cowMult           : num [1:200] 5 5 5 5 5 5 5 5 5 5 ...
#>   ..$ correlateRates    : logi [1:200] FALSE FALSE FALSE FALSE FALSE FALSE ...
#>   ..$ rSlopeMod         : num [1:200] 1 1 1 1 1 1 1 1 1 1 ...
#>   ..$ sSlopeMod         : num [1:200] 1 1 1 1 1 1 1 1 1 1 ...
#>   ..$ interannualVar    :List of 200
#>   ..$ iFire             : num [1:200] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ iAnthro           : num [1:200] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ obsAnthroSlope    : num [1:200] 1 1 1 1 1 1 1 1 1 1 ...
#>   ..$ projAnthroSlope   : num [1:200] 5 5 5 5 5 5 5 5 5 5 ...
#>   ..$ hasYear           : logi [1:200] FALSE FALSE FALSE FALSE FALSE FALSE ...
#>   ..$ projYears         : num [1:200] 10 10 10 10 10 10 10 10 10 10 ...
#>   ..$ obsYears          : num [1:200] 10 10 10 10 10 10 10 10 10 10 ...
#>   ..$ preYears          : num [1:200] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ curYear           : num [1:200] 2023 2023 2023 2023 2023 ...
#>   ..$ startYear         : num [1:200] 2014 2014 2014 2014 2014 ...
#>   ..$ ID                : int [1:200] 1 1 1 1 1 1 1 1 1 1 ...
#>   ..$ label             : chr [1:200] "ID1_startYear2014_curYear2023_preYears0_obsYears10_projYears10_hasYearFALSE_projAnthroSlope5_obsAnthroSlope1_iA"| __truncated__ "ID1_startYear2014_curYear2023_preYears0_obsYears10_projYears10_hasYearFALSE_projAnthroSlope5_obsAnthroSlope1_iA"| __truncated__ "ID1_startYear2014_curYear2023_preYears0_obsYears10_projYears10_hasYearFALSE_projAnthroSlope5_obsAnthroSlope1_iA"| __truncated__ "ID1_startYear2014_curYear2023_preYears0_obsYears10_projYears10_hasYearFALSE_projAnthroSlope5_obsAnthroSlope1_iA"| __truncated__ ...
#>   ..$ rQuantile         : logi [1:200] NA NA NA NA NA NA ...
#>   ..$ sQuantile         : logi [1:200] NA NA NA NA NA NA ...
#>  $ sim.all       :'data.frame':	160 obs. of  8 variables:
#>   ..$ MetricTypeID  : chr [1:160] "lambda_bar" "c" "recruitment" "survival" ...
#>   ..$ PopulationName: chr [1:160] "National" "National" "National" "National" ...
#>   ..$ Mean          : num [1:160] 1.034 1 0.336 0.876 1.022 ...
#>   ..$ lower         : Named num [1:160] 0.9011 1 0.0748 0.6947 0.799 ...
#>   ..$ upper         : Named num [1:160] 1.168 1 0.746 0.996 1.273 ...
#>   ..$ probViable    : num [1:160] 0.741 1 0 0.054 0.623 0 0 0 0 0.073 ...
#>   ..$ Metric        : chr [1:160] "Expected growth rate" "c" "Recruitment" "Adult female survival" ...
#>   ..$ Year          : int [1:160] 2014 2014 2014 2014 2014 2014 2014 2014 2015 2015 ...
#>  $ obs.all       :'data.frame':	260 obs. of  37 variables:
#>   ..$ Year            : num [1:260] 2014 2014 2014 2014 2014 ...
#>   ..$ PopulationName  : Factor w/ 1 level "A": 1 1 1 1 1 1 1 1 1 1 ...
#>   ..$ Mean            : num [1:260] 0.6 0.798 0.271 0.543 0 ...
#>   ..$ Metric          : chr [1:260] "Recruitment" "Adult female survival" "Adjusted recruitment" "Recruitment" ...
#>   ..$ MetricTypeID    : chr [1:260] "R" "survival" "X" "recruitment" ...
#>   ..$ Type            : chr [1:260] "observed" "true" "true" "true" ...
#>   ..$ Anthro          : num [1:260] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ Fire_excl_anthro: num [1:260] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ time            : num [1:260] 1 1 1 1 1 1 1 1 1 1 ...
#>   ..$ Total_dist      : num [1:260] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ collarCount     : num [1:260] 20 20 20 20 20 20 20 20 20 20 ...
#>   ..$ N0              : num [1:260] 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ...
#>   ..$ qMin            : num [1:260] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ qMax            : num [1:260] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ uMin            : num [1:260] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ uMax            : num [1:260] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ zMin            : num [1:260] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ zMax            : num [1:260] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ cowMult         : num [1:260] 5 5 5 5 5 5 5 5 5 5 ...
#>   ..$ correlateRates  : logi [1:260] FALSE FALSE FALSE FALSE FALSE FALSE ...
#>   ..$ rSlopeMod       : num [1:260] 1 1 1 1 1 1 1 1 1 1 ...
#>   ..$ sSlopeMod       : num [1:260] 1 1 1 1 1 1 1 1 1 1 ...
#>   ..$ interannualVar  :List of 260
#>   ..$ iFire           : num [1:260] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ iAnthro         : num [1:260] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ obsAnthroSlope  : num [1:260] 1 1 1 1 1 1 1 1 1 1 ...
#>   ..$ projAnthroSlope : num [1:260] 5 5 5 5 5 5 5 5 5 5 ...
#>   ..$ hasYear         : logi [1:260] FALSE FALSE FALSE FALSE FALSE FALSE ...
#>   ..$ projYears       : num [1:260] 10 10 10 10 10 10 10 10 10 10 ...
#>   ..$ obsYears        : num [1:260] 10 10 10 10 10 10 10 10 10 10 ...
#>   ..$ preYears        : num [1:260] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ curYear         : num [1:260] 2023 2023 2023 2023 2023 ...
#>   ..$ startYear       : num [1:260] 2014 2014 2014 2014 2014 ...
#>   ..$ ID              : int [1:260] 1 1 1 1 1 1 1 1 1 1 ...
#>   ..$ label           : chr [1:260] "ID1_startYear2014_curYear2023_preYears0_obsYears10_projYears10_hasYearFALSE_projAnthroSlope5_obsAnthroSlope1_iA"| __truncated__ "ID1_startYear2014_curYear2023_preYears0_obsYears10_projYears10_hasYearFALSE_projAnthroSlope5_obsAnthroSlope1_iA"| __truncated__ "ID1_startYear2014_curYear2023_preYears0_obsYears10_projYears10_hasYearFALSE_projAnthroSlope5_obsAnthroSlope1_iA"| __truncated__ "ID1_startYear2014_curYear2023_preYears0_obsYears10_projYears10_hasYearFALSE_projAnthroSlope5_obsAnthroSlope1_iA"| __truncated__ ...
#>   ..$ rQuantile       : logi [1:260] NA NA NA NA NA NA ...
#>   ..$ sQuantile       : logi [1:260] NA NA NA NA NA NA ...