return_mc: S3 class 'mc'.

Description Usage Arguments Examples

View source: R/classes.R

Description

S3 class mc.

Usage

1
return_mc(S0, y, statistic, dgp, N, type, call, seed, pval)

Arguments

S0

An atomic vector. Value of the test statistic applied to the data.

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 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.

N

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

type

A character string. It specifies the type of test the p-value function produces. The possible values are geq, leq, absolute and two-tailed. Default is geq.

call

An object of class call. Original call to mmc

seed

An integer vector. Value of .Random.seed at the start of mmc call.

pval

An atomic vector. Monte Carlo p-value of statistic

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# Generate typical data found inside the function mc()
S0 <-  0
y <-  rnorm(100)
statistic <-  function(y) mean(y)
dgp <-  function(y) sample(y, replace = TRUE)
N <-  99
type <-  "geq"
call <- call("mc",y= y, statistic = statistic, dgp = dgp, N = 99, type = type)
seed <-  NULL
pval <-  0.06


# Combine data and return it as an object of class 'mc'
MaxMC:::return_mc(S0 = S0, y = y, statistic = statistic, dgp = dgp,
                  N = N, type = type, call = call, seed = seed, pval= pval)

julienneves/MaxMC documentation built on May 7, 2019, 8:18 a.m.