tda {transDA}R 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, max_k, ID, trans = TRUE, common_lambda = FALSE,
                 common_sigma = FALSE, iter = 50, subgroup = NULL, 
                 tol= 0.001, lambda0 = 0.015)

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

Value

BIC

Values of the Bayesian Information Criterion calculated for each evaluated model

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], max_k = 2,ID = iris$Species, trans = FALSE)
print(MDA)
summary(MDA)

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

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

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

[Package transDA version 1.0.1 Index]