Applies stochastic variation to initial population size estimates (N0).
If uncertainty columns are present, a new value of N0 is sampled for each
row. When N.sd is provided, variation is sampled from either a Poisson
distribution (if N.sd = sqrt(N0)) or a truncated Normal distribution. When
N.lower and N.upper are provided, variation is sampled from a Uniform
distribution bounded by those values. Sampled values are rounded to
integers and constrained to any specified lower and upper bounds.
Arguments
- popInfo
numeric, list, or data.frame. Initial population size information. Must contain an
N0column or value. Optional columnsN.sd,N.lower, andN.upperspecify uncertainty in abundance estimates.- forceDataFrame
logical. If
TRUEand the result is numeric, return a data frame with columnN0. DefaultFALSE.
Value
A modified version of popInfo with updated N0 values. If no
uncertainty columns are present, the input is returned unchanged.
Details
This function is intended to be called at the same stage of simulation and
projection workflows as compositionBiasCorrection() so that uncertainty in
abundance estimates is propagated through subsequent analyses.
See also
Caribou demography functions:
bayesianScenariosWorkflow(),
bayesianTrajectoryWorkflow(),
betaNationalPriors(),
caribouPopGrowth(),
compareTrajectories(),
compositionBiasCorrection(),
convertTrajectories(),
dataFromSheets(),
demographicProjectionApp(),
estimateBayesianRates(),
estimateNationalRate(),
getNationalCoefficients(),
getScenarioDefaults(),
plotCompareTrajectories(),
plotSurvivalSeries(),
plotTrajectories(),
popGrowthTableJohnsonECCC,
simulateObservations(),
trajectoriesFromBayesian(),
trajectoriesFromNational(),
trajectoriesFromSummary(),
trajectoriesFromSummaryForApp()
Examples
addN0Variation(500)
#> [1] 500
addN0Variation(data.frame(PopulationName = rep("A", 10),
N0 = 500, N.sd = 50))
#> PopulationName N0
#> 1 A 430
#> 2 A 513
#> 3 A 378
#> 4 A 500
#> 5 A 531
#> 6 A 557
#> 7 A 409
#> 8 A 488
#> 9 A 488
#> 10 A 486
addN0Variation(data.frame(PopulationName = rep("A", 10),
N0 = 500,
N.lower = 400,
N.upper = 600))
#> PopulationName N0
#> 1 A 458
#> 2 A 536
#> 3 A 547
#> 4 A 439
#> 5 A 596
#> 6 A 548
#> 7 A 410
#> 8 A 506
#> 9 A 539
#> 10 A 538