Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

Would any R expert explain the predic function in the randomforest package to me?

I want to get two prediction results for numberic response variable A and B seperately from following regression

result <-randomforest(A + B ~ C + D + E, data = dataset)
predict(result)

I can get one prediction result. But prediction is neither A nor B. I can get the prediction results for both A and B from Mvpart and party package.

Thanks in advance!

share|improve this question
1  
The RF algorithm, as implemented in the randomForest package with formula notation, considers one response variable only (factor or numeric). Can you provide more information on the type of variables you have, and what you want to achieve? – chl Oct 30 '12 at 22:53
1  
You seem to have lost your account information, James. This is a repost of an earlier question. I will merge your two accounts and merge this question with the other. – chl Nov 1 '12 at 22:35

2 Answers

Build two forests using the same input data and different response variables, one forest for A and one for B.

You can then combine the output of the two trees to create a prediction {A,B}.

share|improve this answer

Random Forest does not fit multiple response. You need to fit separate models for A and B. In your case Random Forest has treated the sum(A,B) as single dependent variable. So the prediction also corresponds to sum(A,B).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.