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.
getBestVar(currentVar, newVar, Sw, St, testStat = "Pillai")
A list containing:
A logical value indicating whether the best variable is collinear (i.e., should the selection stop).
The index of the selected variable from newVar
based on the
test statistic.
The value of the test statistic for the selected variable.
A vector of indices from newVar
representing collinear variables.
A numeric vector indicating the indices of currently selected variables.
A numeric vector indicating the indices of candidate variables to be tested.
A matrix representing the within-class scatter matrix.
A matrix representing the total scatter matrix.
A character string specifying the test statistic to use. Can
be either "Pillai"
or "Wilks"
. Default is "Pillai"
.