[R] randomForest, 'No forest component...' error while calling Predict()

Jim_S virtualreal at gmail.com
Mon Jun 16 00:13:45 CEST 2008


Dear R-users,

While making a prediction using the randomForest function (package
randomForest) I'm getting the following error message: 

"Error in predict.randomForest(model, newdata = CV) :  No forest component
in the object"
Here's my complete code. For reproducing this task, please find my 2 data
sets attached ( http://www.nabble.com/file/p17855119/data.rar data.rar ).

Thanks in advance for any help!

 - Jim

CT <- read.table("CT.txt",header=TRUE,sep="\t")
CV <- read.table("CV.txt",header=TRUE,sep="\t")
# Both CT & CV have the syntaxis X1, X2,...,X97,Y where all variables are
numeric 
x <- CT[,-98]
y <- CT[,98]
xtest <- CV[,-98]
ytest <- CV[,98]
library(randomForest)
model <- randomForest(x ,y , xtest,
ytest,ntree=500,mtry=32,nodesize=5,nPerm=2)
model

#Call:
# randomForest(x = x, y = y, xtest = xtest, ytest = ytest, ntree = 500,     
mtry = 32, nodesize = 5, 
# nPerm = 2) 
#               Type of random forest: regression
#                    Number of trees: 500
#No. of variables tried at each split: 32
#
#          Mean of squared residuals: 0.0022117
#                    % Var explained: -1.01
#                       Test set MSE: 0
#                    % Var explained: 2.61
 

prediction <- predict(model, newdata= CT)
#Error in predict.randomForest(model, newdata = CV) : 
#  No forest component in the object
# 
-- 
View this message in context: http://www.nabble.com/randomForest%2C-%27No-forest-component...%27-error-while-calling-Predict%28%29-tp17855119p17855119.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list