1
$\begingroup$

I am trying to understand how to interpret the output for cvFit().

The data is from UCI's ML repository. This is my model

model <- rpart(religion ~ circles + crosses + saltires + quarters + sunstars + 
                          crescent + triangle, data=traindata, method="class", 
               control=rpart.control(minsplit = 10))

cvFit(model, data=traindata, y=traindata$religion)
5-fold CV results:
       0        1        2        3        4        5        6        7 
2.832850 2.840462 2.831809 2.971322 2.966501 2.866607 2.922170 2.974040 

Conceptually I understand the concept of cross validation but I don't understand what this output is or if I'm using the cvFit() function correctly. Also when you use printcp(), is the xerror column referring to cross-validated error?

printcp(model)

Classification tree:
  rpart(formula = religion ~ circles + crosses + saltires + quarters + 
                             sunstars + crescent + triangle, data = traindata, 
        method = "class", control = rpart.control(minsplit = 10))

Variables actually used in tree construction:
[1] circles  crescent crosses  quarters sunstars triangle

Root node error: 109/150 = 0.72667

n= 150 

        CP nsplit rel error  xerror     xstd
1 0.082569      0   1.00000 1.04587 0.047988
2 0.055046      1   0.91743 0.99083 0.050450
3 0.021407      2   0.86239 0.86239 0.054348
4 0.012232      5   0.79817 0.90826 0.053227
5 0.010000      8   0.76147 0.88991 0.053710
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.