Description Usage Arguments Details Value Author(s) References Examples
Functions for the computation of power and level tables for hypothesis tests, with possible use of a cluster.
1 2 3 4 |
law.indices |
vector of law indices as given by function |
stat.indices |
vector of statistic indices as given by function |
vectn |
vector of sample sizes (n) values. |
M |
number of Monte Carlo repetitions. |
levels |
vector of significance levels for the test. |
critval |
if not |
alter |
named-list of integer values (0: two.sided=bilateral, 1: less=unilateral, 2:
greater=unilateral, 3: bilateral test that rejects H0 only for large
values of the test statistic, 4: bilateral test that rejects H0 only
for small values of the test statistic). The names of the list should be |
parlaws |
named-list of parameter values for each law to
simulate. The names of the list should be |
parstats |
named-list of parameter values for each statistic to simulate.
The names of the list should be |
nbclus |
number of slaves to use for the computation on a cluster. This needs parallel or Rmpi package to be installed and functionnal on the system. Also the mpd daemon sould be started. |
model |
NOT YET IMPLEMENTED. If |
null.law.index |
index of the law under the null. Only used, by
|
null.law.pars |
vector of parameters corresponding to
|
Rlaws |
When some law indices in 'law.indices' are equal to 0, this means that you will be using some R random generators. In that case, you should provide the names of the random generation functions in the corresponding components of 'Rlaws' list, the other components should be set to NULL. |
Rstats |
A list. If in a given row of the 'params' matrix, the value of 'stat' is set to 0, the corresponding component of the list 'Rstats' should be an R function that outputs a list with components 'statistic' (value of the test statistic), 'pvalue' (pvalue of the test; if not computable should be set to 0), 'decision' (1 if we reject the null, 0 otherwise), 'alter' (see above), 'stat.pars' (see above), 'pvalcomp' (1L if the pvalue can be computed, 0L otherwise), 'nbparstat' (length of stat.pars). If the value of 'stat' is not 0, then the corresponding component of 'Rstats' should be set to 'NULL'. |
center |
Logical. Should we center the data generated |
scale |
Logical. Should we center the data generated |
This version is faster (but maybe less easy to
use in the process of investigating the power of test statistics under
different alternatives) than the powcomp.easy
version.
A list of class power
whose components are described below:
M |
number of Monte Carlo repetitions. |
law.indices |
vector of law indices as given by function |
vectn |
vector of sample sizes. |
stat.indices |
vector of test statistic indices as given by function |
decision |
a vector of counts (between 0 and
where |
levels |
vector of levels for the test. |
cL |
left critical values used. |
cR |
right critical values used. |
usecrit |
a vector of 1s and 0s depending if a critical value has been used or not. |
alter |
type of each one of the tests in |
nbparlaws |
default number of parameters used for each law in |
parlaws |
default values of the parameters for each law. |
nbparstats |
default number of parameters for each test
statistic in |
parstats |
default values of the parameters for each test statistic. |
nbclus |
number of CPUs used for the simulations. |
P. Lafaye de Micheaux, V. A. Tran
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## Regenerate Table 6 from Puig (2000) (page 424)
law.index <- 1
# Take M = 50000 for accurate results
M <- 10
vectn <- c(10,15,20,35,50,75,100)
level <- c(0.05)
stat.indices <- c(43,44,42,45,46)
law.indices <- c(2,3,4)
alter <- list(stat43 = 3,stat44 = 3,stat42 = 3,stat45 = 3,stat46 = 3)
critval <- many.crit(law.index,stat.indices,M,vectn,level,alter,
law.pars = NULL,parstats = NULL)
table6 <- powcomp.fast(law.indices,stat.indices,vectn,M,level,critval = critval,alter,
parlaws = NULL,parstats = NULL,nbclus = 1)
table6
|
Loading required package: parallel
Loading required package: Rcpp
law n level W^2 U^2 A^2 sqrt{n}D V
1 Normal(mu=0,sigma=1) 10 0.05 10 0 10 0 10
2 15 0.05 60 20 40 50 30
3 20 0.05 0 30 10 0 20
4 35 0.05 40 50 20 40 30
5 50 0.05 50 50 20 30 50
6 75 0.05 30 60 30 40 30
7 100 0.05 50 60 70 60 40
8 Cauchy(mu=0,sigma=1) 10 0.05 30 30 30 30 30
9 15 0.05 70 40 70 70 50
10 20 0.05 40 70 30 50 50
11 35 0.05 40 90 50 40 50
12 50 0.05 70 90 80 70 90
13 75 0.05 80 90 100 80 90
14 100 0.05 100 100 100 90 100
15 Logistic(mu=0,sigma=1) 10 0.05 10 20 10 10 10
16 15 0.05 30 30 40 40 40
17 20 0.05 10 30 10 10 10
18 35 0.05 20 40 20 20 0
19 50 0.05 20 30 10 20 40
20 75 0.05 0 0 0 0 0
21 100 0.05 0 0 0 0 0
n level W^2 U^2 A^2 sqrt{n}D V
Average power 10 0.05 16.667 16.667 16.667 13.333 16.667
2 15 0.05 53.333 30.000 50.000 53.333 40.000
3 20 0.05 16.667 43.333 16.667 20.000 26.667
4 35 0.05 33.333 60.000 30.000 33.333 26.667
5 50 0.05 46.667 56.667 36.667 40.000 60.000
6 75 0.05 36.667 50.000 43.333 40.000 40.000
7 100 0.05 50.000 53.333 56.667 50.000 46.667
n level W^2 U^2 A^2 sqrt{n}D V
Average gap 10 0.05 3.333 3.333 3.333 6.667 3.333
2 15 0.05 3.333 26.667 6.667 3.333 16.667
3 20 0.05 26.667 0.000 26.667 23.333 16.667
4 35 0.05 26.667 0.000 30.000 26.667 33.333
5 50 0.05 13.333 3.333 23.333 20.000 0.000
6 75 0.05 16.667 3.333 10.000 13.333 13.333
7 100 0.05 6.667 3.333 0.000 6.667 10.000
n level W^2 U^2 A^2 sqrt{n}D V
Worst gap 10 0.05 10 10 10 10 10
2 15 0.05 10 40 20 10 30
3 20 0.05 30 0 40 30 20
4 35 0.05 50 0 40 50 40
5 50 0.05 20 10 30 20 0
6 75 0.05 30 10 30 20 30
7 100 0.05 20 10 0 10 30
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.