demographicCoefficients: Sample demographic regression model coefficients

View source: R/demographicCoefficients.R

demographicCoefficientsR Documentation

Sample demographic regression model coefficients

Description

Select the regression coefficient values and standard errors for the desired model version (see popGrowthTableJohnsonECCC for options) and then sample from the Gaussian distribution for each replicate population. demographicCoefficients is a wrapper around getCoefs(), which selects coefficients and sampleCoefs(), which samples coefficients, for both the survival and recruitment models.

Usage

demographicCoefficients(
  replicates,
  modelVersion = "Johnson",
  survivalModelNumber = "M1",
  recruitmentModelNumber = "M4",
  useQuantiles = TRUE,
  populationGrowthTable = popGrowthTableJohnsonECCC
)

getCoefs(populationGrowthTable, resVar, modelVersion, modNum)

sampleCoefs(coefTable, replicates)

Arguments

replicates

integer. Number of replicate populations.

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.

survivalModelNumber, recruitmentModelNumber

character. Which model number to use see popGrowthTableJohnsonECCC for options.

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. If useQuantiles != FALSE, each replicate population is assigned to a quantile of the distribution of variation around the expected values, and remains in that quantile as covariates change. If useQuantiles = TRUE, replicate populations will be assigned to quantiles in the default range of 0.025 and 0.975.

populationGrowthTable

data.frame.popGrowthTableJohnsonECCC is included in the package and should be used in most cases. A custom table of model coefficients and standard errors or confidence intervals can be provided but it must match the column names of popGrowthTableJohnsonECCC. If the table does not contain the standard error it is calculated from the confidence interval.

resVar

character. Response variable, typically "femaleSurvival" or "recruitment"

modNum

character vector. Which model number(s) to use see popGrowthTableJohnsonECCC for typical options.

coefTable

data.table. Table must have columns "Coefficient" for the name of the coefficient, "Value" for the value of the coefficient and "StdErr" for the standard error of coefficients. Typically created with getCoefs()

Details

Each population is optionally assigned to quantiles of the 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. See demographicRates() for more details.

Value

For demographicCoefficients a list with elements:

  • "modelVersion": The name of the model version

  • "coefSamples_Survival" and"coefSamples_Recruitment": lists with elements:

    • "coefSamples": Bootstrapped coefficients with replicates rows

    • "coefValues": Coefficient values taken from populationGrowthTable

    • "quantiles": A vector of randomly selected quantiles between 0.025 and 0.975 with length replicates

For getCoefs: a named list with one element per model version. The names are modelVersion_modNum_Type. Each element contains a data.frame that is a subset of populationGrowthTable for the selected model

For sampleCoefs a list with elements:

  • "coefSamples": Bootstrapped coefficients with replicates rows

  • "coefValues": Coefficient values taken from populationGrowthTable

References

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

See Also

Caribou demography functions: caribouBayesianIPM(), caribouPopGrowth(), compositionBiasCorrection(), demographicProjectionApp(), demographicRates(), getOutputTables(), getPriors(), getScenarioDefaults(), getSimsNational(), plotRes(), popGrowthTableJohnsonECCC, runScnSet(), simulateObservations()

Examples

# sample coefficients for default models
demographicCoefficients(10)

# try a different model
demographicCoefficients(10, modelVersion = "Johnson", survivalModelNumber = "M1",
                        recruitmentModelNumber = "M3")

getCoefs(popGrowthTableJohnsonECCC, "femaleSurvival", "Johnson", "M1")

cfs <- getCoefs(popGrowthTableJohnsonECCC, "recruitment", "Johnson", "M3")

sampleCoefs(cfs[[1]], 10)


LandSciTech/caribouMetrics documentation built on Feb. 3, 2024, 9:41 p.m.