tda: Transformation Discriminant Analysis

View source: R/tda.R

tdaR Documentation

Transformation Discriminant Analysis

Description

Implements discriminant analysis methods including traditional linear (LDA), quadratic (QDA), transformation (TDA), mixture (MDA) discriminant analysis, and their combinations such as TQDA or TLMDA. The user chooses a specific method by specifying options for common or varying transformation parameters as well as covariance matrices.

Usage

tda(x, ID, max_k, trans = TRUE, common_lambda = FALSE,
                 common_sigma = FALSE, iter = 50, subgroup = NULL, 
                 tol= 0.001, lambda0 = 0.015, iter.max = 1,
                 nstart = 10, criterion = "BIC")

Arguments

x

A frame or matrix containing a training data set

max_k

The maximum number of mixture components within each class to be fitted

ID

A variable containing class memberships for all observations

trans

A transformation indicator: 'trans = TRUE' if transformation is needed, 'trans = FALSE' if transformation is not needed

common_lambda

A parameter that regulates transformations. If 'common_lambda = TRUE', each mixture component or class has the same transformation parameter vector. If 'common_lambda = FALSE', each component or class has a different transformation vector

common_sigma

A homoscedasticity parameter: if 'common_sigma = TRUE', all subgroups across all classes have a common covariance matrix, if 'common_sigma = FALSE', groups have varying covariance matrices

iter

A maximum number of iterations of the EM algorithm; the default value is 50

subgroup

A vector containing the number of mixture components per each class to be fitted

tol

Tolerance level for a stopping critetion based on the relative difference in two consecutive log-likelihood values

lambda0

Starting value for transformation parameters

iter.max

The maximum number of iterations for the K-means algorithm used to initialize EM; default value is 1

nstart

The number of random starts for the K-means algorithm used to initialize EM; default value is 10

criterion

BIC or AIC; BIC is chosen by default.

Value

criterion

Values of the Bayesian or Akaike’s Information Criterion calculated for each evaluated model (BIC is default).

subprior

Estimated component priors for each class.

mu

Estimated component means for each class.

sigma

Estimated component covariance matrices for each group.

lambda

Estimated transformation parameters.

loglik

The log-likelihood value for the model with the lowest BIC.

pred_ID

Estimated classification of observations in the training data set.

prior

Estimated class priors.

misclassification_rate

Misclassification rate for the training data set.

ARI

Adjusted Rand index value.

Z

Matrix of posterior probabilities for the training data set.

See Also

summary.tda, predict.tda

Examples


set.seed(123)
# Example 1:
MDA <- tda(x = iris[,1:4],ID = iris$Species, max_k = 2, trans = FALSE)
print(MDA)
summary(MDA)

# Example 2:
LDA <- tda(x = iris[,1:4], ID = iris$Species, max_k = 1, trans = FALSE,
        common_sigma = TRUE)
print(LDA)
summary(LDA)

# Example 3:
QDA <-  tda(x = iris[,1:4], ID = iris$Species, subgroup = c(1, 1, 1), 
        trans = FALSE, common_sigma = FALSE)
print(QDA)
summary(QDA)

# Example 4:
TQDA <- tda(x = iris[,1:4], ID = iris$Species, subgroup = c(1, 1, 1), 
        trans = TRUE, common_sigma = FALSE, common_lambda = TRUE)
print(TQDA)
summary(TQDA)

transDA documentation built on Aug. 21, 2026, 5:14 p.m.