R : Copyright 2003, The R Development Core Team Version 1.7.0 (2003-04-16) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type `license()' or `licence()' for distribution details. R is a collaborative project with many contributors. Type `contributors()' for more information. Type `demo()' for some demos, `help()' for on-line help, or `help.start()' for a HTML browser interface to help. Type `q()' to quit R. > library(MASS); > test <- read.table("madham1.txt", sep=""); > train <- read.table("disputed1.txt", sep=""); > cl <- factor(c(rep("m",14), rep("h",18))) > > test; V1 V2 V3 1 27.036 206.943 95.794 2 18.250 212.915 113.243 3 21.033 202.583 88.930 4 29.261 211.161 88.386 5 20.353 236.943 76.805 6 18.254 216.064 91.271 7 26.494 204.622 104.284 8 18.732 211.095 97.983 9 30.877 218.177 91.756 10 18.276 203.793 121.724 11 10.875 201.891 90.780 12 17.625 200.383 101.533 13 14.991 209.506 85.558 14 23.694 210.016 97.469 15 24.621 224.116 100.379 16 26.266 189.962 96.623 17 20.870 215.364 116.341 18 23.162 212.991 98.187 19 26.849 219.352 100.304 20 28.869 212.911 109.864 21 22.388 215.019 106.343 22 27.518 238.305 97.964 23 23.129 241.800 93.776 24 20.034 232.937 100.170 25 27.383 232.227 114.797 26 22.344 231.380 110.725 27 24.324 232.432 85.135 28 24.309 216.651 94.196 29 27.043 230.453 85.832 30 28.024 226.647 92.429 31 30.151 235.176 109.548 32 36.999 231.627 96.300 > train; V1 V2 V3 1 21.290 226.277 107.664 2 17.257 205.268 96.276 3 25.118 225.536 88.435 4 21.727 217.273 114.612 5 23.611 208.796 82.407 6 19.549 232.581 96.241 7 29.007 210.914 117.011 8 29.448 192.638 101.840 9 18.611 226.509 107.127 10 28.325 207.393 98.896 11 34.439 220.076 91.138 12 22.757 213.391 92.348 > cl; [1] m m m m m m m m m m m m m m h h h h h h h h h h h h h h h h h h Levels: h m > > z <- lda(test, cl); > > predict(z, train); $class [1] h m h h m h h m h m h m Levels: h m $posterior h m 1 0.84895002 0.1510500 2 0.07642057 0.9235794 3 0.66458531 0.3354147 4 0.78798756 0.2120124 5 0.10783580 0.8921642 6 0.76868996 0.2313100 7 0.88626149 0.1137385 8 0.20439877 0.7956012 9 0.77378023 0.2262198 10 0.49121862 0.5087814 11 0.87246060 0.1275394 12 0.29604457 0.7039554 $x LD1 1 -0.7615787 2 1.7201800 3 -0.1482016 4 -0.5182784 5 1.4972283 6 -0.4524405 7 -0.9537943 8 1.0536273 9 -0.4694147 10 0.2747550 11 -0.8771848 12 0.7636922 >