Learn R Programming

wle (version 0.9-91)

wle.var.test: Weighted F Test to Compare Two Variances

Description

Performs an Weighted F test to compare the variances of two samples from normal populations. The WF-test is based on weighted likelihood.

Usage

wle.var.test(x, y, ratio = 1, alternative = c("two.sided", "less", "greater"), conf.level = 0.95, x.root=1, y.root=1)

Arguments

x, y
fitted linear model objects (inheriting from class "wle.lm") or fitted normal model objects (inheriting from class "wle.normal").
ratio
the hypothesized ratio of the population variances of x and y.
alternative
the alternative hypothesis; must be one of "two.sided" (default), "greater" or "less". You can specify just the initial letter.
conf.level
confidence level for the returned confidence interval.
x.root
the 'x' root used.
y.root
the 'y' root used.

Value

A list with class "htest" containing the following components:
statistic
the value of the WF test statistic.
parameter
the degrees of the freedom of the WF distribtion of the test statistic.
p.value
the p-value of the test.
conf.int
a confidence interval for the ratio of the population variances.
estimate
the ratio of the sample variances from x and y.
null.value
the ratio of population variances under the null.
alternative
a character string describing the alternative hypothesis.
method
the string "WF test to compare two variances".
data.name
a character string giving the names of the data.

Details

The null hypothesis is that the ratio of the variances in the data to which the normal model (wle.normal) or linear models (wle.lm) x and y were fitted, is equal to ratio.

References

Agostinelli, C., (1998). Inferenza statistica robusta basata sulla funzione di verosimiglianza pesata: alcuni sviluppi, Ph.D Thesis, Department of Statistics, University of Padova (in italian).

Agostinelli, C., (2001) Un approccio robusto alla verifica d'ipotesi basato sulla funzione di verosimiglianza pesata - Robust Testing Hypotheses via Weighted Likelihood function, in press Statistica, (in italian).

Agostinelli, C., and Markatou, M., (2001) Test of hypotheses based on the Weighted Likelihood Methodology, Statistica Sinica, vol. 11, n. 2, 499-514.

Examples

Run this code

set.seed(2345)

x <- rnorm(50,0,1)
y <- rnorm(50,10,1)

res.x <- wle.normal(x,group=5)
res.y <- wle.normal(y,group=5)

wle.var.test(res.x, res.y) # Do x and y have the same variance?

set.seed(2345)

x <- c(rnorm(50,0,1),rnorm(20,10,1))
y <- c(rnorm(50,10,1),rnorm(10,0,5))

res.x <- wle.normal(x,group=5,num.sol=2)
res.y <- wle.normal(y,group=5)

res.x
wle.var.test(res.x, res.y, x.root=1)
if (res.x$tot.sol>1) wle.var.test(res.x, res.y, x.root=2)

Run the code above in your browser using DataLab