powered by
Test if samples are coming from a specific mean. Not guaranteed to be exact, as it estimates the standard error from the sample.
expect_mc_iid_mean(object, mean, control = NULL)
A function taking one argument - that generates n univariate iid samples.
The expected mean of the samples returned from object.
a list controlling the algorithm
n number of samples to be taken in the first step. Default: 1e3
maxseqsteps: Number of sequential attempts to use. Default: 7.
incn: Factor by which to multiply n from the second sequential attempt onward. Default: 4.
level: bound on the type I error, ie the probability of wrongly rejecting a sampler with the correct distribution. Default: 1e-5.
debug: If positive then debug information will be printed via 'message()'. Default: 0.
The first argument, invisibly, to allow chaining of expectations.
# NOT RUN { sampler <- function(n) rbinom(n,prob=0.6,size=5) expect_mc_iid_mean(sampler, mean=3) testthat::expect_error(expect_mc_iid_mean(sampler, mean=2)) # }
Run the code above in your browser using DataLab