predict.prtree: Predict from a Probabilistic Regression Tree Model

View source: R/prtree_predict.R

predict.prtreeR Documentation

Predict from a Probabilistic Regression Tree Model

Description

Obtains predictions from a fitted prtree object.

Usage

## S3 method for class 'prtree'
predict(object, newdata, complete = FALSE, ...)

Arguments

object

An object of class prtree, as returned by pr_tree.

newdata

A numeric matrix or data frame containing new data for which to generate predictions. Must contain the exact same number and order of predictor variables as the data used to fit the model. It can contain missing values (NA).

complete

Logical. If FALSE (default), only the vector of predicted values is returned. If TRUE, a list containing both the predicted values and the probability matrix P is returned.

...

further arguments passed to or from other methods.

Value

If complete = FALSE, a numeric vector of predicted values (yhat). If complete = TRUE, a list containing:

yhat

The numeric vector of predicted values.

P

The probability matrix for the new data.


PRTree documentation built on Nov. 23, 2026, 9:08 a.m.