metafolio {metafolio} | R Documentation |
metafolio: An R package to simulate metapopulations for portfolio optimization
Description
The metafolio R package is a tool to simulate metapopulations and apply financial portfolio optimization concepts. The package was originally written for salmon simulations, so some of the language refers to salmon-specific terminology, but the package could be used and/or adopted for other taxonomic groups.
Details
The main simulation function is meta_sim
. This function takes
care of running an individual simulation iteration. The package also
contains functions for exploring conservation scenarios with these
simulations (see the "Assessing multiple conservation scenarios" section
below), and find optimal conservation strategies (see the "Portfolio
optimization section" below).
Running a simulation once
To run a single simulation iteration, see the function
meta_sim
. To plot the output from one of these simulations, see
the function plot_sim_ts
.
Assessing multiple conservation scenarios
You can use run_cons_plans
to run meta_sim
for
multiple iterations and across multiple conservation strategies. These
strategies could focus on the spatial distribution of conservation or on the
number of populations conserved.
The function plot_cons_plans
can plot the output from
run_cons_plans
.
Specifying environmental patterns
When you run meta_sim
you can specify the environmental signal.
One of the arguments is a list of options to pass to
generate_env_ts
, which controls the environmental pattern.
Diagnostic plots
metafolio contains some additional plotting functions to inspect the
spawner-return relationships and the correlation between returns:
plot_rickers
, and
plot_correlation_between_returns
.
Portfolio optimization
metafolio also contains some experimental functions for finding optimal conservation strategies (an efficient frontier). This is analogous to financial portfolio where the goal is to find the investment weights that maximizes expected return for a level of expected risk, or vice-versa. Presently, these functions rely on Monte Carlo sampling, and so are rather slow.
For this purpose, the function create_asset_weights
can
generate a matrix of asset weights, which can then be passed to
monte_carlo_portfolios
to do the optimization itself.
plot_efficient_portfolios
can be used to plot the optimization
output.
See the package vignette vignette("metafolio")
for more extensive
explanation of how to use metafolio along with some examples.
Author(s)
Maintainer: Sean C. Anderson sean@seananderson.ca (ORCID)
Other contributors:
Jonathan W. Moore [contributor]
Michelle M. McClure [contributor]
Nicholas K. Dulvy [contributor]
Andrew B. Cooper [contributor]
See Also
Useful links:
Report bugs at https://github.com/seananderson/metafolio/issues