# NOT RUN {
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)
par(mfrow=c(1,2))
classplot(fm.qda, xlim=xlim, ylim=ylim, main="QDA")
classplot(fm.lda, xlim=xlim, ylim=ylim, main="LDA")
# install.packages("e1071")
# library(e1071)
# Support vector machine
# }
# NOT RUN {
fm.svm = svm(vowlax.fdat.5[temp,1:2], factor(vowlax.l[temp]))
# }
# NOT RUN {
xlim = range(vowlax.fdat.5[temp,1])
# }
# NOT RUN {
ylim = range(vowlax.fdat.5[temp,2])
# }
# NOT RUN {
classplot(fm.svm, xlim=xlim, ylim=ylim, xlab="F1", ylab="F2", main="SVM")
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab