Learn R Programming

onewaytests (version 1.1)

welch.test: A Function to Perform Welch's Heteroscedastic F Test and Welch's Heteroscedastic F Test with Trimmed Mean and Winsorized Variance

Description

welch.test performs Welch's Heteroscedastic F test and Welch's Heteroscedastic F Test with trimmed mean and winsorized variance.

Usage

welch.test(y, group, rate = 0, na.rm = TRUE)

Arguments

y
a numeric vector of data values.
group
a vector or factor object giving the group for the corresponding elements of y.
rate
the rate of observations trimmed and winsorized from each tail of the distribution. If rate = 0, it performs Welch's Heteroscedastic F test. Otherwise, Welch's Heteroscedastic F Test with trimmed mean and winsorized variance is performed. Default is set to rate = 0.
na.rm
a logical value indicating whether NA values should be stripped before the computation proceeds.

Value

A list with class "htest" containing the following components:
statistic
the value of the test statistic with a name describing it.
parameter
the parameter(s) of the approximate F distribution of the test statistic.
p.value
the p-value of the test.

References

Welch, B. L.(1951). On the Comparison of Several Mean Values: An Alternative Approach. Biometrika, 38, 330-336.

Examples

Run this code

welch.test(iris$Sepal.Length, iris$Species, rate=0.1)

y=rnorm(10,5,2)
group=c(rep(1, times=3),rep("two", times=3), rep(8, times=4))
welch.test(y, group)

Run the code above in your browser using DataLab