simulation_mmc: Maximized Monte Carlo Simulation

Description Usage Arguments Value Examples

Description

Generates N Monte Carlo replicates of a statistic for given nuisance parameter value.

Usage

1
2
simulation_mmc(y, statistic, dgp = function(y, v) sample(y, replace =
  TRUE), v, N = 99, ...)

Arguments

y

A vector or data frame.

statistic

A function or a character string that specifies how the statistic is computed. The function needs to input the y and output a scalar.

dgp

A function. The function inputs the first argument y and a vector of nuisance parameters v and outputs a simulated y. It should represent the data generating process under the null. Default value is the function sample(y, replace = TRUE), i.e. the bootstrap resampling of y.

v

A vector parameters. The vector v is use to specify the dgp. Note that if dgp is a function of only y then we do not need to specify v. Default value is NULL.

N

An atomic vector. Number of replications of the test statistic.

...

Other named arguments for statistic which are passed unchanged each time it is called

Value

The vector of replication of test statistic.

Examples

1
2
3
4
5
6
7
8
9
# Generate some data
y = rnorm(10)

# Specify statistic and DGP
statistic = function(x) mean(x)
dgp = function(y, v) sample(y, replace = TRUE)

# Simulate statistic N times
MaxMC:::simulation_mmc(y, statistic = statistic, dgp = dgp, v = 1, N = 99)

julienneves/maxMC documentation built on May 10, 2019, 3:18 a.m.