Skip to content

berndpanassiti/HostSwitch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HostSwitch

HostSwitch: An R Package to simulate host switching by a parasite

CRAN_Status_Badge Project Status: Active – The project has reached a stable, usable state and is being actively developed. R-CMD-check minimal R version License: AGPL v3

Trivellone, V. ORCID iD icon; Araujo B.L., S. ORCID iD icon; Panassiti, B. ORCID iD icon

R/HostSwitch is an R package that uses an individual-based model to simulate dispersion and host switch events by a consumer. The host-consumer association refers to any type of symbiotic (sensu lato) biological interaction.

Installation

Install R/HostSwitch from CRAN using:

install.packages("HostSwitch")

or from GitHub using:

devtools::install_github(repo <- "berndpanassiti/HostSwitch",build_vignettes = TRUE)

Example use

Try the following example to simulate dispersal and host switch events by a consumer. You can set up a maximum of 20 generations and 3 simulations:

library(HostSwitch)
simulated_quantities <- simHostSwitch(seed=123,n_sim=3,n_generation=20)

Also try summaryHostSwitch function to get summary statistics of simulated quantities of interest: optimum phenotypes that Consumers should have to be favored by the current Resource (pRes_sim), optimum phenotypes that Consumers should have to be favored by the novel Resource (pRes_new_sim), individual phenotype values of the Consumers (pInd), number of migrating individuals at each generation (pInd_jump_sim), individual phenotype values of the Consumers who disperse in a novel Resource (pInd_whichjump_sim), and individual phenotype values of the Consumers who successful colonize a novel Resource (pInd_whichsurv_sim).

summaryHostSwitch(simulated_quantities)

Finally, try plotHostSwitch to plot of the simulated quantities and to select a specific simulation use the parameter "n_sim":

plotHostSwitch(simulated_quantities, sim_n = 1)

You can compare two "simHostSwitch" objects using the function testHostSwitch. The comparison is between three estimated quantities: "j" total number of dispersing events; "s" total number of successful host switch events; "d" distance between the pRes_sim andpRes_new_sim for the generations where a successful host switch occurs, or phenotype distance. The The available tests are:”t” for t-test (parametric), and ”w” for Wilcoxon-test (non-parametric). For this comparison the number of simulation need to be greater than 1.

m1 <- simHostSwitch(seed=123,n_sim=100,b=10) 
m2 <- simHostSwitch(seed=123,n_sim=100,b=15) 
testHostSwitch(simulated_quantities1=m1,simulated_quantities2=m2,parameter="j",test="t",plot=FALSE)

Using Shiny application for R, it is possible to run an interactive plot to simulate host switching on the web without detailed knowledge of the underlying code:

shinyHostSwitch()

License

The R/HostSwitch package as a whole is distributed under GPL-3 (GNU General Public License version 3).

Releases

No releases published

Packages

No packages published