[R] kknn and logistic regression: how to cross-validate binary prediction

noclue_ tim.liu at netzero.net
Mon Mar 15 23:11:50 CET 2010


I am comparing kknn and logistic regression for binary outcome prediction -

For kknn, I can do -

kknn_<-kknn(out_come ~ age + gender , learn_, valid_)
fit<-fitted(kknn_)
table(valid_$out_come, fit)

to get validation results in cross-tabulation.

---------

For logistic, how can I do the equivalent cross-validation?

logit_<-glm(out_come ~ age + gender, data=learn_, family=binomial)
...
... 
then how could I fit the logistic regression on validation data (ie. valid_)
to get predicted outcome?

Thanks!
-- 
View this message in context: http://n4.nabble.com/kknn-and-logistic-regression-how-to-cross-validate-binary-prediction-tp1594107p1594107.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list