Description Usage Arguments Details Value References See Also Examples

Stability assessment of variable and cutpoint selection in tree learners (i.e., recursive partitioning). By refitting trees to resampled versions of the learning data, the stability of the trees structure is assessed and can be summarized and visualized.

1 2 | ```
stabletree(x, data = NULL, sampler = subsampling, weights = NULL,
applyfun = NULL, cores = NULL, savetrees = FALSE, ...)
``` |

`x` |
fitted model object. Any tree-based model object that can be coerced
by |

`data` |
an optional |

`sampler` |
a resampling (generating) function. Either this should be a function
of |

`weights` |
an optional matrix of dimension n * B that can be used to
weight the observations from the original learning data when the trees
are refitted. If |

`applyfun` |
a |

`cores` |
integer. The number of cores to use in multicore computations
using |

`savetrees` |
logical. If |

`...` |
further arguments passed to |

The function `stabletree`

assesses the stability of tree learners (i.e.,
recursive partitioning methods) by refitting the tree to resampled versions
of the learning data. By default, if `data = NULL`

, the fitting call is
extracted by `getCall`

to infer the learning data.
Subsequently, the `sampler`

generates `B`

resampled versions
of the learning data, the tree is regrown with `update`

,
and (if necessary) coerced by `as.party`

. For each
of the resampled trees it is queried and stored which variables are selected
for splitting and what the selected cutpoints are.

The resulting object of class `"stabletree"`

comes with a set of
standard methods to generic functions including `print`

, `summary`

for numerical summaries and `plot`

, `barplot`

, and `image`

for graphical representations. See `plot.stabletree`

for more
details. In most methods, the argument `original`

can be set to
`TRUE`

or `FALSE`

, turning highlighting of the original tree
information on and off.

`stabletree`

returns an object of class `"stabletree"`

which is a list with
the following components:

`call` |
the call from the model object |

`B` |
the number of resampled datasets, |

`sampler` |
the |

`vs0` |
numeric vector of the variable selections of the original tree, |

`br0` |
list of the break points (list of |

`vs` |
numeric matrix of the variable selections for each resampled dataset, |

`br` |
list of the break points (only the |

`classes` |
character vector indicating the classes of all partitioning variables, |

`trees` |
a list of tree objects of class |

Hothorn T, Zeileis A (2015).
partykit: A Modular Toolkit for Recursive Partytioning in R.
*Journal of Machine Learning Research*, **16**(118), 3905–3909.

Philipp M, Zeileis A, Strobl C (2016). “A Toolkit for Stability Assessment of Tree-Based Learners”. In A. Colubi, A. Blanco, and C. Gatu (Eds.), Proceedings of COMPSTAT 2016 – 22nd International Conference on Computational Statistics (pp. 315–325). The International Statistical Institute/International Association for Statistical Computing. Preprint available at https://EconPapers.RePEc.org/RePEc:inn:wpaper:2016-11

`plot.stabletree`

, `as.stabletree`

,
`as.party`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ```
## build a simple tree
library("partykit")
m <- ctree(Species ~ ., data = iris)
plot(m)
## investigate stability
set.seed(0)
s <- stabletree(m, B = 500)
print(s)
## variable selection statistics
summary(s)
## show variable selection proportions
barplot(s)
## illustrate variable selections of replications
image(s)
## graphical cutpoint analysis
plot(s)
``` |

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.