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.

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()

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

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.

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

Examples

# sample coefficients for default models
demographicCoefficients(10)
#> $modelVersion
#> [1] "Johnson"
#> 
#> $coefSamples_Survival
#> $coefSamples_Survival$coefSamples
#>        Intercept        Anthro Precision
#>  [1,] -0.1387188 -0.0009290683  61.80253
#>  [2,] -0.1493973 -0.0008246714  50.43310
#>  [3,] -0.1493508 -0.0008507806  67.14570
#>  [4,] -0.1360162 -0.0008482235  53.16386
#>  [5,] -0.1548074 -0.0006730974  67.78854
#>  [6,] -0.1380743 -0.0006664454  67.98665
#>  [7,] -0.1445293 -0.0008225504  61.59226
#>  [8,] -0.1401303 -0.0006745913  36.13509
#>  [9,] -0.1358755 -0.0008726029  72.26056
#> [10,] -0.1525252 -0.0007926568  60.78009
#> 
#> $coefSamples_Survival$coefValues
#>    Intercept Anthro Precision
#>        <num>  <num>     <num>
#> 1:    -0.142 -8e-04  63.43724
#> 
#> $coefSamples_Survival$coefStdErrs
#>      Intercept      Anthro Precision
#>          <num>       <num>     <num>
#> 1: 0.007908163 0.000127551  8.272731
#> 
#> $coefSamples_Survival$quantiles
#>  [1] 0.2361111 0.0250000 0.7638889 0.8694444 0.5527778 0.6583333 0.1305556
#>  [8] 0.3416667 0.9750000 0.4472222
#> 
#> 
#> $coefSamples_Recruitment
#> $coefSamples_Recruitment$coefSamples
#>        Intercept      Anthro fire_excl_anthro Precision
#>  [1,] -1.0676019 -0.01636603     -0.003565336  15.00944
#>  [2,] -1.0075035 -0.01762281     -0.009472650  19.57820
#>  [3,] -1.0745444 -0.01705108     -0.009678861  21.67456
#>  [4,] -1.1082035 -0.01732114     -0.008472820  20.92857
#>  [5,] -0.9450946 -0.01775464     -0.008292270  23.01159
#>  [6,] -1.0935349 -0.01503287     -0.008505202  18.91617
#>  [7,] -1.0701700 -0.01599620     -0.006805805  20.92486
#>  [8,] -0.9905087 -0.01642319     -0.008384758  18.98094
#>  [9,] -1.0261790 -0.01439586     -0.010756236  20.63753
#> [10,] -1.0128508 -0.01715364     -0.009343217  21.55388
#> 
#> $coefSamples_Recruitment$coefValues
#>    Intercept Anthro fire_excl_anthro Precision
#>        <num>  <num>            <num>     <num>
#> 1:    -1.023 -0.017          -0.0081  19.86189
#> 
#> $coefSamples_Recruitment$coefStdErrs
#>     Intercept      Anthro fire_excl_anthro Precision
#>         <num>       <num>            <num>     <num>
#> 1: 0.06122449 0.001530612      0.002040816  2.228655
#> 
#> $coefSamples_Recruitment$quantiles
#>  [1] 0.3416667 0.4472222 0.0250000 0.2361111 0.1305556 0.5527778 0.7638889
#>  [8] 0.8694444 0.9750000 0.6583333
#> 
#> 

# try a different model
demographicCoefficients(10, modelVersion = "Johnson", survivalModelNumber = "M1",
                        recruitmentModelNumber = "M3")
