The user defined function func
handles the generation of data, the application of the method of interest
and the evaluation of the result for a single repetition and parameter combination.
MonteCarlo handles the generation of loops over the desired parameter grids and the
repetition of the Monte Carlo experiment for each of the parameter constellations.
There are two important formal requirements that func
has to fulfill.
1. The arguments of func
have to be scalar.
2. The value returned by func
has to be list of (unnamed) scalars (The list elements can be named).
For the estimation of the required simulation time,
a separate simulation is run on a reduced grid that only contains the extreme points
for each parameter, e.g. the smallest and the largest sample size.
This test simulation is carried out with nrep/10
repetitions and the required
simulation time is estimated by a linear interpolation. Since the computational complexity is
usually a convex function of the sample size and the dimension of the process, this approach
tends to overestimate the time required.
export_also
allows to export data to the cluster in case parallized computations on a dataset are desired.
It also allows to bypass the automatic export of functions and packages.
To manually export a function or dataset or to load a package, pass a list to export_also
where the list elements are named
"functions", "data" and/or "packages". For example: export_also=list("functions"=c("function_name_1", "function_name_2"),
"packages"="package_name", "data"="mtcars"
.