library(MASS)
# Data from female speaker 68
temp = vowlax.spkr=="68"
# Quadratic discriminant analysis
fm.qda = qda(vowlax.fdat.5[temp,1:2], vowlax.l[temp])
# Linear discriminant analysis
fm.lda = lda(vowlax.fdat.5[temp,1:2], vowlax.l[temp])
xlim=c(0,1000)
ylim=c(0,3000)
oldpar = par(mfrow=c(1,2))
classplot(fm.qda, xlim=xlim, ylim=ylim, main="QDA")
classplot(fm.lda, xlim=xlim, ylim=ylim, main="LDA")
par(oldpar)
# install.packages("e1071")
# library(e1071)
# Support vector machine
if (FALSE) fm.svm = svm(vowlax.fdat.5[temp,1:2], factor(vowlax.l[temp]))
if (FALSE) xlim = range(vowlax.fdat.5[temp,1])
if (FALSE) ylim = range(vowlax.fdat.5[temp,2])
if (FALSE) classplot(fm.svm, xlim=xlim, ylim=ylim, xlab="F1", ylab="F2", main="SVM")
Run the code above in your browser using DataLab