Wilks.test {rrcov} | R Documentation |
Classical and Robust One-way MANOVA: Wilks Lambda
Description
Classical and Robust One-way MANOVA: Wilks Lambda
Usage
## S3 method for class 'formula'
Wilks.test(formula, data, ..., subset, na.action)
## Default S3 method:
Wilks.test(x, grouping, method=c("c", "mcd", "rank"),
approximation=c("Bartlett", "Rao", "empirical"),
xd=NULL, xq=NULL, xfn = NULL, xwl=NULL, nrep=3000, trace=FALSE, ...)
## S3 method for class 'data.frame'
Wilks.test(x, ...)
## S3 method for class 'matrix'
Wilks.test(x, grouping, ..., subset, na.action)
Arguments
formula |
A formula of the form |
data |
Data frame from which variables specified in |
x |
(required if no formula is given as the principal argument.) a matrix or data frame or Matrix containing the explanatory variables. |
grouping |
grouping variable - a factor specifying the class for each observation (required if no formula argument is given.) |
subset |
An index vector specifying the cases to be used. |
na.action |
A function to specify the action to be taken if |
method |
|
approximation |
|
xd |
multiplication factor for the approximate distribution of
the robust Lambda statistic. If |
xq |
the degrees of freedom for the approximate |
xfn |
the empirical distribution function. If |
xwl |
the simulated values of the robust statistic. If |
nrep |
number of trials for the simulations for computing the
multiplication factor |
trace |
whether to print intermediate results. Default is |
... |
arguments passed to or from other methods. |
Details
The classical Wilks' Lambda statistic for testing the equality of
the group means of two or more groups is modified into a robust
one through substituting the classical estimates by the highly robust
and efficient reweighted MCD estimates, which can be computed efficiently
by the FAST-MCD algorithm - see CovMcd
.
An approximation for the finite sample distribution of the
Lambda statistic is obtained, based on matching the mean and
variance of a multiple of an \chi^2
distribution which
are computed by simultaion.
Value
A list with class "htest"
containing the following components:
statistic |
the value of the Wilks' Lambda statistic. |
parameter |
The corresponding approximation of the Wilks' lambda statistic and the degrees of freedom. |
p.value |
the p-value for the test. |
estimate |
the estimated mean vectors. |
method |
a character string indicating what type of test was performed. |
data.name |
a character string giving the name of the data. |
xd |
multiplication factor for the approximate distribution of the robust Lambda statistic. |
xq |
the degrees of freedom for the approximate |
Note
This function may be called giving either a formula and optional data frame, or a matrix and grouping factor as the first two arguments. All other arguments are optional.
Author(s)
Valentin Todorov valentin.todorov@chello.at
References
Todorov, V. and Filzmoser, P. (2007) Robust statistic for the one-way MANOVA, submetted to the Journal of Environmetrics.
Todorov, V. (2007) Robust selection of variables in linear discriminant analysis, Statistical Methods and Applications, 15, 395.407, doi:10.1007/s10260-006-0032-6.
Nath, R. and Pavur, R. (1985) A new statistic in the one way multivariate analysis of variance, Computatational Statistics and Data Analysis, 2, 297–315
See Also
Examples
library(MASS)
data(anorexia)
grp <- as.factor(anorexia[,1])
x <- as.matrix(anorexia[,2:3])
## Using the default interface, classical test
Wilks.test(x, grouping=grp, method="c")
## Using the default interface, rank based test
Wilks.test(x, grouping=grp, method="rank")
## For this data set: p=2, n=n1+n2+n3=29+26+17
## were computed the following multiplication factor xd and degrees of freedom xq
## for the MCD estimates with alpha=0.5
xd <- -0.02162666
xq <- 3.63971
Wilks.test(x, grouping=grp, method="mcd", xd=xd, xq=xq)
## Now the same with the formula interface
Wilks.test(Treat~Prewt+Postwt, data=anorexia, method="mcd", xd=xd, xq=xq)
##Iris data with formula interface
data(iris)
Wilks.test(Species~., data=iris, method="c")
## and with default interface
Wilks.test(iris[,1:4],grouping=iris[,5], method="c")
# hemophilia data - classical, rank and MCD test
data(hemophilia)
hemophilia$gr <- as.factor(hemophilia$gr)
Wilks.test(gr~., data=hemophilia, method="c")
Wilks.test(gr~., data=hemophilia, method="rank")
## already simulated parameters for MCD with alpha=0.5
xd <- -0.01805436
xq <- 1.950301
Wilks.test(gr~., data=hemophilia, xd=xd, xq=xq, method="mcd")