#> $modelVersion
#> [1] "Johnson"
#> 
#> $coefSamples_Survival
#> $coefSamples_Survival$coefSamples
#>        Intercept        Anthro Precision
#>  [1,] -0.1451069 -0.0010573534  48.90999
#>  [2,] -0.1556802 -0.0008470300  63.81923
#>  [3,] -0.1544851 -0.0007619453  58.12682
#>  [4,] -0.1355038 -0.0007660636  54.77499
#>  [5,] -0.1432606 -0.0006326427  77.31063
#>  [6,] -0.1368056 -0.0008732115  67.04086
#>  [7,] -0.1551495 -0.0007252788  60.36668
#>  [8,] -0.1495943 -0.0009003972  67.70864
#>  [9,] -0.1323035 -0.0005147005  67.56973
#> [10,] -0.1342145 -0.0010494387  60.16346
#> 
#> $coefSamples_Survival$coefValues
#>    Intercept Anthro Precision
#>        <num>  <num>     <num>
#> 1:    -0.142 -8e-04  63.43724
#> 
#> $coefSamples_Survival$coefStdErrs
#>      Intercept      Anthro Precision
#>          <num>       <num>     <num>
#> 1: 0.007908163 0.000127551  8.272731
#> 
#> $coefSamples_Survival$quantiles
#>  [1] 0.5527778 0.9750000 0.0250000 0.7638889 0.3416667 0.6583333 0.4472222
#>  [8] 0.1305556 0.2361111 0.8694444
#> 
#> 
#> $coefSamples_Recruitment
#> $coefSamples_Recruitment$coefSamples
#>        Intercept  Total_dist
#>  [1,] -0.8189712 -0.01431127
#>  [2,] -0.9371851 -0.01508319
#>  [3,] -0.9515669 -0.01647889
#>  [4,] -0.9578759 -0.01486034
#>  [5,] -0.9048015 -0.01377088
#>  [6,] -0.9417808 -0.01599317
#>  [7,] -1.0920400 -0.01495092
#>  [8,] -0.8838143 -0.01655897
#>  [9,] -1.0368768 -0.01510686
#> [10,] -1.0173146 -0.01520567
#> 
#> $coefSamples_Recruitment$coefValues
#>    Intercept Total_dist
#>        <num>      <num>
#> 1:    -0.956     -0.015
#> 
#> $coefSamples_Recruitment$coefStdErrs
#>    Intercept  Total_dist
#>        <num>       <num>
#> 1: 0.0619898 0.001530612
#> 
#> $coefSamples_Recruitment$quantiles
#>  [1] 0.9750000 0.1305556 0.3416667 0.6583333 0.7638889 0.8694444 0.5527778
#>  [8] 0.0250000 0.4472222 0.2361111
#> 
#> 

getCoefs(popGrowthTableJohnsonECCC, "femaleSurvival", "Johnson", "M1")
#> $Johnson_M1_National
#>    modelVersion responseVariable ModelNumber     Type Coefficient    Value
#>          <char>           <char>      <char>   <char>      <char>    <num>
#> 1:      Johnson   femaleSurvival          M1 National   Intercept -0.14200
#> 2:      Johnson   femaleSurvival          M1 National      Anthro -0.00080
#> 3:      Johnson   femaleSurvival          M1 National   Precision 63.43724
#>         StdErr lowerCI upperCI
#>          <num>   <num>   <num>
#> 1: 0.007908163  -0.158 -0.1270
#> 2: 0.000127551  -0.001 -0.0005
#> 3: 8.272730950      NA      NA
#> 

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

sampleCoefs(cfs[[1]], 10)
#> $coefSamples
#>        Intercept  Total_dist
#>  [1,] -0.9474866 -0.01588833
#>  [2,] -0.8908662 -0.01812883
#>  [3,] -1.0183984 -0.01326584
#>  [4,] -0.9277904 -0.01541952
#>  [5,] -0.8951066 -0.01550309
#>  [6,] -0.9070331 -0.01342157
#>  [7,] -0.8252706 -0.01502802
#>  [8,] -0.9156091 -0.01418096
#>  [9,] -1.0067393 -0.01578064
#> [10,] -1.0276561 -0.01162038
#> 
#> $coefValues
#>    Intercept Total_dist
#>        <num>      <num>
#> 1:    -0.956     -0.015
#> 
#> $coefStdErrs
#>    Intercept  Total_dist
#>        <num>       <num>
#> 1: 0.0619898 0.001530612
#>