rcophylo_PonH: Cophylogeny simulation on an existing host tree.

View source: R/rcophylo.R

rcophylo_PonHR Documentation

Cophylogeny simulation on an existing host tree.

Description

This function simulates the codiversification of a clade of parasites on a given host phylogeny (simulated or estimated) that is provided.

Usage

rcophylo_PonH(
  HTree,
  beta = 0.1,
  gamma = 0,
  sigma = 0,
  nu = 0.5,
  kappa = 0,
  delta = 0,
  exportFormat = "cophylogeny",
  PStartT = 0,
  iniHBranch = NULL,
  Gdist = NULL,
  timestep = 0.001
)

Arguments

HTree

a pre-built host phylogenetic tree.

beta

a numeric value giving the baseline parasite host shift rate.

gamma

a numeric value giving the dependency of host shift success of a parasite on phylogenetic distance between the old and the new host.

sigma

a numeric value determining how successful host shift are when the new host is already infected by a parasite. Specifically, the probability of host shift success (1-\sigma)^n, where n is the number of pre-existing parasites on the new host branch.

nu

a numeric value giving the parasite extinction rate.

kappa

a numeric value giving the parasite speciation rate within hosts.

delta

a numeric value giving the probability of lineage loss during co-speciation. delta=0 specifies faithful transmission of the parasites to both new host species, whereas delta=1 specifies that parasites will only be inherited by one daughter host species.

exportFormat

a string specifying either "cophylogeny" or "raw". Where "cophylogeny" specifies that the output will be exported as class "cophylogeny" (the default). "raw" exports the output as two objects of class "data.frame".

PStartT

the timepoint at which a parasite invades the host tree (default set to 0).

iniHBranch

numerical. The host branch number from which the parasite invasion is initiated. If left at the default value NA, a randomly chosen host branch alive at PStartT (time of infection) will be selected.

Gdist

optional: a pre-calculated distance matrix of the living host branches at PStartT (time of infection). Providing this matrix will speed up the calculation which may be useful when running several simulations on the same host tree.

timestep

a numeric value giving the time step by which the simulation proceeds. Increase to make the simulation faster or decrease to make it more precise. The same timestep that was used to build the host tree, should be used to build the parasite tree to avoid potential errors.

Value

By default, an object of class "cophylogeny" is returned that is a list of phylo objects (one for the host and one for the parasite), as specified in the R-package "ape". If the argument exportFormat is set to "raw" the function returns a list of dataframes containing information on all the branches in the trees. (These dataframes are what the function uses internally.)


JanEngelstaedter/cophy documentation built on Nov. 7, 2023, 9:37 a.m.