Skip to contents

Define scenarios in a table and simulateObservations(), run the caribouBayesianPM() model and getOutputTables() for each scenario.

Usage

runScnSet(
  scns,
  simInitial,
  ePars = list(collarOnTime = 4, collarOffTime = 4, collarNumYears = 4),
  Rep = NULL,
  printProgress = FALSE,
  priors = "default",
  niters = formals(bboutools::bb_fit_survival)$niters,
  nthin = formals(bboutools::bb_fit_survival)$nthin,
  returnSamples = F,
  ...
)

Arguments

scns

data.frame. Parameters for the simulations. See getScenarioDefaults() for details.

simInitial

Initial simulation results, produced by calling getSimsInitial()

ePars

list. Additional parameters passed on to simulateObservations()

Rep

integer. Optional. If specified, select specified replicate trajectory.

printProgress

logical. Should the scenario number and parameters be printed at each step?

priors

a list of model priors. If disturbance is NA, this should be list(priors_survival=c(...),priors_recruitment=c(...)); see bboutools::bb_priors_survival and bboutools::bb_priors_recruitment for details. If disturbance is not NA, see getPriors() for details.

niters

A whole number of the number of iterations per chain after thinning and burn-in.

nthin

integer. The number of the thinning rate.

returnSamples

logical. Optional. If true, return full results from caribouBayesianPM().

Value

A list similar to getOutputTables() where tables for each scenario have been appended together. Plus an error log for any scenarios that failed to run.

Examples

scns <- expand.grid(
  obsYears =c(10, 20), collarCount = c(30, 300), cowMult = 2, collarInterval = 2,
  iAnthro = 0,
  obsAnthroSlope = 0, projAnthroSlope = 0, sQuantile = 0.9,
  rQuantile = 0.7, N0 = 1000
)

eParsIn <- list(collarOnTime = 4, collarOffTime = 4, collarNumYears = 3)
simsIn <- getSimsInitial()
#> Using saved object
scResults <- runScnSet(scns, simsIn, eParsIn,
                       niters = 10)# only set to speed up example. Normally keep defaults.
#> Compiling model graph
#>    Resolving undeclared variables
#>    Allocating nodes
#> Graph information:
#>    Observed stochastic nodes: 8
#>    Unobserved stochastic nodes: 85
#>    Total graph size: 409
#> 
#> Initializing model
#> 
#> Compiling model graph
#>    Resolving undeclared variables
#>    Allocating nodes
#> Graph information:
#>    Observed stochastic nodes: 52
#>    Unobserved stochastic nodes: 172
#>    Total graph size: 666
#> 
#> Initializing model
#> 
#> Compiling model graph
#>    Resolving undeclared variables
#>    Allocating nodes
#> Graph information:
#>    Observed stochastic nodes: 20
#>    Unobserved stochastic nodes: 93
#>    Total graph size: 489
#> 
#> Initializing model
#> 
#> Compiling model graph
#>    Resolving undeclared variables
#>    Allocating nodes
#> Graph information:
#>    Observed stochastic nodes: 74
#>    Unobserved stochastic nodes: 200
#>    Total graph size: 806
#> 
#> Initializing model
#> 
#> Compiling model graph
#>    Resolving undeclared variables
#>    Allocating nodes
#> Graph information:
#>    Observed stochastic nodes: 10
#>    Unobserved stochastic nodes: 83
#>    Total graph size: 409
#> 
#> Initializing model
#> 
#> Compiling model graph
#>    Resolving undeclared variables
#>    Allocating nodes
#> Graph information:
#>    Observed stochastic nodes: 54
#>    Unobserved stochastic nodes: 170
#>    Total graph size: 666
#> 
#> Initializing model
#> 
#> Compiling model graph
#>    Resolving undeclared variables
#>    Allocating nodes
#> Graph information:
#>    Observed stochastic nodes: 20
#>    Unobserved stochastic nodes: 93
#>    Total graph size: 489
#> 
#> Initializing model
#> 
#> Compiling model graph
#>    Resolving undeclared variables
#>    Allocating nodes
#> Graph information:
#>    Observed stochastic nodes: 74
#>    Unobserved stochastic nodes: 200
#>    Total graph size: 806
#> 
#> Initializing model
#>