DescTools (version 0.99.11)

YuenTTest: Yuen t-Test For Trimmed Means

Description

Performs one and two sample Yuen t-tests for trimmed means on vectors of data.

Usage

YuenTTest(x, ...)

## S3 method for class 'default':
YuenTTest(x, y = NULL, alternative = c("two.sided", "less", "greater"), 
          mu = 0, paired = FALSE, conf.level = 0.95, trim = 0.2, ...)

## S3 method for class 'formula':
YuenTTest(formula, data, subset, na.action, \dots)

Arguments

x
numeric vector of data values. Non-finite (e.g. infinite or missing) values will be omitted.
y
an optional numeric vector of data values: as with x non-finite values will be omitted.
alternative
is a character string, one of "greater", "less", or "two.sided", or the initial letter of each, indicating the specification of the alternative hypothesis. For one-sample tests, alternative refe
paired
a logical indicating whether you want a paired z-test.
mu
a number specifying the hypothesized mean of the population.
conf.level
confidence level for the interval computation.
trim
the fraction (0 to 0.5) of observations to be trimmed from each end of x before the mean is computed. Values of trim outside that range are taken as the nearest endpoint.
formula
a formula of the form lhs ~ rhs where lhs gives the data values and rhs 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.

Value

  • An object of class htest containing the following components:
  • statisticthe value of the t-statistic.
  • parameterthe degrees of freedom for the t-statistic and the trim percentage used.
  • p.valuethe p-value for the test.
  • conf.inta confidence interval for the trimmed mean appropriate to the specified alternative hypothesis.
  • estimatethe estimated trimmed mean or difference in trimmed means depending on whether it was a one-sample test or a two-sample test.
  • null.valuethe specified hypothesized value of the trimmed mean or trimmed mean difference depending on whether it was a one-sample test or a two-sample test.
  • alternativea character string describing the alternative hypothesis.
  • methoda character string indicating what type of test was performed.
  • data.namea character string giving the name(s) of the data.

References

Wilcox, R. R. (2005) Introduction to robust estimation and hypothesis testing. Academic Press. Yuen, K. K. (1974) The two-sample trimmed t for unequal population variances. Biometrika, 61, 165-170.

See Also

t.test, print.htest

Examples

Run this code
x <- rnorm(25, 100, 5)
YuenTTest(x, mu=99)

# the classic interface
with(sleep, YuenTTest(extra[group == 1], extra[group == 2]))

# the formula interface
YuenTTest(extra ~ group, data = sleep)


# Stahel (2002), pp. 186, 196  
d.tyres <- data.frame(A=c(44.5,55,52.5,50.2,45.3,46.1,52.1,50.5,50.6,49.2),
                      B=c(44.9,54.8,55.6,55.2,55.6,47.7,53,49.1,52.3,50.7))
with(d.tyres, YuenTTest(A, B, paired=TRUE))


d.oxen <- data.frame(ext=c(2.7,2.7,1.1,3.0,1.9,3.0,3.8,3.8,0.3,1.9,1.9),
                     int=c(6.5,5.4,8.1,3.5,0.5,3.8,6.8,4.9,9.5,6.2,4.1))
with(d.oxen, YuenTTest(int, ext, paired=FALSE))

Run the code above in your browser using DataCamp Workspace