plot_pip: Pairwise invasibility plot

View source: R/plot_pip.R

plot_pipR Documentation

Pairwise invasibility plot

Description

Generates a PIP showing the combinations of mutant and resident trait values for which the mutant invades the resident (i.e. has an invasion fitness greater than one).

Usage

plot_pip(xvalues, pars, init, binary = TRUE, plotit = TRUE)

Arguments

xvalues

A vector of trait values over which to compute the invasion fitness. Each value will be taken both as a mutant and as a resident trait value, so all pairwise combinations will be evaluated.

pars

An unevaluated parameter-list (e.g. as returned by get_default_pars)

init

A vector of two starting values for solving of the demographic equilibrium

binary

Whether or not to plot whether the mutant invades (TRUE) or the actual value of the invasion fitness (FALSE)

plotit

Whether to return a plot or the underlying tibble

Details

The function computes the invasion fitness for all pairwise combinations of mutants and residents, but recycles equilibrium population sizes computed for each resident to gain in speed (using fast = TRUE in get_lambda).

Value

A ggplot object

See Also

get_lambda, find_equilibrium

Examples


pars <- get_default_pars()
plot_pip(seq(-1, 1, 1), pars, init = rep(1000, 2))


rscherrer/speciomx documentation built on March 28, 2023, 8:49 p.m.