Skip to contents

This function predicts values based on random forest model objects.

Usage

forecast_by_randomForest(
  object,
  newx,
  type = c("response", "prob", "votes"),
  newoffset = NULL,
  target = 2L,
  ...
)

Arguments

object

an object of class Trained

newx

the new values at which prediction are to be made

type

the type of prediction. Three options are available

"response"

predicted values are on the same scale as the outcome

"prob"

matrix of class probabilities

"votes"

matrix of vote counts

newoffset

the new offset, if provided it is added to the predicted value

target

(optional) integer, index of the target class. If provided, only the prediction for the selected class are returned (default to second level of factor response). Set to NULL to return all classes

Value

A vector containing the predictions.

Author

Alessandro Barberis