| Title: | Models for Simulating Lion Populations |
|---|---|
| Description: | Simulate the dynamic of lion populations using a specific Individual-Based Model (IBM) compiled in C. |
| Authors: | Guillaume Chapron [aut, cre], Matthew Wijers [ctb], Andrew Loveridge [ctb], David Macdonald [ctb] |
| Maintainer: | Guillaume Chapron <[email protected]> |
| License: | GPL-3 |
| Version: | 1.0.1 |
| Built: | 2026-06-07 09:48:13 UTC |
| Source: | https://github.com/cran/pop.lion |
A package to run simulations of lion populations using an Individual-Based Model compiled in C.
| Package: | pop.lion |
| Type: | Package |
| Version: | 0.2 |
| Date: | 2020-04-28 |
| License: | GPL-3 |
Guillaume Chapron <[email protected]> with contributions from Matthew Wijers, Andrew Loveridge and David Macdonald.
Plot population projections
plot_projection(projection, title)plot_projection(projection, title)
projection |
A list obtained after running the function |
title |
A string indicating which variable should be plotted
|
Plot average projections with 95% confidence interval.
No returned value, plot created
oldpar <- par(mfrow = c(1,1)) years = 25 survival <- matrix(1, nrow=180, ncol=2) survival[1:12, 1:2] <- 0.97^(1/12) survival[13:24, 1:2] <- 0.98^(1/12) survival[25:96, 1:2] <- 0.99^(1/12) survival[97:108, 1:2] <- 0.98^(1/12) survival[109:120, 1:2] <- 0.96^(1/12) survival[121:132, 1:2] <- 0.94^(1/12) survival[133:144, 1:2] <- 0.92^(1/12) survival[145:156, 1:2] <- 0.90^(1/12) survival[157:168, 1:2] <- 0.87^(1/12) survival[169:180, 1:2] <- 0.83^(1/12) litter_distribution <- c(0.10, 0.30, 0.35, 0.20, 0.05) conflict_age <- array(4*12, dim=c(2), dimnames=list(c("female", "male"))) conflict_mortality <- array(0, dim=c(12*years, 2), dimnames=list(NULL, c("female", "male"))) conflict_mortality[24:36,] <- 15.2 hunting_age <- array(5*12, dim=c(2), dimnames=list(c("female", "male"))) hunting_mortality <- array(0, dim=c(12*years, 2), dimnames=list(NULL, c("female", "male"))) hunting_mortality[72:84,"male"] <- 10 projection <- project( years = years, runs = 100, survival = survival, litter_distribution = litter_distribution, pop_initial = 5, conflict_age = conflict_age, conflict_mortality = conflict_mortality, hunting_age = hunting_age, hunting_mortality = hunting_mortality, hunter_error = 0, K_indiv = 400, K_pride = 20, K_coali = 20, K_edged = 10, seed = 1, details = FALSE ) par(mfrow=c(2,2)) plot_projection(projection, "NINDIV") plot_projection(projection, "NPRIDES") plot_projection(projection, "NCOALIS") plot_projection(projection, "LITTERS") par(oldpar)oldpar <- par(mfrow = c(1,1)) years = 25 survival <- matrix(1, nrow=180, ncol=2) survival[1:12, 1:2] <- 0.97^(1/12) survival[13:24, 1:2] <- 0.98^(1/12) survival[25:96, 1:2] <- 0.99^(1/12) survival[97:108, 1:2] <- 0.98^(1/12) survival[109:120, 1:2] <- 0.96^(1/12) survival[121:132, 1:2] <- 0.94^(1/12) survival[133:144, 1:2] <- 0.92^(1/12) survival[145:156, 1:2] <- 0.90^(1/12) survival[157:168, 1:2] <- 0.87^(1/12) survival[169:180, 1:2] <- 0.83^(1/12) litter_distribution <- c(0.10, 0.30, 0.35, 0.20, 0.05) conflict_age <- array(4*12, dim=c(2), dimnames=list(c("female", "male"))) conflict_mortality <- array(0, dim=c(12*years, 2), dimnames=list(NULL, c("female", "male"))) conflict_mortality[24:36,] <- 15.2 hunting_age <- array(5*12, dim=c(2), dimnames=list(c("female", "male"))) hunting_mortality <- array(0, dim=c(12*years, 2), dimnames=list(NULL, c("female", "male"))) hunting_mortality[72:84,"male"] <- 10 projection <- project( years = years, runs = 100, survival = survival, litter_distribution = litter_distribution, pop_initial = 5, conflict_age = conflict_age, conflict_mortality = conflict_mortality, hunting_age = hunting_age, hunting_mortality = hunting_mortality, hunter_error = 0, K_indiv = 400, K_pride = 20, K_coali = 20, K_edged = 10, seed = 1, details = FALSE ) par(mfrow=c(2,2)) plot_projection(projection, "NINDIV") plot_projection(projection, "NPRIDES") plot_projection(projection, "NCOALIS") plot_projection(projection, "LITTERS") par(oldpar)
Run stochastic lion population projections.
project(years, runs, survival, litter_distribution, pop_initial, conflict_age, conflict_mortality, hunting_age, hunting_mortality, hunter_error, K_indiv, K_pride, K_coali, K_edged, seed, details)project(years, runs, survival, litter_distribution, pop_initial, conflict_age, conflict_mortality, hunting_age, hunting_mortality, hunter_error, K_indiv, K_pride, K_coali, K_edged, seed, details)
years |
A number: number of years to simulate the population. |
runs |
A number: number of times (or Monte Carlo runs) to simulate the population. |
survival |
A matrix: average monthly survival for each sex. |
litter_distribution |
A vector: probability distribution of litter sizes (1-5 cubs) in the population. |
pop_initial |
A number: number of prides (and coalitions). A simulation starts with an equal number of prides and coalitions. |
conflict_age |
A vector: the minimum age in months at which lions can be killed by conflict for females and males. |
conflict_mortality |
An array: mortality added at the edge by conflict for every month of the simulation and for females and males. Expressed in percentage, a value of 15.2 will be understood by the model as 15.2 per cent. Values can be double. The array has 12 * years rows. |
hunting_age |
A vector: the minimum age in months at which lions can be killed by trophy hunting for females and males. |
hunting_mortality |
An array: mortality added at the edge by trophy hunting for every month of the simulation and for females and males. Expressed in number of individuals, a value of 15 will be understood by the model as 15 killed every month. A value of 0.5 will be understood as 6 lions killed per year. The array has 12 * years rows. |
hunter_error |
A number: hunter error. |
K_indiv |
A number: maximum number of individuals in the population. |
K_pride |
A number: maximum number of prides in the population. |
K_coali |
A number: maximum number of coalitions in the population. |
K_edged |
A number: number of prides in the population that are located at the edge of the reserve and therefore vulnerabe to hunting and poaching. |
seed |
(optional) A number: seed of the random number generator. |
details |
(optional) A boolean: indicate whether individual events are exported. This can generate large simulation objects. |
Run stochastic lion population projections with an Individual-Based Model (IBM) compiled in C.
runs |
a 3-dimensional array of numbers of individuals with dimension c(years, statistics, runs) |
individuals |
a 2-dimensional array of individuals events |
parameters |
a list of parameters of the projection |
years = 25 survival <- matrix(1, nrow=180, ncol=2) survival[1:12, 1:2] <- 0.97^(1/12) survival[13:24, 1:2] <- 0.98^(1/12) survival[25:96, 1:2] <- 0.99^(1/12) survival[97:108, 1:2] <- 0.98^(1/12) survival[109:120, 1:2] <- 0.96^(1/12) survival[121:132, 1:2] <- 0.94^(1/12) survival[133:144, 1:2] <- 0.92^(1/12) survival[145:156, 1:2] <- 0.90^(1/12) survival[157:168, 1:2] <- 0.87^(1/12) survival[169:180, 1:2] <- 0.83^(1/12) litter_distribution <- c(0.10, 0.30, 0.35, 0.20, 0.05) conflict_age <- array(4*12, dim=c(2), dimnames=list(c("female", "male"))) conflict_mortality <- array(0, dim=c(12*years, 2), dimnames=list(NULL, c("female", "male"))) conflict_mortality[24:36,] <- 15.2 hunting_age <- array(5*12, dim=c(2), dimnames=list(c("female", "male"))) hunting_mortality <- array(0, dim=c(12*years, 2), dimnames=list(NULL, c("female", "male"))) hunting_mortality[72:84,"male"] <- 10 projection <- project( years = years, runs = 100, survival = survival, litter_distribution = litter_distribution, pop_initial = 5, conflict_age = conflict_age, conflict_mortality = conflict_mortality, hunting_age = hunting_age, hunting_mortality = hunting_mortality, hunter_error = 0, K_indiv = 400, K_pride = 20, K_coali = 20, K_edged = 10, seed = 1, details = FALSE ) # Population size at the end of the simulation: apply(projection$runs[,"NINDIV",], 1, mean)[12*years+1]years = 25 survival <- matrix(1, nrow=180, ncol=2) survival[1:12, 1:2] <- 0.97^(1/12) survival[13:24, 1:2] <- 0.98^(1/12) survival[25:96, 1:2] <- 0.99^(1/12) survival[97:108, 1:2] <- 0.98^(1/12) survival[109:120, 1:2] <- 0.96^(1/12) survival[121:132, 1:2] <- 0.94^(1/12) survival[133:144, 1:2] <- 0.92^(1/12) survival[145:156, 1:2] <- 0.90^(1/12) survival[157:168, 1:2] <- 0.87^(1/12) survival[169:180, 1:2] <- 0.83^(1/12) litter_distribution <- c(0.10, 0.30, 0.35, 0.20, 0.05) conflict_age <- array(4*12, dim=c(2), dimnames=list(c("female", "male"))) conflict_mortality <- array(0, dim=c(12*years, 2), dimnames=list(NULL, c("female", "male"))) conflict_mortality[24:36,] <- 15.2 hunting_age <- array(5*12, dim=c(2), dimnames=list(c("female", "male"))) hunting_mortality <- array(0, dim=c(12*years, 2), dimnames=list(NULL, c("female", "male"))) hunting_mortality[72:84,"male"] <- 10 projection <- project( years = years, runs = 100, survival = survival, litter_distribution = litter_distribution, pop_initial = 5, conflict_age = conflict_age, conflict_mortality = conflict_mortality, hunting_age = hunting_age, hunting_mortality = hunting_mortality, hunter_error = 0, K_indiv = 400, K_pride = 20, K_coali = 20, K_edged = 10, seed = 1, details = FALSE ) # Population size at the end of the simulation: apply(projection$runs[,"NINDIV",], 1, mean)[12*years+1]