Learn R Programming

PoweR (version 1.0.7)

compquant: Computation of the quantile values only for one test statistic.

Description

Functions for the computation of the quantile values only for one test statistic at a time and also one n value.

Usage

compquant(n,law.index,stat.index,probs=NULL,M=10^5,law.pars=NULL,
          stat.pars=NULL,model=NULL,Rlaw=NULL,Rstat=NULL,
center=FALSE, scale=FALSE)

Arguments

n

number of observations for each sample to be generated; length(n)=1. This can also be set to 0 if you want to use your own function using the 'Rstat' argument (see below).

law.index

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

stat.index

stat index as given by getindex; length(stat.index)=1.

probs

If not NULL, should be a vector of levels from which to compute the quantile values. If NULL, the levels 0.025,0.05,0.1,0.9,0.95,0.975 will be used.

M

Number of Monte Carlo repetitions to use.

law.pars

NULL or a vector of length at most 4 containing 4 possible parameters to generate random values from distribution law(\(\code{law.pars}[j],j<=4\)). If NULL, the default parameter values for the law specified by law.index will be used.

stat.pars

A vector of parameters. If NULL, the default parameter values for the statistic specified by this stat.index will be used.

model

NOT YET IMPLEMENTED. 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 file modele1.R in directory inst/doc/ for an example in multiple linear regression.

Rlaw

The user can provide its own (random generating) R function using this parameter. In this case, 'law.index' should be set to 0.

Rstat

If 'stat.index' is set to 0, 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).

center

Logical. Should we center the data generated

scale

Logical. Should we center the data generated

Value

A list with M statistic values and also some quantiles (with levels 0.025,0.05,0.1,0.9,0.95,0.975), as well as the name of the law and the name of the test statistic used (just to be sure!).

References

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

Examples

Run this code
# NOT RUN {
compquant(n=50,law.index=2,stat.index=10,M=10^3)$quant
compquant(n=50,law.index=0,stat.index=10,M=10^3,Rlaw=rnorm)$quant
# }

Run the code above in your browser using DataLab