Learn R Programming

PoweR (version 1.0.7)

many.crit: Computation of critical values for several test statistics

Description

Computation of critical values for several test statistics, several n values, and several level values, for a given distribution

Usage

many.crit(law.index,stat.indices,M = 10^3,vectn = c(20,50,100),levels = c(0.05,0.1),
  alter = create.alter(stat.indices),law.pars = NULL,parstats = NULL,model = NULL,
  Rlaw=NULL, Rstats = NULL,center=FALSE, scale=FALSE)

Arguments

law.index

law index as given by function getindex. length(law.index)=1

stat.indices

vector of statistic indices as given by function getindex.

M

number of Monte Carlo repetitions to use.

vectn

vector of number of observations for the samples to be generated.

levels

vector of required level values.

alter

named-list with type of test for each statistical test: alter[["statj"]]=0, 1 ,2, 3 or 4; for each \(j\) in stat.indices (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)

law.pars

NULL or a vector of length at most 4 containing 4 possible parameters to generate random values from distribution law(law.pars[\(j\)],\(j<=4\))

parstats

named-list of parameter values for each statistic to simulate. The names of the list should be stat\(j\), \(j\) taken in stat.indices. If stat\(j\)=NA, the default parameter values for the test statistic stat\(j\) will be used.

model

NOT IMPLEMENTED YET. If NULL, no model is used. If an integer \(i>0\), the model coded in the C function modele\(i\) is used. Else this should be an R function that takes three arguments: eps (vector of \(\epsilon\) values), thetavec (vector of \(\theta\) values) and xvec (vector or matrix of \(x\) values).This function should take a vector of errors, generate observations from a model (with parameters thetavec and values xvec) based on these errors, then compute and return the residuals from the model. See function modele1.R in directory inst/doc/ for an example in multiple linear regression.

Rlaw

If 'law.index' is set to 0 then 'Rlaw' should be a (random generating) function.

Rstats

A list of same length as stat.indices. If a value of the vector stat.indices 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 a value of stat.indices 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

Value

An object of class critvalues, which is a list where each element of the list contains a matrix for the corresponding statistic. This column matrices are: \(n\) values, level values, parameters of the test statistic (NA if none), left critical values and right critical values).

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 print.critvalues for a LaTeX output of the results of this function.

Examples

Run this code
# NOT RUN {
critval <- many.crit(law.index=2,stat.indices=c(10,15),M=10^3,vectn=c(20,50,100),
                     level=c(0.05,0.1),alter=list(stat10=3,stat15=3),law.pars=NULL,
                     parstats=NULL)
print(critval,digits=3,latex.output=FALSE)
# }

Run the code above in your browser using DataLab