ssa.plot {GillespieSSA}R Documentation

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"),
         plot.device = "x11",
                file = "ssaplot",
                  by = 1,
           plot.from = 2,
             plot.to = dim(out$data)[2],
             plot.by = 1)

Arguments

out data object returned from ssa.
plot.device character string indicating the device where plot should rendered, valid options are "pdf","png", "jpeg", "bmp"
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)

Value

Rendered time series plot on plot.device.

Note

When rendering time series with a large number of data points plot.device="pdf", can be slow and can generate very large files compared to bitmaps (e.g. plot.device="png", plot.device="jpeg", and plot.device="bmp"). The options by, plot.from, plot.to, and plot.by can be used to plot a sparser sequense of data points. To plot the population sizes using a larger time interval the by option can be set, e.g. to plot only every 10th time point by=10. To plot only specific populations the plot.from, plot.to, and plot.by options can be set to subset the state vector. Note that the indexing of the populations is based on the (t,X) vector, i.e. the first column is the time vector while the first population is index by 2 and the last population by N+1.

See Also

GillespieSSA-package, ssa

Examples

## Not run: 
## Plot to x11 device
out <- sir()
ssa.plot(out)
## End(Not run)

## Not run: 
## Plot to pdf device 
out <- lotka("ETL",tau=0.01)
ssa.plot(out,plot.device="jpeg")
## End(Not run)

## Not run: 
## Kermack-McKendrick SIR model 
parms <- c(beta=0.001, gamma=0.1)
x0  <- c(S=499,I=1,R=0)
a   <- c("beta*{S}*{I}","gamma*{I}") 
nu  <- matrix(c(-1,0,+1,-1,0,+1),nrow=3,byrow=T)
out <- ssa(x0,a,nu,parms,tf=100,simName="Kermack-McKendrick SIR")
ssa.plot(out)

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

[Package GillespieSSA version 0.5-0 Index]