## x -0.6514575 0.003359 ## y -0.0001298 0.034739 ## ## Proportion of trace: ## LD1 LD2 ## 0.9969 0.0031 lda.pred5 = predict(lda.fit5, newdata = test.df5) lda.class5 = lda.pred5$class table(lda.class5, test.df5$colors5) ## ## lda.class5 blue cyan green orange purple ## blue 1192 0 77 0 0 ## cyan 0 1286 0 0 51 ## green 78 0 253 13 0 ## orange 0 0 122 709 0 ## purple 20 84 0 0 1115 mean(lda.class5 != test.df5$colors5) # perc errors 0.097 ## [1] 0.089 Validation approach for QDA qda.fit5 = qda(colors5 ~ x+y, data = train.df5) qda.fit5 ## Call: ## qda(colors5 ~ x + y, data = train.df5) ## ## Prior probabilities of groups: ## blue cyan green orange purple ## 0.2634 0.2784 0.0886 0.1424 0.2272 ## ## Group means: ## x y ## blue 2.755 55.04 ## cyan -7.261 48.51 ## green 5.653 34.29 ## orange 8.520 50.61 ## purple -2.385 54.87 qda.class5 = predict(qda.fit5, newdata = test.df5)$class table(qda.class5, test.df5$colors5) ## ## qda.class5 blue cyan orange purple
## x -0.6514575 0.003359 ## y -0.0001298 0.034739 ## ## Proportion of trace: ## LD1 LD2 ## 0.9969 0.0031 lda.pred5 = predict(lda.fit5, newdata = test.df5) lda.class5 = lda.pred5$class table(lda.class5, test.df5$colors5) ## ## lda.class5 blue cyan green orange purple ## blue 1192 0 77 0 0 ## cyan 0 1286 0 0 51 ## green 78 0 253 13 0 ## orange 0 0 122 709 0 ## purple 20 84 0 0 1115 mean(lda.class5 != test.df5$colors5) # perc errors 0.097 ## [1] 0.089 Validation approach for QDA qda.fit5 = qda(colors5 ~ x+y, data = train.df5) qda.fit5 ## Call: ## qda(colors5 ~ x + y, data = train.df5) ## ## Prior probabilities of groups: ## blue cyan green orange purple ## 0.2634 0.2784 0.0886 0.1424 0.2272 ## ## Group means: ## x y ## blue 2.755 55.04 ## cyan -7.261 48.51 ## green 5.653 34.29 ## orange 8.520 50.61 ## purple -2.385 54.87 qda.class5 = predict(qda.fit5, newdata = test.df5)$class table(qda.class5, test.df5$colors5) ## ## qda.class5 blue cyan orange purple
IraAppliedStats.docx