rcophylo_HP: Cophylogeny simulation

View source: R/rcophylo.R

rcophylo_HPR Documentation

Cophylogeny simulation

Description

This function simulates the evolution of a random host tree with a coevolving random parasite tree.

Usage

rcophylo_HP(
  tmax,
  nHmax = Inf,
  lambda = 1,
  mu = 0.5,
  K = Inf,
  beta = 0.1,
  gamma = 0.02,
  sigma = 0,
  nu = 0.5,
  kappa = 0,
  delta = 0,
  exportFormat = "cophylogeny",
  timestep = 0.001
)

Arguments

tmax

a numeric value giving the length of the simulation.

nHmax

a numeric value giving the number of host species at which the simulation is stopped.

lambda

a numeric value giving the host speciation rate.

mu

a numeric value giving the host extinction rate.

K

a numeric value giving the carrying capacity for the host species.

beta

a numeric value giving the baseline parasite host shift rate.

gamma

a numeric value giving the dependency of host shift success 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".

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.

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.