greedy.wilks: Stepwise forward variable selection for classification

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/greedy.wilks.R

Description

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

Usage

1
2
3
4
5
greedy.wilks(X, ...)
## Default S3 method:
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 ‘response ~ list + of + selected + variables’, and a data.frame 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.

Author(s)

Andrea Preusser, Karsten Luebke ([email protected])

References

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

See Also

stepclass, manova

Examples

1
2
3
4
5
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)

Example output

Loading required package: MASS
Formula containing included variables: 

PHASEN ~ EWAJW + LSTKJW + ZINSK + CP91JW + IAU91JW + PBSPJW + 
    ZINSLR + PCPJW
<environment: 0x3804c10>


Values calculated in each step of the selection procedure: 

     vars Wilks.lambda F.statistics.overall p.value.overall F.statistics.diff
1   EWAJW    0.6058201             33.18341    1.405358e-16         33.183411
2  LSTKJW    0.4271561             26.85606    1.218146e-25         21.192038
3   ZINSK    0.3614525             21.20584    7.607587e-29          9.149422
4  CP91JW    0.3002868             19.05337    1.153881e-32         10.184539
5 IAU91JW    0.2624925             17.11094    6.597858e-35          7.151127
6  PBSPJW    0.2451025             14.99388    3.695840e-35          3.500196
7  ZINSLR    0.2205325             13.94619    1.442943e-36          5.459204
8   PCPJW    0.1999847             13.10739    9.454573e-38          5.000333
  p.value.diff
1 1.405358e-16
2 1.554268e-11
3 1.326989e-05
4 3.783582e-06
5 1.604993e-04
6 1.708972e-02
7 1.379166e-03
8 2.486333e-03

klaR documentation built on May 29, 2017, 11:01 a.m.

Related to greedy.wilks in klaR...