statcompute: Performs a hypothesis test for the given value of statistic.

Description Usage Arguments Details Value Author(s) References Examples

Description

Performs the hypothesis test for those added in the package.

Usage

1
2
statcompute(stat.index, data, levels = c(0.05,0.1), critvalL = NULL,
            critvalR = NULL, alter = 0, stat.pars = NULL, check = TRUE)

Arguments

stat.index

one statistic index as given by function getindex.

data

sample from which to compute the statistic.

levels

vector of desired significance levels for the test.

critvalL

NULL or vector of left critival values.

critvalR

NULL or vector of right critival values.

alter

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.

stat.pars

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

check

Logical. If FALSE it will execute much faster, but in this case be sure to give a value to the 'stat.pars' argument; if you don't know what value to give, use rep(0.0, getnbparstats(stat.index)) as a default value.

Details

The function statcompute() should not be used in simulations since it is NOT fast. Consider instead using powcomp.easy or powcomp.fast. Se also in the Example section below for a fast approach using the .C function (but be warned that giving wrong values of arguments can crash your session!).

Value

A list with components:

statistic

the test statistic value

pvalue

the p-value

decision

the vector of decisions, same length as levels

alter

alter

stat.pars

stat.pars

symbol

how the test is noted

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
data <- rnorm(50)
# Shapiro-Wilk test:
statcompute(21, data, levels = c(0.05, 0.1), critvalL = NULL, critvalR = NULL,
            alter = 0, stat.pars = NULL)
# Identical to:
shapiro.test(data)

# The function statcompute() should not be used in simulations since it
#  is NOT fast. Consider instead the call below (but see the Details
#  Section):
.C("stat21", data = data, n = 50L, levels = 0.05, nblevels = 1L, name =
rep(" ", 50), getname = 0L, statistic = 0, pvalcomp = 1L, pvalue = 0, cL = 0.0,
cR = 0.0, usecrit = 0L, alter = 4L, decision = 0L, stat.pars = 0.0, 
nbparstat = 0L)

PoweR documentation built on May 2, 2019, 2:09 p.m.

Related to statcompute in PoweR...