hartleyTest: Hartley's Maximum F-Ratio Test of Homogeneity of Variances

View source: R/hartleyTest.R

hartleyTestR Documentation

Hartley's Maximum F-Ratio Test of Homogeneity of Variances

Description

Performs Hartley's maximum F-ratio test of the null that variances in each of the groups (samples) are the same.

Usage

hartleyTest(x, ...)

## Default S3 method:
hartleyTest(x, g, ...)

## S3 method for class 'formula'
hartleyTest(formula, data, subset, na.action, ...)

Arguments

x

a numeric vector of data values, or a list of numeric data vectors.

...

further arguments to be passed to or from methods.

g

a vector or factor object giving the group for the corresponding elements of "x". Ignored with a warning if "x" is a list.

formula

a formula of the form response ~ group where response gives the data values and group a vector or factor of 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").

Details

If x is a list, its elements are taken as the samples to be compared for homogeneity of variances. In this case, the elements must all be numeric data vectors, g is ignored, and one can simply use hartleyTest(x) to perform the test. If the samples are not yet contained in a list, use hartleyTest(list(x, ...)).

Otherwise, x must be a numeric data vector, and g must be a vector or factor object of the same length as x giving the group for the corresponding elements of x.

Hartley's parametric test requires normality and a nearly balanced design. The p-value of the test is calculated with the function pmaxFratio of the package SuppDists.

Value

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

method

a character string indicating what type of test was performed.

data.name

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

statistic

the estimated quantile of the test statistic.

p.value

the p-value for the test.

parameter

the parameters of the test statistic, if any.

alternative

a character string describing the alternative hypothesis.

estimates

the estimates, if any.

null.value

the estimate under the null hypothesis, if any.

References

Hartley, H.O. (1950) The maximum F-ratio as a short cut test for heterogeneity of variance, Biometrika 37, 308–312.

See Also

bartlett.test, pmaxFratio

Examples

hartleyTest(count ~ spray, data = InsectSprays)


PMCMRplus documentation built on May 29, 2024, 8:34 a.m.