threetrees: Fit and Evaluate Three Selected Trees

View source: R/longitree.R

threetreesR Documentation

Fit and Evaluate Three Selected Trees

Description

Refits the three trees selected by selectionplot on their original bootstrap samples.

Usage

threetrees(x, selection)

## S3 method for class 'threetrees'
summary(object, ...)

## S3 method for class 'threetrees'
print(x, ...)

## S3 method for class 'threetrees'
predict(object, tree = 1, ...)

## S3 method for class 'threetrees'
plot(x, tree = 1, ...)

Arguments

x

A threetrees object.

selection

A selectionplot object.

object

A threetrees object.

...

Additional arguments passed to treeplot.

tree

Integer 1, 2, or 3 selecting which tree to plot.

Value

An object of class "threetrees". Use summary.threetrees, predict.threetrees, or plot.threetrees to inspect the results.

Methods (by generic)

  • summary(threetrees): Print a brief summary of a threetrees object.

  • print(threetrees): Print method (calls summary).

  • predict(threetrees): Extract predicted values and terminal node assignments from a threetrees object. Returns a data frame with columns predict (predicted values) and terminalnode (terminal node assignments).

  • plot(threetrees): Plot one of the three trees. A convenience wrapper around treeplot.

References

Obata, R. and Sugimoto, T. (2026). A decision tree analysis for longitudinal measurement data and its applications. Advances in Data Analysis and Classification. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/s11634-025-00665-2")}

See Also

longitrees, selectionplot, treeplot

Examples

data(ltreedata)
set.seed(10)
trees_res <- longitrees(y ~ ., time = "time", random = "subject",
                           weight = 0.5, data = ltreedata, alpha = 0.01,
                           bootsize = 50, mins = 40)
sel <- selectionplot(trees_res, metric = "PE", nth = 1)
tt <- threetrees(trees_res, selection = sel)
summary(tt)
predict(tt, tree = 1)
predict(tt, tree = 2)
predict(tt, tree = 3)
plot(tt, tree = 1)
plot(tt, tree = 2)
plot(tt, tree = 3)


longitree documentation built on May 16, 2026, 5:06 p.m.