[R] a problem in random forest

From: Weiwei Shi <helprhelp_at_gmail.com>
Date: Wed 12 Oct 2005 - 04:27:33 EST

Hi, there:
I spent some time on this but I think I really cannot figure it out, maybe I missed something here:

my data looks like this:
> dim(trn3)

[1] 7361 209
> dim(val3)

[1] 7427 209

> mg.rf2<-randomForest(x=trn3[,1:208], y=trn3[,209], data=trn3, xtest=val3[,
1:208], ytest=val3[,209], importance=T)

my test data has 7427 observations but after prediction,
> dim(mg.rf2$votes)

[1] 7361 2

which has the same length as my training data.

but if I use
mg.rf<-randomForest(x=trn3[,1:208], y=trn3[,209], data=trn3, importance=T) followed by
> mg.pred<-predict(mg.rf, newdata=val3[,1:208])
> length(mg.pred)

[1] 7427

it works. But i need to know votes so I have to use the first way. Please help.


Weiwei Shi, Ph.D

"Did you always know?"
"No, I did not. But I believed..."
---Matrix III

	[[alternative HTML version deleted]]

R-help@stat.math.ethz.ch mailing list
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Wed Oct 12 04:32:44 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:40:41 EST