Learn R Programming

SimBIID (version 0.2.2)

plot.SimBIID_runs: Plots SimBIID_runs objects

Description

Plot method for SimBIID_runs objects.

Usage

# S3 method for SimBIID_runs
plot(
  x,
  which = c("all", "t"),
  type = c("runs", "sums"),
  rep = NA,
  quant = 0.9,
  data = NULL,
  matchData = NULL,
  ...
)

Value

A plot of individual simulations and/or summaries of repeated simulations extracted from SimBIID_runs object.

Arguments

x

An SimBIID_runs object.

which

A character vector of states to plot. Can be "all" to plot all states (and final event times), or "t" to plot final event times.

type

Character stating whether to plot full simulations over time ("runs") or summaries ("sums").

rep

An integer vector of simulation runs to plot.

quant

A vector of quantiles (> 0.5) to plot if type == "runs".

data

A data.frame containing time series count data, with the first column called t, followed by columns of time-series counts.

matchData

A character vector containing matches between the columns of data and the columns of the model runs. Each entry must be of the form e.g. "SD = SR", where SD is the name of the column in data, and SR is the name of the column in x.

...

Not used here.

See Also

mparseRcpp, print.SimBIID_runs, run

Examples

Run this code
# \donttest{
## set up SIR simulation model
transitions <- c(
    "S -> beta * S * I -> I", 
    "I -> gamma * I -> R"
)
compartments <- c("S", "I", "R")
pars <- c("beta", "gamma")
model <- mparseRcpp(
    transitions = transitions, 
    compartments = compartments,
    pars = pars,
    tspan = TRUE
)

## run 100 replicate simulations and
## plot outputs
sims <- run(
    model = model,
    pars = c(beta = 0.001, gamma = 0.1),
    tstart = 0,
    tstop = 100,
    u = c(S = 119, I = 1, R = 0),
    tspan = seq(1, 100, length.out = 10),
    nrep = 100
)
plot(sims, quant = c(0.55, 0.75, 0.9))

## add replicate 1 to plot
plot(sims, quant = c(0.55, 0.75, 0.9), rep = 1)
# }

Run the code above in your browser using DataLab