Linear discriminant analysis (LDA) is used to find the linear combinations of explanatory variables that give the best possible separation between the groups in our dataset. More specifically, LDA is used as a linear supervised classifier to form a classification model from the data provided. For example, we can use LDA to classify fish based on their length, weight, and speed underwater. Let's simulate a dataset based on the Ontario warm water fish species Bluegill, Bowfin, Carp, Goldeye, and Largemouth Bass.
> set.seed(459) > Bluegill.length <- sample(seq(15, 22.5, by=0.5), 50, replace=T) > Bluegill.weight <- sample(seq(0.2, 0.8, by=0.05), 50, replace=T) > Bowfin.length <- sample(seq(46, 61, by=0.5), 50, replace=T) > Bowfin.weight <- sample(seq(1.36, 3.2, by=0.5), 50, replace=T) > Carp.length <- sample(seq(30, 75, by=1), 50, replace=T) > Carp.weight <- sample(seq(0.2, 3.5, by=0.1), 50, replace=T) > Goldeye.length <...