How can I do a simple k nearest neighbor regression in R? My training data have 1 predictor and 1 outcome, both are numeric. I also need to use FPE and SC to find the optimal model. I know there is knn() in class package, but it's for knn classification. I also find a kknn package. What function should I use? Thanks in advance! Menghui
ksmooth() will work for you, since you only have one predictor. There are better choices, though, such as loess(). Andy> From: Menghui Chen > > How can I do a simple k nearest neighbor regression in R? My training > data have 1 predictor and 1 outcome, both are numeric. I also need to > use FPE and SC to find the optimal model. I know there is knn() in > class package, but it's for knn classification. I also find a kknn > package. What function should I use? > > Thanks in advance! > > Menghui > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > R-project.org/posting-guide.html > > >