cv.tree | R Documentation |

Runs a K-fold cross-validation experiment to find the deviance or
number of misclassifications as a function of the cost-complexity
parameter `k`

.

cv.tree(object, rand, FUN = prune.tree, K = 10, ...)

`object` |
An object of class |

`rand` |
Optionally an integer vector of the length the number of
cases used to create |

`FUN` |
The function to do the pruning. |

`K` |
The number of folds of the cross-validation. |

`...` |
Additional arguments to |

A copy of `FUN`

applied to `object`

, with component
`dev`

replaced by the cross-validated results from the
sum of the `dev`

components of each fit.

B. D. Ripley

`tree`

, `prune.tree`

data(cpus, package="MASS") cpus.ltr <- tree(log10(perf) ~ syct + mmin + mmax + cach + chmin + chmax, data=cpus) cv.tree(cpus.ltr, , prune.tree)

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.