Learn R Programming

mptools (version 1.0.1)

results: Extract simulation results from RAMAS Metapop .mp files

Description

Extract population size simulation results (mean, sd, min and max), including expected minimum abundance (EMA) and its standard deviation, from a RAMAS Metapop .mp file.

Usage

results(mp)

Arguments

mp
A character string containing the path to a RAMAS Metapop .mp file containing simulation results. Metapop .mp files are plain text files that store settings describing RAMAS metapopulation models, and the results of simulating population dynamics according to those models.

Value

A list containing:
version
The version of RAMAS Metapop from which the file indicated by mp originated (if identifiable).
results
An array containing simulation results extracted from file. The number of rows is equal to the number of time steps in the simulation. The array has four columns, containing mean, sd, min and max of population size across iterations at each time step (i.e. each row), and the number of array slices is equal to the number of populations. The third dimension is named according to population names (numeric component only).
iter_min
A sorted vector of minimum abundance, across time steps, for each iteration.
iter_max
A sorted vector of maximum abundance, across time steps, for each iteration.
iter_terminal
A sorted vector of terminal abundance for each iteration.
qe_thr
The quasi-extinction threshold. When the total abundance is beneath qe_thr, the metapopulation is considered to be quasi-extinct.
qe_prob
The probability and cumulative probability of exceeding the quasi-extinction threshold (qe_thr) at each time step.
EMA
The mean minimum abundance (i.e. the mean, across iterations, of the minimum abundance for each simulation trajectory).
SDMA
The standard deviation of minimum abundance (i.e. the sd, across iterations, of the minimum abundance for each simulation trajectory).
timestamp
A POSIXlt object representing the date and time at which the simulation was completed.
n_pops
The number of populations in the simulation.
duration
The number of time steps in the simulation
n_iters
The number of iterations performed.

References

See Also

meta

Examples

Run this code
mp <- system.file('example.mp', package='mptools')
res <- results(mp)
str(res)

# look at the simulation results for the first array slice (NB: this slice is
# all pops combined):
res$results[,, 1]
# equivalently, subset by name:
res$results[,, 'ALL']
res$results[,, 'Pop 190']
res$results[,, '240A24']
dimnames(res$results)[[3]] # population names

# return a matrix of mean population sizes, where columns represent
# populations and rows are time steps:
res$results[, 1, ] # or res$results[, 'mean', ]

# sd across iterations:
res$results[, 2, ] # or res$results[, 'sd', ]

# min pop sizes across iterations:
res$results[, 3, ] # or res$results[, 'min', ]

# max pop sizes across iterations:
res$results[, 4, ] # or res$results[, 'max', ] 

Run the code above in your browser using DataLab