test.ezsim: Perform a Test for an ezsim Object

Description Usage Arguments Value Author(s) See Also Examples

View source: R/test.ezsim.r

Description

For each set of parameters, the simulation is ran once to obtain the value of estimator and true value to make sure everything in ezsim is properly defined. The test results will be shown in the console. The test will be ran automatically when you create an ezsim object.

Usage

1
2
## S3 method for class 'ezsim'
test(x, return_name = TRUE, print_result = FALSE, ...)

Arguments

x

An ezsim Object

return_name

Whehter to return the name of estimator

print_result

Whehter to print the return

...

unused

Value

Optional: names of estimator.

Author(s)

TszKin Julian Chan ctszkin@gmail.com

See Also

ezsim

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
ezsim_basic<-ezsim(
    m             = 100,
    run           = FALSE,
    run_test      = FALSE,
    display_name  = c(mean_hat="hat(mu)",sd_mean_hat="hat(sigma[hat(mu)])"),
    parameter_def = createParDef(list(n=seq(20,80,20),mu=c(0,2),sigma=c(1,3,5))),
    dgp           = function() rnorm(n,mu,sigma),
    estimator     = function(x) c(mean_hat = mean(x),
                                 sd_mean_hat=sd(x)/sqrt(length(x)-1)),
    true_value    = function() c(mu, sigma / sqrt(n-1))
)

test(ezsim_basic,print_result=TRUE)

## End(Not run)

ezsim documentation built on May 1, 2019, 8:04 p.m.