[R] Discriminant Analysis- Apparent error rate

Luis Ridao Cruz Luisr at frs.fo
Thu Nov 9 12:59:10 CET 2006


R-help,

I'm trying to evaluate the misclasification rate 
of an estimated discrimated function (hyDA)

hyDA <- with(hyB, lda(Maturity ~ Length + Weight))

, so here is what I do (code from S-plus 6.1
Guide to Statistics Vol. 2 p 101)


test <- predict(hyDA)

tbl <- table(hyB$Maturity, test$class)

tbl <- tbl[-2,-2]

tbl1 <- cbind(tbl, error = (apply(tbl, 1, sum) - diag(tbl)) /
hyDA$counts)

sum(hyDA$prior * tbl1[,'error'])


The error rates I get is 0.57 which is very large
I was wondering if I'm doing something wrong.

Thanks in advance.

> version
               _                           
platform       i386-pc-mingw32             
arch           i386                        
os             mingw32                     
system         i386, mingw32               
status                                     
major          2                           
minor          4.0                         
year           2006                        
month          10                          
day            03                          
svn rev        39566                       
language       R                           
version.string R version 2.4.0 (2006-10-03)
>



More information about the R-help mailing list