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 1 206.943 194.927 2 212.915 194.665 3 202.583 190.775 4 211.161 195.173 5 236.943 206.221 6 216.064 202.788 7 204.622 200.676 8 211.095 198.127 9 218.177 193.999 10 203.793 201.034 11 201.891 213.712 12 200.383 206.130 13 209.506 221.207 14 210.016 189.553 15 224.116 196.338 16 189.962 197.467 17 215.364 174.067 18 212.991 176.234 19 219.352 176.292 20 212.911 182.438 21 215.019 173.041 22 238.305 179.417 23 241.800 183.768 24 232.937 186.078 25 232.227 183.254 26 231.380 189.176 27 232.432 192.793 28 216.651 200.851 29 230.453 201.646 30 226.647 201.082 31 235.176 187.940 32 231.627 180.943 > train; V1 V2 1 226.277 203.163 2 205.268 181.653 3 225.536 182.627 4 217.273 183.053 5 208.796 198.148 6 232.581 184.962 7 210.914 184.366 8 192.638 196.933 9 226.509 207.898 10 207.393 187.710 11 220.076 186.476 12 213.391 194.591 > 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] m h h h m h h m m h h m Levels: h m $posterior h m 1 0.43306157 0.56693843 2 0.69634742 0.30365258 3 0.94711811 0.05288189 4 0.87188448 0.12811552 5 0.20030848 0.79969152 6 0.96391965 0.03608035 7 0.73455164 0.26544836 8 0.04955353 0.95044647 9 0.27089311 0.72910689 10 0.52678907 0.47321093 11 0.84342044 0.15657956 12 0.41990075 0.58009925 $x LD1 1 0.3909138 2 -0.1806083 3 -1.2491684 4 -0.7461128 5 0.9705780 6 -1.4570665 7 -0.2782810 8 1.7865350 9 0.7656043 10 0.1951116 11 -0.6245528 12 0.4188886 >