Learn R Programming

GillespieSSA (version 0.6.2)

ssa.plot: Simple plotting of ssa output

Description

Provides basic functionally for simple and quick time series plot of simulation output from ssa().

Usage

ssa.plot(
  out = stop("requires simulation output object"),
  file = "ssaplot",
  by = 1,
  plot.from = 2,
  plot.to = ncol(out$data),
  plot.by = 1,
  show.title = TRUE,
  show.legend = TRUE
)

Arguments

out

data object returned from ssa().

file

name of the output file (only applicable if plot.device!="x11".

by

time increment in the plotted time series

plot.from

first population to plot the time series for (see note)

plot.to

last population to plot the time series for (see note)

plot.by

increment in the sequence of populations to plot the time series for (see note)

show.title

boolean object indicating if the plot should display a title

show.legend

boolean object indicating if the legend is displayed

See Also

GillespieSSA-package, ssa()

Examples

Run this code
# NOT RUN {
## Define the Kermack-McKendrick SIR model and run once using the Direct method
parms <- c(beta=.001, gamma=.100)
x0 <- c(S=500, I=1, R=0)                         # Initial state vector
nu <- matrix(c(-1,0,1,-1,0,1),nrow=3,byrow=TRUE) # State-change matrix
a  <- c("beta*S*I", "gamma*I")                   # Propensity vector
tf <- 100                                        # Final time
simName <- "Kermack-McKendrick SIR"
out <- ssa(x0,a,nu,parms,tf,method="D",simName,verbose=TRUE,consoleInterval=1)

## Basic ssa plot
ssa.plot(out)

# Plot only the infectious class
ssa.plot(out,plot.from=3,plot.to=3)

# }

Run the code above in your browser using DataLab