Hi R folks, How can I generate the discriment function from lda?
I have an unbalanced data set. one class has about 25 entries and another class has about 200 entries. I used lda for classification > z<- lda(V3 ~ V1+V2, data) > z Prior probabilities of groups: 0 1 0.91111111 0.08888889 Group means: V1 V2 0 0.4445161 0.04723951 1 0.4058900 0.06934000 Coefficients of linear discriminants: LD1 V1 -30.24734 V2 12.56484 predict(z) only give me 11 errors. I used the following equations to reconstruct the discrimiat function: >gmean <- z$prior %*% z$means >const <- as.numeric(gmean %*% z$scaling) >slope <- -z$scaling[1]/z$scaling[2] >intercept <- const/z$scaling[2] >abline(intercept, slope) however, this line gives about 50 errors, not the same one used by the predict(z). Any suggestions? Thanks. Janet ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html