Skip to contents

This package was initiated in early 2000 and later transferred to GitHub in 2014. It is based on Bland Ewing’s work dating back to the early 1970s. The goal is to make his simulation code available as an R package and to provide a Shiny interface to the code. In 2026, I am using AI (Google Gemini 3 Pro) via Antigravity to improve the code and interface.

Before installing the package, you may want to examine the interactive Shiny app https://connect.doit.wisc.edu/SystemsEthology, which executes this package. See also

Install and Run Package

Change one of the simulation values on the Shiny app, say number or hosts or parasites, or number of simulation steps. Then click on Start Simulation button to start a simulation. You can redo a simulation with the same settings, or change the settings.

To install, first do

If on Windows, you will then need to install Rtools from http://cran.r-project.org/bin/windows/Rtools. This is an executable that will install some applications in c:. You will also need pdflatex, which means you need a TeX distribution such as MikTeX or TeX Live.

pak::pak("byandell/ewing", dependencies = TRUE, upgrade = TRUE)

See vignettes/ewing.Rmd for example use of code. A simple example is below:

library(ewing) # attach package
mysim <- init.simulation() # initialize simulation
simres <- future.events(mysim, plotit = FALSE) # simulate future events
plot(simres) # plot populations by stage or substrate over time
ggplot_current(simres, "host") # plot current (last) individuals over space

To change the number of initial individuals, do something like:

mysim <- init.simulation(count = c(200, 100))

will simulate 200 hosts and 100 parasites. You can also change the name of simulation file results from “sim.out” to something like “sim_200_100.out” to reflect the conditions of the simulation. Note that this file is written into the directory where you are using R.

simres <- future.events(mysim, "mysim_200_100.out", plotit = FALSE)

Here are some commands to use tidyverse for newer plots:

library(tidyverse)
ggplot_ewing(simres)
ggplot_current(simres, "host")

For more information, visit http://www.stat.wisc.edu/~yandell/ewing

Reference: B Ewing, BS Yandell, JF Barbieri, and RF Luck (2002) “Event-driven competing risks,” Ecological Modelling 158: 35–50. http://doi.org/10.1016/S0304-3800(02)00218-1