View source: R/population_transitions.R
| population_transitions | R Documentation | 
Modular functions for the population simulator for performing staged-based (Leslie/Lefkovitch matrix) transitions via 3D survival and fecundity arrays.
population_transitions(
  populations,
  demographic_stochasticity,
  fecundity_matrix,
  fecundity_max,
  survival_matrix
)
| populations | Number of populations. | 
| demographic_stochasticity | Boolean for choosing demographic stochasticity for transitions. | 
| fecundity_matrix | Matrix of transition fecundity rates (Leslie/Lefkovitch matrix with non-zero fecundities only). | 
| fecundity_max | Maximum transition fecundity rate (in Leslie/Lefkovitch matrix). | 
| survival_matrix | Matrix of transition survival rates (Leslie/Lefkovitch matrix with non-zero survivals only). | 
Transition calculation function: function(fecundity_array, survival_array, stage_abundance, occupied_indices), where:
fecundity_array3D array of fecundity rates (stages rows by stages columns by populations deep).
survival_array3D array of survival rates (stages rows by stages columns by populations deep).
stage_abundanceMatrix of stage abundances for each population at time step (stages rows by populations columns).
occupied_indicesArray of indices for those populations occupied.
returnsTransitioned stage abundances.
# Deterministic transition (no stochasticity)
fecundity_matrix <- array(c(0, 0, 0, 3, 0, 0, 4, 0, 0), c(3, 3))
survival_matrix <- array(c(0, 0.5, 0, 0, 0, 0.7, 0, 0, 0.8), c(3, 3))
variation_array <- array(rep(seq(0.85, 1.15, 0.05), each = 9), c(3, 3, 7))
fecundity_array <- array(fecundity_matrix, c(3, 3, 7)) * variation_array
survival_array <- array(survival_matrix, c(3, 3, 7)) * variation_array
stage_abundance <- matrix(c(
  7, 13, 0, 26, 0, 39, 47,
  2, 0, 6, 8, 0, 12, 13,
 0, 3, 4, 6, 0, 9, 10
), nrow = 3, ncol = 7, byrow = TRUE)
occupied_indices <- (1:7)[-5]
transition_function <- population_transitions(
  populations = 7, demographic_stochasticity = FALSE,
  fecundity_matrix = fecundity_matrix, fecundity_max = NULL,
  survival_matrix = survival_matrix
)
transition_function(fecundity_array, survival_array, stage_abundance, 
                    occupied_indices)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.