[R] naiveBayes question

From: David Meyer <david.meyer_at_wu-wien.ac.at>
Date: Mon 22 Jan 2007 - 15:26:09 GMT


Aimin:

The problem is that the columns you choose for training (only 4 variables) do not match the ones used for prediction (all except y).

David


I try to use naiveBayes

> p.nb.90<-naiveBayes(y~aa_three+bas+bcu+aa_ss,data=training)
>
pr.nb.90<-table(predict(p.nb.90,training[,-13],type="class"),training[,13])

bur I get this error
Error in object$tables[[v]] : subscript out of bounds
>

head is data set
> head(training)

      pr aa_three aa_one aa_ss aa_pos    aas bas   ams bms        acu
bcu     omega       y index
1 1acx      ALA      A     C      1 127.71   0 69.99   0
-0.2498560   0  79.91470 outward  TRUE
2 1acx      PRO      P     C      2  68.55   0 55.44   0
-0.0949008   0  76.60380 outward  TRUE
3 1acx      ALA      A     E      3  52.72   0 47.82   0
-0.0396550   0  52.19970 outward  TRUE
4 1acx      PHE      F     E      4  22.62   0 31.21   0  0.1270330   0
169.52500  inward  TRUE
5 1acx      SER      S     E      5  71.32   0 52.84   0
-0.1312380   0   7.47528 outward  TRUE
6 1acx      VAL      V     E      6  12.92   0 22.40   0  0.1728390   0
149.09400 inward TRUE

anyone know why?

Aimin



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 and provide commented, minimal, self-contained, reproducible code. Received on Tue Jan 23 02:31:05 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 22 Jan 2007 - 16:30:32 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.