F Test to Compare Two Variances

DESCRIPTION:

Performs an F test to compare variances of two samples from normal populations.

USAGE:

var.test(x, y, alternative="two.sided", conf.level=.95)

REQUIRED ARGUMENTS:

x,y
numeric vectors. NAs and Infs are allowed but will be removed.

OPTIONAL ARGUMENTS:

alternative
character string, one of "greater", "less" or "two.sided", or just the initial letter of each, indicating the specification of the alternative hypothesis. alternative refers to the true population variance for x in relation to that for y.
conf.level
confidence level for the returned confidence interval, restricted to lie between zero and one.

VALUE:

A list of class "htest", containing the following components:

statistic
the F-statistic, with names attribute "F".
parameters
vector of length 2 giving the degrees of freedom of the F-distribution associated with statistic. Component parameters has names attribute c("num df", "denom df").
p.value
the p-value for the test.
conf.int
a confidence interval (vector of length 2) for the ratio of the true population variance for x to that for y. The confidence level is recorded in the attribute conf.level.
estimate
vector of length 2 giving the sample variances; these estimate the corresponding population parameters. Component estimate has a names attribute describing its elements.
null.value
always 1, the value of the ratio of population variances specified by the null hypothesis. Component null.value has names attribute "ratio of variances".
alternative
records the value of the input argument alternative: "greater", "less" or "two.sided".
method
character string giving the name of the method used.
data.name
character string (vector of length 1) containing the actual names of the input vectors x and y.

NULL HYPOTHESIS:

The null hypothesis states that the population variances are equal. The alternative hypothesis states that the variance of the population from which x is drawn is greater, less than, or simply not equal to the variance of the population from which y is drawn, depending on the value of input argument alternative.

TEST ASSUMPTIONS:

It is assumed that both x and y are drawn from normal populations. Outliers in the data may have a significant effect on the results through their relatively strong influence on the variance estimates.

DETAILS:

REFERENCES:

Box, G. E. P., Hunter, W. G. and Hunter, J. S. (1978). Statistics for Experimenters. New York: Wiley.

Snedecor, G. W. and Cochran, W. G. (1980). Statistical Methods, 7th ed. Ames, Iowa: Iowa State University Press.

SEE ALSO:

, .

EXAMPLES:

x <- rnorm(22); y <- rnorm(20,0,1.5)
var.test(x, y, conf.level=.9)
        # The null hypothesis is that 'x' and 'y' come from 
        # populations with the same variance. These populations
        # are assumed to be normal. The alternative hypothesis is
        # that the population variances are not equal. The 
        # confidence interval for the ratio of the population
        # variances will have a confidence level of 0.90.
   
var.test(x, y, alternative="greater")
        # The null hypothesis is as above. The alternative
        # hypothesis is that the population variance for
        # 'x' is greater than that for 'y'.