Description Usage Arguments Details Value Examples
Run Monte Carlo simulations, taking advantage of multiple processing cores or a computing cluster
1 2 3 4 |
mcr.fn |
A character string naming the function that performs
the analysis: for example, for one-factor designs this could be any
one of |
mcr.fnArgs |
Arguments to be passed from |
mcr.cluster |
A processing cluster object, typically created by a call
to |
mcr.outfile |
name of file to which to write the output ("comma separated value" format). Defaults to "out.csv". |
mcr.datFn |
Name of function to be used to generate data set for each
Monte Carlo run (e.g., 'mkDf'). May be a user-supplied function that
returns a data frame. If a the same dataset is to be used for all runs,
then set to 'NULL' and define |
mcr.datArgs |
Arguments to be passed from |
mcr.dat |
A data frame to be used in all Monte Carlo runs. If the
data are to be generated by a function, set to 'NULL' and use
|
mcr.constant |
list of parameter values that are constant over all runs. |
mcr.varying |
A matrix, data frame or list of lists containing the parameters to be varied over runs, with each row corresponding to a single run. This determines the number of Monte Carlo runs (see 'Details'). |
mcr.LoadOnExit |
whether the data should be loaded from the file upon completion into an R object, and passed on as the return value from the function. |
mcr.reportInt |
Interval at which to give status updates on progress (default = every 100 runs) |
The number of simulations that will be run is given by
nrow(mcr.varying)
, the number of rows in the parameter matrix passed
as an argument to the function. The results matrix will be stored in the
file whose path is given by mcr.outfile
in Comma Separated Values
(CSV) format.
If mcr.fn
is a user-supplied function, the corresponding function
must return a vector with all elements of mode 'numeric', and accept
arguments mcr.data
and (optionally) mcr.params
. All arguments
in mcr.fnList
will be passed to that function.
If mcr.datFn
is a user-supplied function, the corresponding
function must return a data frame and accept the argument mcr.params
.
All arguments in mcr.datArgs
will be passed to that function.
If mcr.LoadOnExit is true, loads the data from the CSV file and returns it to the calling function.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | nmc <- 10
pmx <- cbind(randParams(genParamRanges(), nmc, 1001), seed=mkSeeds(nmc, 1001))
cl <- NULL # single-core processing
# alternatively:
# cl <- parallel:::makeCluster(number.of.clusters)
# see the 'parallel' package
mx <- mcRun("fitanova", mcr.cluster=cl,
mcr.fnArgs=list(wsbi=TRUE), # pass this along to fitanova
mcr.varying=pmx, # parameters that are varying; each row is a single run
mcr.datFn="mkDf", # data-generating function to call
mcr.datArgs=list(nitem=12, wsbi=TRUE), # values to be passed along to mkDf
mcr.reportInt=5) # report progress every 5 runs
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.