Skip to contents

Simulate growth of a (st)age-structured population

Usage

run_structured_population_simulation(
  leslie_mat = matrix(c(0, 8, 1, 1, 0.4, 0, 0, 0, 0, 0.8, 0, 0, 0, 0, 0.1, 0), ncol = 4,
    byrow = TRUE),
  init = c(10, 10, 10, 10),
  time = 100
)

Arguments

leslie_mat

A leslie matrix

init

A vector of initial abundances in each (st)age

time

Length of time over which to run the simulation

Value

Returns a matrix with nrow = nrow(leslie_mat) and ncol = time

See also

plot_structured_population_size(), plot_structured_population_agedist(), and plot_structured_population_lambda() for plotting different aspects of the population trajectory, and plot_leslie_diagram() for plotting an transition diagram based on the specified Leslie matrix

Examples

leslie_matrix <- matrix(c(0, 8,1, 1, 0.4,0,0,0,0,0.8,0,0,0,0,0.1,0),
ncol = 4, byrow = TRUE)
structured_pop_init <- c(10,10,10,10)
structured_pop_time <- 5
run_structured_population_simulation(leslie_mat = leslie_matrix, init =
structured_pop_init, time = structured_pop_time)
#>       [,1] [,2] [,3] [,4] [,5] [,6]
#> Age 1   10  100   41  323  160 1047
#> Age 2   10    4   40   16  129   64
#> Age 3   10    8    3   32   12  103
#> Age 4   10    1    0    0    3    1