simHostSwitch | R Documentation |
Simulates the number of dispersion and successful host switch events by individuals of the Consumer until all individuals die.
simHostSwitch( data = NULL, column = NULL, K = 100, b = 10, mig = 0.01, sd = 0.2, sigma = 1, pRes_min = 1, pRes_max = 10, n_generations = 200, jump_back = "no", seed = NULL, n_sim = 1, nInitConsumer = 20 )
data |
A matrix or dataset, the columns may indicate different types of Consumes characterized by a specific set of parameters (rows), see details. Default value: NULL. |
column |
Used together with data argument; indicate the column name, string. Default value: NULL. |
K |
Carrying capacity, positive integer (min=1, max=1000), default value: 100. |
b |
net reproduction rate; average number of offspring that a population of the Consumer produces at each generation, numeric value (min=0), default value: 10. |
mig |
define the proportion of successful migrating individuals at each generation, numeric value (min=0, max=1), default value: 0.01. |
sd |
Standard deviation for mutation, numeric value (min=0, max=10), default value: 0.2. |
sigma |
Standard deviation of the survival function, numeric value (min=0, max=10), default value: 1. |
pRes_min |
smallest optimum phenotype value imposed by the Resource, numeric value (min=1, max=pRes_max), default value: 1. |
pRes_max |
highest optimum phenotype value imposed by the Resource, numeric value (min=pRes_min, max=100), default value: 10. |
n_generations |
Number of generations, positive integer (min=1, max=50000), default value: 200. |
jump_back |
Option for consumers that do not survive on the novel resource. If "yes" the consumer(s) jump back to the current resource and will be considered in the selective pressure and reproduction stage for the n+1 generation, if "no" (default) it dies on the new host. |
seed |
a single value useful for creating simulations or random objects that can be reproduced, positive integer (>0), default value: NULL. |
n_sim |
Number of simulations, positive integer (min=1, max = 50000), default value: 1. |
nInitConsumer |
propagule size (or number of initial individuals) at the generation n = 0, default value: 20. |
This function simulates the number of host switches by the population of
a consumer.
There are 2 ways to provide parameters to the simHostSwitch()
function:
"data","column": Provide names of matrix/dataframe and column, e.g. data= "parli$Cephaloleia", column = "Cb.mLxjN"
individual parameter: e.g. b=5, n_generations=500, etc...
If no data/column or individual parameters are provided, default parameter
values are used.
The rownames of the data must match the parameter argument names. You may
use one of the parli()
datasets as a template.
Results are stored to an object of class ‘HostSwitch’.
to make use of summary and plotting functions in the HostSwitch
package.
Please note that when arguments "data" and "column" are provided, the
results are stored to the global environment
using the colname provided to the argument "column" (in our example
above Cb.mLxjN).
The object of class ‘'HostSwitch’ includes the following simulated
quantities:
$pRes_sim: a vector of the optimum phenotypes (one for each generation) that Consumers should have to be favored by the current Resource.
$pRes_new_sim: a vector of the optimum phenotypes (one for each generation) that Consumers should have to be favored by the novel Resource.
$pInd_sim: list of vectors that includes the individual phenotype values of the Consumers in the population of each generation.
$pInd_jump_sim: vector of number of migrating individuals at each generation. The vector length is always equal to the 'n_generation' parameter, if the simulation ends before the 'n_generation' value then the vector will include a 'NA' by default.
$pInd_whichjump_sim: list of vectors that extracts the individual phenotype values of the Consumers who disperse in a novel Resource in each population and generation.
$pInd_whichsurv_sim: list of vectors that extracts the individual phenotype values of the Consumers who successful colonize a novel Resource in each population and generation.
These simulated quantities of interest are available for each generation step
and can be used for summary statistics and plots using functions
summaryHostSwitch()
and plotHostSwitch()
,
respectively.
Note: One important aspect of simHostswitch is that it is based on
the survivalProbability()
function.
An object of class ‘HostSwitch’.
survivalProbability()
, summaryHostSwitch()
,
plotHostSwitch()
m1 = simHostSwitch() # using default values for arguments data(parli) Cephaloleia=parli$Cephaloleia m2 = simHostSwitch(data=Cephaloleia, column="Cb.mLxjN") ## Not run: simHostSwitch(sigma=100) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.