| Title: | Demographic Vulnerability Metrics for Matrix Population Models |
|---|---|
| Description: | Simulates temporally structured perturbations in matrix population models and computes population reduction and integrated demographic vulnerability across perturbation regimes. Perturbations can be applied to adult survival, juvenile survival, fecundity, all demographic entries, or user-defined matrix elements. The package provides tools to simulate individual perturbation trajectories, evaluate perturbation grids, and summarize demographic vulnerability in structured populations. |
| Authors: | Àlex Giménez-Romero [aut, cre] (ORCID: <https://orcid.org/0000-0003-2796-6801>), Meritxell Genovart [aut] (ORCID: <https://orcid.org/0000-0003-2919-1288>) |
| Maintainer: | Àlex Giménez-Romero <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-05-28 18:10:19 UTC |
| Source: | https://github.com/cran/demovuln |
Apply a proportional perturbation to a projection matrix
apply_perturbation( model, target, magnitude, survival_affects_fecundity = TRUE, custom_mask = NULL )apply_perturbation( model, target, magnitude, survival_affects_fecundity = TRUE, custom_mask = NULL )
model |
A |
target |
One of |
magnitude |
Proportional reduction applied to the selected entries.
Must lie in |
survival_affects_fecundity |
Logical. If |
custom_mask |
Optional logical matrix used when |
Perturbed projection matrix.
Return a logical matrix selecting the entries affected by a perturbation.
build_target_mask( model, target, survival_affects_fecundity = TRUE, custom_mask = NULL )build_target_mask( model, target, survival_affects_fecundity = TRUE, custom_mask = NULL )
model |
A |
target |
One of |
survival_affects_fecundity |
Logical. If |
custom_mask |
Optional logical matrix used when |
Logical matrix with the same dimensions as the projection matrix.
Compute integrated demographic vulnerability
compute_vulnerability(table, column = "population_reduction")compute_vulnerability(table, column = "population_reduction")
table |
Data frame returned by |
column |
Name of the column containing percent population reduction. |
Mean percent population reduction, ignoring missing values.
Dominant eigenvalue of a projection matrix
dominant_eigenvalue(A)dominant_eigenvalue(A)
A |
Numeric square projection matrix. |
The real part of the eigenvalue with largest modulus.
Enumerate perturbation-grid scenarios
grid_scenarios(grid, skip_infeasible = TRUE)grid_scenarios(grid, skip_infeasible = TRUE)
grid |
A |
skip_infeasible |
Logical. If |
Data frame with columns magnitude, duration, period, and
feasible.
Create a matrix population model and define the demographic targets used by perturbation functions.
matrix_population_model( A, fecundity_mask = NULL, fecundity_rows = 1L, adult_stages = NULL, juvenile_stages = NULL, name = NULL )matrix_population_model( A, fecundity_mask = NULL, fecundity_rows = 1L, adult_stages = NULL, juvenile_stages = NULL, name = NULL )
A |
Numeric square projection matrix. Columns are source stages at time
|
fecundity_mask |
Optional logical matrix with the same dimensions as |
fecundity_rows |
Integer vector identifying rows interpreted as newborn or reproductive-output rows. Defaults to the first row. |
adult_stages |
Optional integer vector with source-stage columns interpreted as adult or reproductive stages. |
juvenile_stages |
Optional integer vector with source-stage columns interpreted as juvenile or pre-reproductive stages. |
name |
Optional model or species label. |
An object of class demovuln_model.
Perturbation grid
perturbation_grid(magnitudes, durations, periods)perturbation_grid(magnitudes, durations, periods)
magnitudes |
Numeric vector of proportional reductions. |
durations |
Integer vector of perturbation durations. |
periods |
Integer vector of perturbation periods. |
An object of class demovuln_grid.
Build a perturbation grid from frequencies
perturbation_grid_from_frequencies( magnitudes, durations, frequencies, generation_time = 1, rounding = c("nearest", "floor", "ceil") )perturbation_grid_from_frequencies( magnitudes, durations, frequencies, generation_time = 1, rounding = c("nearest", "floor", "ceil") )
magnitudes |
Numeric vector of proportional reductions. |
durations |
Integer vector of perturbation durations. |
frequencies |
Numeric vector of event frequencies, interpreted as events
per |
generation_time |
Number of projection intervals corresponding to one reference generation or time unit. |
rounding |
One of |
An object of class demovuln_grid.
Compute percent population reduction
population_reduction(final_population, baseline_final_population)population_reduction(final_population, baseline_final_population)
final_population |
Final population size under perturbed dynamics. |
baseline_final_population |
Final population size under unperturbed baseline dynamics. |
Percent population reduction relative to the baseline.
Simulate a perturbation grid
run_grid( model, target, grid, t_max, recovery_steps = 0L, start = 0L, initial_state = NULL, normalize_by_lambda = TRUE, survival_affects_fecundity = TRUE, custom_mask = NULL, return_trajectories = FALSE, skip_infeasible = TRUE, force_during_recovery = FALSE )run_grid( model, target, grid, t_max, recovery_steps = 0L, start = 0L, initial_state = NULL, normalize_by_lambda = TRUE, survival_affects_fecundity = TRUE, custom_mask = NULL, return_trajectories = FALSE, skip_infeasible = TRUE, force_during_recovery = FALSE )
model |
A |
target |
One of |
grid |
A |
t_max |
Number of projection intervals in the perturbation-forcing window. |
recovery_steps |
Number of additional unperturbed projection intervals. |
start |
Projection interval at which the first perturbation event starts. |
initial_state |
Optional initial population vector. |
normalize_by_lambda |
Logical. If |
survival_affects_fecundity |
Logical. If |
custom_mask |
Optional logical matrix used when |
return_trajectories |
Logical. If |
skip_infeasible |
Logical. If |
force_during_recovery |
Logical. If |
An object of class demovuln_grid_result.
Simulate dynamics under a temporally structured perturbation
simulate_dynamics( model, target = "adult_survival", magnitude, duration, period, t_max, recovery_steps = 0L, start = 0L, initial_state = NULL, normalize_by_lambda = TRUE, survival_affects_fecundity = TRUE, custom_mask = NULL, return_stage_vectors = FALSE, force_during_recovery = FALSE )simulate_dynamics( model, target = "adult_survival", magnitude, duration, period, t_max, recovery_steps = 0L, start = 0L, initial_state = NULL, normalize_by_lambda = TRUE, survival_affects_fecundity = TRUE, custom_mask = NULL, return_stage_vectors = FALSE, force_during_recovery = FALSE )
model |
A |
target |
One of |
magnitude |
Proportional reduction applied to the selected entries. |
duration |
Number of consecutive projection intervals during which each perturbation event is active. |
period |
Number of projection intervals between perturbation onsets. |
t_max |
Number of projection intervals in the perturbation-forcing window. |
recovery_steps |
Number of additional unperturbed projection intervals after the forcing window. |
start |
Projection interval at which the first perturbation event starts.
The default |
initial_state |
Optional initial population vector. If omitted, the stable stage distribution of the unperturbed model is used. |
normalize_by_lambda |
Logical. If |
survival_affects_fecundity |
Logical. If |
custom_mask |
Optional logical matrix used when |
return_stage_vectors |
Logical. If |
force_during_recovery |
Logical. If |
An object of class demovuln_simulation.
Stable stage distribution
stable_stage_distribution(model)stable_stage_distribution(model)
model |
A |
Numeric vector normalized to sum to one.