View source: R/project_parallel.r
project_parallel | R Documentation |
Run parallel stochastic population projections. Non-Windows systems only.
project_parallel(years, runs, initial_population, survival, litter, cores)
years |
Number of years to project the population. |
runs |
Number of times (or Monte Carlo runs) to project the population. |
initial_population |
Vector of initial number of individuals for each class. This vector must contain only positive integers. |
survival |
Matrix of survival for each class, with nrow = number of classes and ncol = 2. The first column is the median value of the survival of each class. The second column is the standard deviation of the survival of each class. |
litter |
Matrix of litter size for each class, with nrow = number of classes and ncol = 2. The first column is the median value of the litter size of each class. The second column is the standard deviation of the litter size of each class. |
cores |
(optional) number of cores to use for the parallel projections. If missing, it is set to the value returned by get_cores(). |
Run parallel stochastic population projections with an Individual-Based Model (IBM) compiled in C.
runs |
a 3-dimensional array of numbers of individuals with dimension c(years, classes, runs) |
years <- 10 runs <- 100 init.pop <- c(30, 20, 15, 12, 10, 9, 8, 7, 6, 5) surv.md <- c(0.5, 0.7, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9) surv.sd <- c(0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1) surv.msd <- cbind(surv.md, surv.sd) litter.md <- c(0.2, 1.1, 2.8, 2.8, 2.8, 2.8, 2.8, 2.8, 1.8, 0.2) litter.sd <- c(0.1, 0.2, 0.15, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1) litter.msd <- cbind(litter.md, litter.sd) nclass <- 4 # vary number of classes # with 2 cores projection <- project_parallel( years = years, runs = runs, initial_population = init.pop[1:nclass], survival = surv.msd[1:nclass,], litter = litter.msd[1:nclass,], cores = 2 ) # with all possible cores (not run) # projection <- project_parallel( # years = years, # runs = runs, # initial_population = init.pop[1:nclass], # survival = surv.msd[1:nclass,], # litter = litter.msd[1:nclass,] # )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.