Learn R Programming

mlmc (version 1.0.0)

mlmc.test: Multi-level Monte Carlo estimation test suite

Description

Computes a suite of diagnostic values for an MLMC estimation problem.

Usage

mlmc.test(mlmc_l, M, N, L, N0, eps.v, Lmin, Lmax, parallel = NA, silent = FALSE, ...)

Arguments

mlmc_l
a user supplied function which provides the estimate for level l
M
refinement cost factor ($2^\gamma$ in the general MLMC Throrem)
N
number of samples to use in the tests
L
number of levels to use in the tests
N0
initial number of samples which are used for the first 3 levels and for any subsequent levels which are automatically added. Must be $> 0$.
eps.v
a vector of all the target accuracies in the tests. Must all be $> 0$.
Lmin
the minimum level of refinement. Must be $\ge 2$.
Lmax
the maximum level of refinement. Must be $\ge$ Lmin.
parallel
if an integer is supplied, R will fork parallel parallel processes an compute each level estimate in parallel.
silent
set to TRUE to supress running output (identical output can still be printed by printing the return result)
...
additional arguments which are passed on when the user supplied mlmc_l function is called

Value

An mlmc.test object which contains all the computed diagnostic values. This object can be printed or plotted (see plot.mlmc.test).

Details

See one of the example level sampler functions (e.g. opre_l) for example usage.

This function is based on GPL-2 'Matlab' code by Mike Giles.

Examples

Run this code
## Not run: 
# # Example calls with realistic arguments
# tst <- mlmc.test(opre_l, M=4, N=2000000,
#                  L=5, N0=1000,
#                  eps.v=c(0.005, 0.01, 0.02, 0.05, 0.1),
#                  Lmin=2, Lmax=6, option=1)
# tst
# plot(tst)
# 
# tst <- mlmc.test(mcqmc06_l, M=2, N=20000,
#                  L=8, N0=200,
#                  eps.v=c(0.005, 0.01, 0.02, 0.05, 0.1),
#                  Lmin=2, Lmax=10, option=1)
# tst
# plot(tst)
# ## End(Not run)

# Toy versions for CRAN tests
tst <- mlmc.test(opre_l, M=4, N=10000,
                 L=5, N0=1000,
                 eps.v=c(0.025, 0.1),
                 Lmin=2, Lmax=6, option=1)

tst <- mlmc.test(mcqmc06_l, M=2, N=10000,
                 L=8, N0=1000,
                 eps.v=c(0.025, 0.1),
                 Lmin=2, Lmax=10, option=1)

Run the code above in your browser using DataLab