predict.htt: Predictions from a Fitted htt Object

View source: R/predict.R

predict.httR Documentation

Predictions from a Fitted htt Object

Description

Compute predictions from htt object.

Usage

## S3 method for class 'htt'
predict(object, newdata,
        type = c("response", "prob", "node"),
        ...)

Arguments

object

fitted model object of class htt returned by the HTT function.

newdata

an optional data frame in which to look for variables with which to predict, if omitted, the fitted values are used.

type

a character string denoting the type of predicted value returned. For type = "response", the mean of a numeric response and the predicted class for a categorical response is returned. For type = "prob" the matrix of class probabilities is returned for a categorical response. type = "node" returns an integer vector of terminal node identifiers.

...

additional print arguments.

Details

This function is a method for the generic function predict for class htt. It can be invoked by calling predict for an object of the appropriate class, or directly by calling predict.htt regardless of the class of the object.

Value

A list of predictions, possibly simplified to a numeric vector, numeric matrix or factor.

If type = "response":
the mean of a numeric response and the predicted class for a categorical response is returned.

If type = "prob":
the matrix of class probabilities is returned for a categorical response.

If type = "node":
an integer vector of terminal node identifiers is returned.

See Also

predict, htt.object

Examples

irishtt <- HTT(Species ~., data = iris)

## the predicted class
predict(irishtt, type = "response")

## class probabilities
predict(irishtt, type = "prob")

## terminal node identifiers
predict(irishtt, type = "node")

HTT documentation built on March 31, 2023, 5:40 p.m.