# greedy.wilks

From klaR v0.6-11
by Uwe Ligges

##### Stepwise forward variable selection for classification

Performs a stepwise forward variable/model selection using the Wilk's Lambda criterion.

- Keywords
- multivariate

##### Usage

```
greedy.wilks(X, ...)
## S3 method for class 'default':
greedy.wilks(X, grouping, niveau = 0.2, ...)
## S3 method for class 'formula':
greedy.wilks(formula, data = NULL, ...)
```

##### Arguments

- X
- matrix or data frame (rows=cases, columns=variables)
- grouping
- class indicator vector
- formula
- formula of the form
`groups ~ x1 + x2 + ...`

- data
- data frame (or matrix) containing the explanatory variables
- niveau
- level for the approximate F-test decision
- ...
- further arguments to be passed to the default method, e.g.
`niveau`

##### Details

A stepwise forward variable selection is performed. The initial model is defined by starting with the variable which separates the groups most. The model is then extended by including further variables depending on the Wilk's lambda criterion: Select the one which minimizes the Wilk's lambda of the model including the variable if its p-value still shows statistical significance.

##### Value

- A list of two components, a
`formula`

of the form , and a data.frame`response ~ list + of + selected + variables`

`results`

containing the following variables: vars the names of the variables in the final model in the order of selection. Wilks.lambda the appropriate Wilks' lambda for the selected variables. F.statistics.overall the approximated F-statistic for the so far selected model. p.value.overall the appropriate p-value of the F-statistic. F.statistics.diff the approximated F-statistic of the partial Wilks's lambda (for comparing the model including the new variable with the model not including it). p.value.diff the appropriate p-value of the F-statistic of the partial Wilk's lambda.

##### concept

- Stepwise variable selection in classification
- Wilk's lambda

##### References

Mardia, K. V. , Kent, J. T. and Bibby, J. M. (1979), *Multivariate analysis*,
Academic Press (New York; London)

##### See Also

##### Examples

```
data(B3)
gw_obj <- greedy.wilks(PHASEN ~ ., data = B3, niveau = 0.1)
gw_obj
## now you can say stuff like
## lda(gw_obj$formula, data = B3)
```

*Documentation reproduced from package klaR, version 0.6-11, License: GPL-2*

### Community examples

Looks like there are no examples yet.