The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

simEd (Simulation Education)

R-CMD-check

This package contains various functions to be used for simulation education, including: simple Monte Carlo simulation functions; queueing simulation functions with optional animation; variate generation functions capable of producing independent streams and antithetic variates; separate functions for visualizing/animating (a) event-driven simulation details of a single-server queue model, (b) a Lehmer random-number generator, (c) random variate generation via acceptance-rejection, (d) generation of a non-homogeneous Poisson process via thinning, and (e) random variate generation for various discrete and continuous distributions; and functions to compute time-persistent statistics. The package also contains two queueing data sets (one fabricated, one real-world) to facilitate input modeling.

Example

This is an example showing use of the ssq function in our package to simulate a simple M/M/1 queue, passing in a custom exponential interarrival function defined using our vexp variate generator, and then plotting the number in the system across time, with superimposed time-averaged statistics computed using meanTPS and sdTPS:

## ssq example code
library(simEd)
myArrFcn <- function() { vexp(1, rate = 1 / 0.95, stream = 1) }
output <- ssq(maxArrivals = 100, seed = 8675309, interarrivalFcn = myArrFcn,
              saveNumInSystem = TRUE, showOutput = FALSE)
avg <- meanTPS(output$numInSystemT, output$numInSystemN)
sd <- sdTPS(output$numInSystemT, output$numInSystemN)
plot(output$numInSystemT, output$numInSystemN, type = "s", main = "M/M/1 Queue",
     bty = "l", las = 1, xlab = "time", ylab = "number in system")
abline(h = avg, lwd = 2, col = "red")
abline(h = c(avg - sd, avg + sd), lwd = 2, lty = "dotted", col = "red")

Installation

Install the current version of simEd from CRAN using install.packages("simEd").

Note that the simEd package depends on Josef Leydold’s rstream package, a wrapper of Pierre L’Ecuyer’s “mrg32k3a” random number generator, to provide independent streams of uniform(0,1) random numbers. The simEd package also depends on the shape package, used in producing animations. If either of the rstream or shape package is not already installed, the previous step will install them automatically.

Details

The goal of this package is to facilitate use of R for an introductory course in discrete-event simulation.

This package contains animation functions for visualizing:

This package contains variate generators capable of independent streams (based on Josef Leydold’s rstream package) and antithetic variates for four discrete and eleven continuous distributions:

All of the variate generators use inversion, and are therefore monotone and synchronized.

The package contains functions to visualize variate generation for the same four discrete and eleven continuous distributions:

The package contains functions that implement Monte Carlo simulation approaches for estimating probabilities in two different dice games:

The package also contains functions that are event-driven simulation implementations of a single-server single-queue system and of a multiple-server single-queue system:

Both queueing functions are extensible in allowing the user to provide custom arrival and service process functions. Both functions provide animation.

The package contains four functions primarily for visualizing simulation concepts:

The package contains three functions for computing time-persistent statistics:

The package also masks two functions from the stats package:

Finally, the package provides two queueing data sets to facilitate input modeling:

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.