lrlda: Logratio Linear Discriminant Analysis

lrldaR Documentation

Logratio Linear Discriminant Analysis

Description

Function lrlda implements logratio linear discriminant analysis for compositional data, using the centred logratio transformation (clr)

Usage

lrlda(Xtrain, group, Xtest = NULL, divisorn = FALSE, verbose = FALSE)

Arguments

Xtrain

A compositional data set, the training data for logratio-LDA.

group

A categorical variable defining the groups.

Xtest

A compositional data set for which group prediction is sought (the test data). If no test data is supplied, the training data itself is classified.

divisorn

Use divisor "n" (divisorn=TRUE) in the calculation of covariance or use "n-1" (divisorn=TRUE)

verbose

Print output (verbose = TRUE) or not.

Details

Function lrlda uses the centred logratio transformation, which produces a singular covariance matrix. This singularity is dealt with by using a generalized inverse. When test data is supplied via argument Xtest, the scores of the linear classifier, the poster probabilities and the predicted classes are calculated for the test data. If no test data is supplied, these quantities are calculated for the training data.

Value

LD

Scores on the linear classifier for the test observations. These are also the biplot coordinates of the individuals.

Fp

Biplot coordinates of the group means.

Gs

Biplot coordinates of the variables.

Sp

Pooled covariance matrix.

Mc

Matrix of centred clr mean vectors, one row for each group.

S.list

Covariance matrices of each group.

la

Vector of eigenvalues.

pred

Predicted class for the test observations.

CM

The confusion matrix.

gsize

Sample size of each group.

Mclr

Matrix of mean vectors for clr coordinates, one row for each group.

prob.posterior

Vector of posterior probabilities.

decom

Table with decomposition of variability as expressed by the eigenvalues.

Author(s)

Jan Graffelman (jan.graffelman@upc.edu)

See Also

lrpca,lrlda

Examples

  data(Tubb)
  sampleid <- Tubb$Sample
  site     <- factor(Tubb$site)
  Oxides   <- as.matrix(Tubb[,2:10])
  rownames(Oxides) <- sampleid
  Oxides   <- Oxides/rowSums(Oxides)
  out.lda  <- lrlda(Oxides,site,verbose=FALSE)

ToolsForCoDa documentation built on April 3, 2025, 7:47 p.m.