residuals.e2tree: Extract Residuals from an E2Tree Model

View source: R/methods_e2tree.R

residuals.e2treeR Documentation

Extract Residuals from an E2Tree Model

Description

Returns the residuals (observed minus fitted) for regression E2Tree models. Not available for classification models.

Usage

## S3 method for class 'e2tree'
residuals(object, ...)

Arguments

object

An e2tree object.

...

Additional arguments (ignored).

Value

A numeric vector of residuals.

Examples


data("mtcars")
smp_size <- floor(0.75 * nrow(mtcars))
train_ind <- sample(seq_len(nrow(mtcars)), size = smp_size)
training <- mtcars[train_ind, ]

ensemble <- randomForest::randomForest(mpg ~ ., data = training, ntree = 500,
  importance = TRUE, proximity = TRUE)
D <- createDisMatrix(ensemble, data = training, label = "mpg",
  parallel = list(active = FALSE, no_cores = 1))
setting <- list(impTotal = 0.1, maxDec = 1e-6, n = 2, level = 5)
tree <- e2tree(mpg ~ ., training, D, ensemble, setting)

residuals(tree)



e2tree documentation built on May 15, 2026, 5:06 p.m.