Learn R Programming

Momocs (version 1.4.1)

LDA: Linear Discriminant Analysis on Coe objects

Description

Calculates a LDA on Coe on top of MASS::lda.

Usage

LDA(x, fac, retain, ...)

# S3 method for default LDA(x, fac, retain, ...)

# S3 method for PCA LDA(x, fac, retain = 0.99, ...)

Value

a 'LDA' object on which to apply plot.LDA, which is a list with components:

  • x any Coe object (or a matrix)

  • fac grouping factor used

  • removed ids of columns in the original matrix that have been removed since constant (if any)

  • mod the raw lda mod from lda

  • mod.pred the predicted model using x and mod

  • CV.fac cross-validated classification

  • CV.tab cross-validation tabke

  • CV.correct proportion of correctly classified individuals

  • CV.ce class error

  • LDs unstandardized LD scores see Claude (2008)

  • mshape mean values of coefficients in the original matrix

  • method inherited from the Coe object (if any)

Arguments

x

a Coe or a PCA object

fac

the grouping factor (names of one of the $fac column or column id)

retain

the proportion of the total variance to retain (if retain<1) using scree, or the number of PC axis (if retain>1).

...

additional arguments to feed lda

See Also

Other multivariate: CLUST(), KMEANS(), KMEDOIDS(), MANOVA_PW(), MANOVA(), MDS(), MSHAPES(), NMDS(), PCA(), classification_metrics()

Examples

Run this code
bot.f <- efourier(bot, 24)
bot.p <- PCA(bot.f)
LDA(bot.p, 'type', retain=0.99) # retains 0.99 of the total variance
LDA(bot.p, 'type', retain=5) # retain 5 axis
bot.l <- LDA(bot.p, 'type', retain=0.99)
plot_LDA(bot.l)
bot.f <- mutate(bot.f, plop=factor(rep(letters[1:4], each=10)))
bot.l <- LDA(PCA(bot.f), 'plop')
plot_LDA(bot.l) # will replace the former soon

Run the code above in your browser using DataLab