many.pval {PoweR} | R Documentation |
Computes several p
-values for many test statistics.
Description
This function generates a sample of n
observations from the law
specified in law.index
. It then computes the value of each test
statistic specified in stat.indices
and use it to obtain the
corresponding p
-value under the null. The computation of these p
-values
can be done using a Monte-Carlo simulation.
Usage
many.pval(stat.indices, law.index, n = 100, M = 10^5, N = 100,
alter = create.alter(stat.indices), law.pars = NULL, parstats = NULL,
null.dist = 2, null.pars = NULL, method = c("direct", "MC"), Rlaw.index = NULL,
Rnull.dist = NULL, Rstats = NULL, center=FALSE, scale=FALSE)
Arguments
stat.indices |
vector of test statistic indices as given by
function |
law.index |
index of the distribution from which to generate
observations used to compute the values of the test statistics specified with |
n |
integer. Size of the samples from which to compute the value of the test statistics. |
M |
integer. Number of Monte-Carlo repetitions. Only used when |
N |
integer. Number of |
alter |
integer value in {0,1,2,3,4}. Type of test. See function |
law.pars |
vector of the parameter values for the law specified in |
parstats |
named-list of vectors of parameters for the test statistics specified in
|
null.dist |
used only if |
null.pars |
vector of parameters for the null distribution |
method |
character. Either 'direct' to compute the |
Rlaw.index |
If 'law.index' is set to 0 then 'Rlaw.index' should be a (random generating) function. |
Rnull.dist |
If 'null.dist' is set to 0 then 'Rnull.dist' should be a (random generating) function. |
Rstats |
A list of same length as |
center |
Logical. Should we center the data generated |
scale |
Logical. Should we center the data generated |
Value
pvals |
the |
stat.indices |
same as input. |
n |
same as input. |
M |
same as input. |
alter |
same as input. |
parstats |
same as input. |
null.dist |
same as input. |
method |
same as input. |
Author(s)
P. Lafaye de Micheaux, V. A. Tran
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
Examples
stind <- c(43,44,42) # Indices of test statistics.
alter <-list(stat43=3,stat44=3,stat42=3) # Type for each test.
# Several p-values computed under the null.
# You can increase the values of M and N for better results.
matrix.pval <- many.pval(stat.indices=stind,law.index=1,
n=100,M=10,N=10,alter=alter,null.dist=1,
method="direct")