asymp.test {asympTest}R Documentation

Asymptotic tests

Description

Performs one and two sample asymptotic (no gaussian assumption on distribution) parametric tests on vectors of data.

Usage

asymp.test(x,...)
## Default S3 method:
asymp.test(x, y = NULL,
parameter = c("mean", "var", "dMean", "dVar", "rMean", "rVar"),
alternative = c("two.sided", "less", "greater"),
reference = 0, conf.level = 0.95, rho = 1, ...)
## S3 method for class 'formula':
asymp.test(formula, data, subset, na.action, ...)

Arguments

x a (non-empty) numeric vector of data values.
y an optional (non-empty) numeric vector of data values.
parameter a character string specifying the parameter under testing, must be one of "mean", "var", "dMean" (default), "dVar", "rMean", "rVar"
alternative a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". You can specify just the initial letter.
reference a number indicating the reference value of the parameter (difference or ratio true value for two sample test)
conf.level confidence level of the interval.
rho optional parameter (only used for parameters "dMean" and "dVar") for penalization (or enhancement) of the contribution of the second parameter.
formula a formula of the form lhs ~ rhs where lhs is a numeric variable giving the data values and rhs a factor with two levels giving the corresponding groups.
data an optional matrix or data frame (or similar: see model.frame) containing the variables in the formula formula. By default the variables are taken from environment(formula).
subset an optional vector specifying a subset of observations to be used.
na.action a function which indicates what should happen when the data contain NAs. Defaults to getOption("na.action").
... further arguments to be passed to or from methods.

Details

Asymptotic parametric test and confidence intervals are based on the following unified statistic :

est(theta)(Y)-theta / est(var(est(theta)))(Y)

which asymptotically follows a N(0,1).

theta stands for the parameter under testing (mean/variance, difference/ratio of means or variances).

The term est(var(est(theta))) is calculated by the ad-hoc seTheta function (see seMean).

Value

A list with class "htest" containing the following components:

statistic the value of the unified $theta$ statistic.
p.value the p-value for the test.
conf.int a confidence interval for the parameter appropriate to the specified alternative hypothesis.
estimate the estimated parameter depending on whether it wasa one-sample test or a two-sample test (in which case the estimated parameter can be a difference/ratio in means/variances).
null.value the specified hypothesized value of parameter depending on whether it was a one-sample test or a two-sample test.
alternative a character string describing the alternative hypothesis.
method a character string indicating what type of asymptotictest was performed.
data.name a character string giving the name(s) of the data.

Author(s)

J.-F. Coeurjolly, R. Drouilhet, P. Lafaye de Micheaux, J.-F. Robineau

References

Coeurjolly, J.F. Drouilhet, R. Lafaye de Micheaux, P. Robineau, J.F. (2008) asympTest: R package for performing asymptotic parametric tests and confidence intervals, submitted to Journal of Statistical Software

See Also

t.test, var.test for normal distributed data.

Examples

## one sample
x <- rnorm(70, mean = 1, sd = 2)
asymp.test(x)
asymp.test(x,par="mean",alt="g")
asymp.test(x,par="mean",alt="l",ref=2)
asymp.test(x,par="var",alt="g")
asymp.test(x,par="var",alt="l",ref=2)
## two samples
y <- rnorm(50, mean = 2, sd = 1)
asymp.test(x,y)
asymp.test(x,y,"rMean","l",.75)
asymp.test(x,y,"dMean","l",0,rho=.75)
asymp.test(x,y,"dVar")
## Formula interface
asymp.test(uptake~Type,data=CO2)

[Package asympTest version 0.1.0 Index]