% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/predict.ETree.R
\name{predict.ETree}
\alias{predict.ETree}
\title{Predictions for new data with a ETree object}
\usage{
\method{predict}{ETree}(object, newdata = NULL, type = "pred", depth = NULL, ...)
}
\arguments{
\item{object}{an object of the class \dQuote{ETree}.}

\item{newdata}{a data frame with data on new subjects for whom predictions should be made.
The data frame should contain at least the variables used in the splits of the fitted tree.
It is not necessary to include the treatment variable.}

\item{type}{character string denoting the type of predicted object to be returned. The default is
set to \code{type="pred"}: a vector with predicted treatment subgroup classes per subject
is returned. If set to \code{"matrix"}, a matrix is returned with the leaf and
corresponding node of the tree to which a subject is assigned.}

\item{depth}{If alltreesizes was set to TRUE in ETree, you need to specify the depth of the tree
you want to use in the predict function. This parameter should be equal to the number of the tree
you want to use in the TAll output of ETree. If NULL, the largest tree is used.}

\item{\dots}{optional additional arguments.}
}
\value{
One of the following objects is returned depending on output type specified
  in the function:

  If \code{type="pred"}:
  vector of the predicted outcome for every individual in the data set. Returns NA
  for subjects with missing values on one or more of the splitting variables.

  If \code{type="matrix"}:
  a matrix with predicted locations of subjects within the fitted tree. The leaf numbers are
  in the first column and the corresponding node numbers in the second column. Returns NA
  for subjects with missing values on one or more of the splitting variables.

  If \code{type="prob"}:
  a matrix with probabilities.
}
\description{
Predicts for (new) subjects the outcome variable based on a fitted
  \code{ETree} object.
}
\examples{
\donttest{
  data(iris)
  trainingIris<-iris[1:100,]
  # Fit an Exact Tree model
  controlEtree <- ETree.control(measure=0, maxsize = 4, maxdepth = 3,
  minbucket = 5, ncv=5, alltreesizes = FALSE)
  tree<-ETree(Species ~ Sepal.Length + Sepal.Width + Petal.Length + Petal.Width,
  control= controlEtree, data = trainingIris)
  testIris<-iris[101:150,]
  predictions<-predict(tree, newdata=testIris, type="pred", depth=1)
}


}
\seealso{
\code{\link{ETree}}, \code{\link{ETree.control}}
}
