Learn R Programming

folda (version 0.1.0)

getBestVar: Select Best Variable at Current Step Based on Multivariate Test Statistics

Description

This function selects the best variable based on the specified multivariate test statistic (Pillai or Wilks). It evaluates the statistic for each candidate variable in newVar when combined with currentVar, and returns the index and test statistic of the best variable. It also identifies collinear variables.

Usage

getBestVar(currentVar, newVar, Sw, St, testStat = "Pillai")

Value

A list containing:

stopflag

A logical value indicating whether the best variable is collinear (i.e., should the selection stop).

varIdx

The index of the selected variable from newVar based on the test statistic.

stat

The value of the test statistic for the selected variable.

collinearVar

A vector of indices from newVar representing collinear variables.

Arguments

currentVar

A numeric vector indicating the indices of currently selected variables.

newVar

A numeric vector indicating the indices of candidate variables to be tested.

Sw

A matrix representing the within-class scatter matrix.

St

A matrix representing the total scatter matrix.

testStat

A character string specifying the test statistic to use. Can be either "Pillai" or "Wilks". Default is "Pillai".