Learn R Programming

simsalapar (version 1.0-8)

subjob: Subjob - Compute one Row of the Virtual Grid

Description

subjob() computes one row of the virtual grid in a simulation study, provides several seeding methods, and sub-job monitoring (information about the sub-job just finished).

printInfo is a named list of functions optionally to be used as monitor in subjob() for printing information at the end of each sub-job.

Usage

subjob(i, pGrid, nonGrids, n.sim, seed, keepSeed = FALSE,
       repFirst = TRUE, doOne,
       timer = mkTimer(gcFirst=FALSE), monitor = FALSE, ...)

printInfo # or # printInfo[["default"]]

Arguments

i
row number of the virtual grid. i.sim and j together determine i.
pGrid
physical grid of all combinations of variables of type "grid", as returned by mkGrid().
nonGrids
values of non-"grid"-variables (if provided, passed to doOne()), i.e., typically get.nonGrids()[["nonGrids"]].
n.sim
number of simulation replications.
seed
one of: [object Object],[object Object],[object Object],[object Object],[object Object]
keepSeed
logical indicating if .Random.seed should be appended to each return value of doCallWE() - unl
repFirst
logical; if TRUE (the default), all n.sim replications are computed for a row in the (physical) grid first, before the next row is consider
doOne
function for computing one row in the (physical) grid; must return a numeric vector, matrix, or array.
timer
a function similar to system.time(), passed to doCallWE().
monitor
logical or function indicating whether or how monitoring output is displayed. TRUE defaults to the printInfo[["default"]]
...
additional arguments passed to doOne().

Value

  • [object Object],[object Object]

Details

See the vignette or references in simsalapar-package for how to use these functions.

The case where seed is a numeric vector of length n.sim also leads to the same results no matter which variables are of type grid or inner; see demo(robust.mean) where this is tested. This is important to guarantee since one might want to change certain inner variables to grid variables due to load-balancing while computing the desired statistics based on the same seed (or generated data from this seed).

See Also

doCallWE(); .Random.seed for information about random number generators and seeds.

For examples of implicit use of subjob, see doLapply.

Examples

Run this code
names(printInfo)# currently "default", "gfile", "fileEach"
if(need.U <- !any("package:utils" == search())) library(utils)
str(printInfo, give.attr=FALSE)
## the functions in printInfo share a common environment() with utility functions:
ls.str(environment(printInfo$default))
if(FALSE) # show them all
as.list(environment(printInfo$default))

Run the code above in your browser using DataLab