plot.SimBIID_runs: Plots 'SimBIID_runs' objects

View source: R/plotSimBIID_runs.R

plot.SimBIID_runsR Documentation

Plots SimBIID_runs objects

Description

Plot method for SimBIID_runs objects.

Usage

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

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.

Value

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

See Also

mparseRcpp, print.SimBIID_runs, run

Examples


## 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)



tjmckinley/SimBIID documentation built on Sept. 11, 2022, 11:58 a.m.