% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/longitree.R
\name{threetrees}
\alias{threetrees}
\alias{summary.threetrees}
\alias{print.threetrees}
\alias{predict.threetrees}
\alias{plot.threetrees}
\title{Fit and Evaluate Three Selected Trees}
\usage{
threetrees(x, selection)

\method{summary}{threetrees}(object, ...)

\method{print}{threetrees}(x, ...)

\method{predict}{threetrees}(object, tree = 1, ...)

\method{plot}{threetrees}(x, tree = 1, ...)
}
\arguments{
\item{x}{A \code{threetrees} object.}

\item{selection}{A \code{selectionplot} object.}

\item{object}{A \code{threetrees} object.}

\item{...}{Additional arguments passed to \code{\link{treeplot}}.}

\item{tree}{Integer 1, 2, or 3 selecting which tree to plot.}
}
\value{
An object of class \code{"threetrees"}.  Use
\code{\link{summary.threetrees}}, \code{\link{predict.threetrees}},
or \code{\link{plot.threetrees}} to inspect the results.
}
\description{
Refits the three trees selected by \code{\link{selectionplot}} on their
original bootstrap samples.
}
\section{Methods (by generic)}{
\itemize{
\item \code{summary(threetrees)}: Print a brief summary of a \code{threetrees} object.

\item \code{print(threetrees)}: Print method (calls \code{summary}).

\item \code{predict(threetrees)}: Extract predicted values and terminal node
assignments from a \code{threetrees} object.  Returns a data frame
with columns \code{predict} (predicted values) and
\code{terminalnode} (terminal node assignments).

\item \code{plot(threetrees)}: Plot one of the three trees.
A convenience wrapper around \code{\link{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)

}
\references{
Obata, R. and Sugimoto, T. (2026). A decision tree analysis for
longitudinal measurement data and its applications.
\emph{Advances in Data Analysis and Classification}.
\doi{10.1007/s11634-025-00665-2}
}
\seealso{
\code{\link{longitrees}}, \code{\link{selectionplot}},
\code{\link{treeplot}}
}
