RF trains fine with X, but fails on prediction

> library(randomForest)
> chirps <-
c(20,16.0,19.8,18.4,17.1,15.5,14.7,17.1,15.4,16.2,15,17.2,16,17,14.1)
> temp <-
c(88.6,71.6,93.3,84.3,80.6,75.2,69.7,82,69.4,83.3,78.6,82.6,80.6,83.5,76
.3)
> X <- cbind(1,chirps)
> rf <- randomForest(X, temp)
> yp <- predict(rf, X)
Error in predict.randomForest(rf, X) : subscript out of bounds

BTW: Just find out that  apparently predict() does not like NULL name in
X, because this works fine:

> one <- rep(1, length(chirps))
> X <- cbind(one,chirps)
> rf <- randomForest(X, temp)
> yp <- predict(rf, X)

Ryszard Czerminski
AstraZeneca Pharmaceuticals LP
35 Gatehouse Drive
Waltham, MA 02451
USA
781-839-4304
ryszard.czermin...@astrazeneca.com


--------------------------------------------------------------------------
Confidentiality Notice: This message is private and may ...{{dropped:11}}

______________________________________________
R-help@r-project.org 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.

Reply via email to