folda {folda} | R Documentation |
Forward Uncorrelated Linear Discriminant Analysis
Description
This function fits a ULDA (Uncorrelated Linear Discriminant Analysis) model to the provided data, with an option for forward selection of variables based on Pillai's trace or Wilks' Lambda. It can also handle missing values, perform downsampling, and compute the linear discriminant scores and group means for classification. The function returns a fitted ULDA model object.
Usage
folda(
datX,
response,
subsetMethod = c("forward", "all"),
testStat = c("Pillai", "Wilks"),
correction = TRUE,
alpha = 0.1,
prior = NULL,
misClassCost = NULL,
missingMethod = c("medianFlag", "newLevel"),
downSampling = FALSE,
kSample = NULL
)
Arguments
datX |
A data frame containing the predictor variables. |
response |
A factor representing the response variable with multiple classes. |
subsetMethod |
A character string specifying the method for variable
selection. Options are |
testStat |
A character string specifying the test statistic to use for
forward selection. Options are |
correction |
A logical value indicating whether to apply a multiple
comparison correction during forward selection. Default is |
alpha |
A numeric value between 0 and 1 specifying the significance level for the test statistic during forward selection. Default is 0.1. |
prior |
A numeric vector representing the prior probabilities for each
class in the response variable. If |
misClassCost |
A square matrix |
missingMethod |
A character vector of length 2 specifying how to handle
missing values for numerical and categorical variables, respectively.
Default is |
downSampling |
A logical value indicating whether to perform
downsampling to balance the class distribution in the training data or
speed up the program. Default is |
kSample |
An integer specifying the maximum number of samples to take
from each class during downsampling. If |
Value
A list of class ULDA
containing the following components:
scaling |
The matrix of scaling coefficients for the linear discriminants. |
groupMeans |
The group means of the linear discriminant scores. |
prior |
The prior probabilities for each class. |
misClassCost |
The misclassification cost matrix. |
misReference |
A reference for handling missing values. |
terms |
The terms used in the model formula. |
xlevels |
The levels of the factors used in the model. |
varIdx |
The indices of the selected variables. |
varSD |
The standard deviations of the selected variables. |
varCenter |
The means of the selected variables. |
statPillai |
The Pillai's trace statistic. |
pValue |
The p-value associated with Pillai's trace. |
predGini |
The Gini index of the predictions on the training data. |
confusionMatrix |
The confusion matrix for the training data predictions. |
forwardInfo |
Information about the forward selection process, if applicable. |
stopInfo |
A message indicating why forward selection stopped, if applicable. |
References
Howland, P., Jeon, M., & Park, H. (2003). Structure preserving dimension reduction for clustered text data based on the generalized singular value decomposition. SIAM Journal on Matrix Analysis and Applications
Wang, S. (2024). A New Forward Discriminant Analysis Framework Based On Pillai's Trace and ULDA. arXiv preprint arXiv:2409.03136. Available at https://arxiv.org/abs/2409.03136.
Examples
# Fit the ULDA model
fit <- folda(datX = iris[, -5], response = iris[, 5], subsetMethod = "all")
# Fit the ULDA model with forward selection
fit <- folda(datX = iris[, -5], response = iris[, 5], subsetMethod = "forward")