[R] predict () for LDA and GLM
palanski
palanski at gmail.com
Thu Mar 22 03:24:09 CET 2012
Hi!
I'm using GLM, LDA and NaiveBayes for binomial classification. My training
set is 70 rows long with 32 features, and my test set is 30 rows long with
32 features.
Using Naive Bayes, I can train a model, and then predict the test set with
it like so:
ass4q1.dLDA = lda(ass4q1.trainSet[,1]~ass4q1.trainSet[,2:3])
table(predict(ass4q1.dNB, ass4q1.testSetDF[,2:3]), ass4q1.testSetDF[,1])
However, when the same is done for LDA or GLM, suddenly it tells me that the
number of rows doesn't match and doesn't predict my test data. The error for
GLM, as an example, is:
Error in table(predict(ass4q1.dGLM, ass4q1.testSetDF[, 2:3]),
ass4q1.testSetDF[, :
all arguments must have the same length
In addition: Warning message:
'newdata' had 30 rows but variable(s) found have 70 rows
What am I missing?
--
View this message in context: http://r.789695.n4.nabble.com/predict-for-LDA-and-GLM-tp4494381p4494381.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list