[R] ctree question
seanstclair at verizon.net
seanstclair at verizon.net
Thu Jan 19 04:47:31 CET 2012
Hello. I have used the "party" package to generate a regression tree as
follows:
>origdata<-read.csv("origdata.csv")
>ctrl<-ctree_control(mincriterion=0.99,maxdepth=10,minbucket=10)
>test.ct<-ctree(Y~X1+X2+X3,data=origdata,control=ctrl)
The above works fine. Orig data was my training data. I now have a test
data file (testdata), and would like to run the testdata through the above
tree to see predictions. I tried using the following function
>predict(test.ct,newdata=testdata)
but I get the following error:
Error in checkData(oldData, RET) :
Levels in factors of new data do not match original data
I've looked at the testdata file closely and it does not appear to contain
any levels of factors that were not in the original. What might I be doing
incorrectly, and how can i use the tree that was generated above to generate
predictions for this new file testdata?
THanks.
sean
More information about the R-help
mailing list