Learn R Programming

PoweR (version 1.0.7)

pvalueMC: Monte-Carlo computation of a p-value for one single test statistic.

Description

This function can compute the p-value associated with a test statistic value from a sample of observations.

Usage

pvalueMC(data, stat.index, null.law.index, M = 10^5, alter, null.law.pars = NULL,
         stat.pars = NULL, list.stat = NULL, method = c("Fisher"),
         center = FALSE, scale = FALSE)

Arguments

data

sample of observations.

stat.index

index of a test statistic as given by function getindex.

null.law.index

index of the distribution to be tested (the null hypothesis distribution), as given by function getindex.

M

number of Monte-Carlo repetitions to use.

alter

value (in 0,1,2,3,4) giving the the type of test (See Section 3.3 in Lafaye de Micheaux, P. and Tran, V. A. (2014)).

null.law.pars

vector of parameters for the law. The length of this parameter should not exceed 4. If not provided, the default values are taken using getindex function.

stat.pars

a vector of parameters. If NULL, the default parameter values for the statistic specified by this statistic wil be used.

list.stat

if not NULL, a vector of test statistic values should be provided. If NULL, these values will be computed.

method

method to use for the computation of the \(p\)-value. Only 'Fisher' method is available for the moment.

center

Logical. Should we center the data generated

scale

Logical. Should we center the data generated

Value

The Monte-Carlo p-value of the test.

References

Pierre Lafaye de Micheaux, Viet Anh Tran (2016). PoweR: A Reproducible Research Tool to Ease Monte Carlo Power Simulation Studies for Studies for Goodness-of-fit Tests in R. Journal of Statistical Software, 69(3), 1--42. doi:10.18637/jss.v069.i03

See Also

See statcompute.

Examples

Run this code
# NOT RUN {
x <- rnorm(100)
statcompute(1,x,level = c(0.05),alter = 3)$pvalue
pvalueMC(x,stat.index = 1,null.law.index = 2,M = 10^5,alter = 3)
# }

Run the code above in your browser using DataLab