yuen.t.test: Yuen's trimmed mean test

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/global1.R

Description

Yuen's test for one, two or paired samples.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
yuen.t.test(x, ...)

## Default S3 method:
yuen.t.test(x, y = NULL, tr = 0.2, alternative = c("two.sided", "less", "greater"),
mu = 0, paired = FALSE, conf.level = 0.95, ...)

## S3 method for class 'formula'
yuen.t.test(formula, data, subset, na.action, ...)

## S3 method for class 'paired'
yuen.t.test(x, ...)

Arguments

x

first sample or object of class paired.

y

second sample.

tr

percentage of trimming.

alternative

alternative hypothesis.

mu

a number indicating the true value of the trimmed mean (or difference in trimmed means if you are performing a two sample test).

paired

a logical indicating whether you want a paired yuen's test.

conf.level

confidence level.

formula

a formula of the form y ~ f where y is a numeric variable giving the data values and f 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.

Value

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

statistic

the value of the t-statistic.

parameter

the degrees of freedom for the t-statistic.

p.value

the p-value for the test.

conf.int

a confidence interval for the trimmed mean appropriate to the specified alternative hypothesis.

estimate

the estimated trimmed mean or difference in trimmed means depending on whether it was a one-sample test or a two-sample test.

null.value

the 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.

alternative

a character string describing the alternative hypothesis.

method

a character string indicating what type of test was performed.

data.name

a character string giving the name(s) of the data.

Author(s)

Stephane CHAMPELY, but some part are mere copy of the code of Wilcox (WRS)

References

See Also

t.test

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
z<-rnorm(20)
x<-rnorm(20)+z
y<-rnorm(20)+z+1

# two-sample test
yuen.t.test(x,y)

# one-sample test
yuen.t.test(y,mu=1,tr=0.25)

# paired-sample tests
yuen.t.test(x,y,paired=TRUE)

p<-paired(x,y)
yuen.t.test(p)

Example output

Loading required package: MASS
Loading required package: gld
Loading required package: mvtnorm
Loading required package: lattice
Loading required package: ggplot2

Attaching package: 'PairedData'

The following object is masked from 'package:base':

    summary


	Two-sample Yuen test, trim=0.2

data:  x and y
t = -1.5996, df = 21.376, p-value = 0.1244
alternative hypothesis: true difference in trimmed means is not equal to 0
95 percent confidence interval:
 -1.7196946  0.2234608
sample estimates:
trimmed mean of x trimmed mean of y 
        0.1040449         0.8521618 


	One sample Yuen test, trim=0.25

data:  x
t = -0.82156, df = 9, p-value = 0.4326
alternative hypothesis: true trimmed means is not equal to 1
95 percent confidence interval:
 0.1934707 1.3767808
sample estimates:
trimmed mean of x 
        0.7851257 


	Paired Yuen test, trim=0.2

data:  x and y
t = -2.6294, df = 11, p-value = 0.02343
alternative hypothesis: true difference in trimmed means is not equal to 0
95 percent confidence interval:
 -1.3743399 -0.1218938
sample estimates:
trimmed mean of x - trimmed mean of y 
                           -0.7481169 


	Paired Yuen test, trim=0.2

data:  x and y
t = -2.6294, df = 11, p-value = 0.02343
alternative hypothesis: true difference in trimmed means is not equal to 0
95 percent confidence interval:
 -1.3743399 -0.1218938
sample estimates:
trimmed mean of x - trimmed mean of y 
                           -0.7481169 

PairedData documentation built on May 1, 2019, 6:49 p.m.