Skip to contents

An implementation of the Ricker reproduction model (Ricker, 1954) with an extension to handle negative reproduction rates.

Usage

ricker_reproduction_model(abundance, reproduction_rate, carrying_capacity)

Arguments

abundance

<numeric> vector (or matrix) of abundances.

reproduction_rate

<numeric> vector (or matrix) of reproduction rates.

carrying_capacity

<numeric> vector (or matrix) of carrying capacities.

Value

<numeric> vector (or matrix) of abundances.

Details

Equations:

If \(reproduction\_rate >= 0\) (Ricker, 1954): $$N_{t+1} = N_t e^{r (1 - \frac{N_t}{K})}$$

If \(reproduction\_rate < 0\): $$N_{t+1} = N_t \cdot e^{r}$$

With:

  • \(N_t\) = abundance at time t

  • \(N_{t+1}\) = abundance at time t+1

  • \(r\) = reproduction rate

  • \(K\) = carrying capacity

Note that:

  • abundance should generally be greater than 0.

  • reproduction_rate and carrying_capacity should either both have the same size as the input abundance or both be of length 1.

  • carrying_capacity should generally be greater than 0. If it is 0 or less, the abundance will be set to 0.

Important Note: To optimize performance, the functions modifies the abundance in-place. This mean the input abundance will be modified (See Examples). Since the result of this function is usually assigned to the same variable as the input abundance, this is unnoticable in most use cases. Should you wish to keep the input abundance unchanged, you can rlang::duplicate() it before passing it to this function.

References

Ricker, W.E. (1954) Stock and recruitment. Journal of the Fisheries Research Board of Canada, 11, 559--623. doi:10.1139/f54-039

Examples

ricker_reproduction_model(
    abundance = 10,
    reproduction_rate = 0.25,
    carrying_capacity = 100
)
#> [1] 12.52323
ricker_reproduction_model(
    abundance = matrix(10, 5, 5),
    reproduction_rate =  0.25,
    carrying_capacity =  100
)
#>          [,1]     [,2]     [,3]     [,4]     [,5]
#> [1,] 12.52323 12.52323 12.52323 12.52323 12.52323
#> [2,] 12.52323 12.52323 12.52323 12.52323 12.52323
#> [3,] 12.52323 12.52323 12.52323 12.52323 12.52323
#> [4,] 12.52323 12.52323 12.52323 12.52323 12.52323
#> [5,] 12.52323 12.52323 12.52323 12.52323 12.52323
ricker_reproduction_model(
    abundance = matrix(10, 5, 5),
    reproduction_rate =  matrix(seq(-0.5, 0.5, length.out = 25), 5, 5),
    carrying_capacity =  matrix(100, 5, 5)
)
#>          [,1]     [,2]      [,3]     [,4]     [,5]
#> [1,] 6.065307 7.470175  9.200444 11.19072 13.49859
#> [2,] 6.323367 7.788008  9.591895 11.61834 14.01440
#> [3,] 6.592406 8.119363 10.000000 12.06230 14.54991
#> [4,] 6.872893 8.464817 10.382120 12.52323 15.10590
#> [5,] 7.165313 8.824969 10.778842 13.00176 15.68312
ricker_reproduction_model(
    abundance = matrix(10, 5, 5),
    reproduction_rate =  matrix(seq(0, -2, length.out = 25), 5, 5),
    carrying_capacity =  matrix(100, 5, 5)
)
#>           [,1]     [,2]     [,3]     [,4]     [,5]
#> [1,] 10.000000 6.592406 4.345982 2.865048 1.888756
#> [2,]  9.200444 6.065307 3.998497 2.635971 1.737739
#> [3,]  8.464817 5.580351 3.678794 2.425211 1.598797
#> [4,]  7.788008 5.134171 3.384654 2.231302 1.470965
#> [5,]  7.165313 4.723666 3.114032 2.052897 1.353353
# Note that the input abundance is modified in-place
abu <- 10
res <- ricker_reproduction_model(
    abundance = abu,
    reproduction_rate = 0.25,
    carrying_capacity = 100
)
stopifnot(identical(abu, res))