Learn R Programming

rrcov (version 0.4-01)

Wilks.test: 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, \dots, subset, na.action)

## S3 method for class 'default':
Wilks.test(x, grouping, method=c("c", "mcd", "rank"), 
    xd=NULL, xq=NULL, nrep=3000, trace=TRUE, ...)

## S3 method for class 'data.frame':
Wilks.test(x, \dots)

## S3 method for class 'matrix':
Wilks.test(x, grouping, \dots, subset, na.action)

Arguments

formula
A formula of the form groups ~ x1 + x2 + ... That is, the response is the grouping factor and the right hand side specifies the (non-factor) variables.
data
Data frame from which variables specified in formula are to be taken.
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 NAs are found. The default action is for the procedure to fail. An alternative is na.omit, which leads to rejection of cases with missing values on any required vari
method
"c" for standard estimators of the mean and variance, "mcd" for MCD estimators of mean and variances. "rank" for rank based wilks' lambda as proposed by Nath and Pavur (1985)
xd
multiplication factor for the approximate distribution of the robust Lambda statistic. If xd=NULL the factor will computed by simulation and will be returned in the value (see Details)
xq
the degrees of freedom for the approximate $\chi^2$ distribution of the robust Lambda statistic. If xq=NULL the degrees of freedom will computed by simulation and will be returned in the value (see Details)
nrep
number of trials for the simulations for computing the multiplication factor xd and the degrees of freedom xq. Default is nrep=3000.
trace
whether to print intermediate results. Default is trace = FALSE
...
arguments passed to or from other methods.

Value

  • A list with class "htest" containing the following components:
  • statisticthe value of the Wilks' Lambda statistic.
  • parameterThe corresponding approximation of the Wilks' lambda statistic and the degrees of freedom.
  • p.valuethe p-value for the test.
  • estimatethe estimated mean vectors.
  • methoda character string indicating what type of test was performed.
  • data.namea character string giving the name of the data.
  • xdmultiplication factor for the approximate distribution of the robust Lambda statistic.
  • xqthe degrees of freedom for the approximate $\chi^2$ distribution of the robust Lambda statistic.

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.

References

Todorov, V. and Filzmoser, P. (2007) A robust statistic for the one-way MANOVA manuscript. 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

CovMcd, T2.test

Examples

Run this code
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")

Run the code above in your browser using DataLab