imputation_tree: Tree-based predictive imputation

View source: R/trans_imputation_tree.R

imputation_treeR Documentation

Tree-based predictive imputation

Description

Impute one target column from a set of source columns using a decision tree.

Usage

imputation_tree(target, sources = NULL, method = c("median", "mean"))

Arguments

target

target column to impute

sources

optional vector of predictor column names (default: all supported columns except target)

method

initial imputation method for numeric source columns: "median" or "mean"

Details

The method fits a tree with the observed values of the target column and uses the source columns as predictors. If source columns contain missing values, they are first completed with imputation_simple() so the tree can be trained and applied. The learned model imputes only the target column; source columns are preserved in the returned data.

Value

returns an object of class imputation_tree

References

Breiman, L., Friedman, J., Olshen, R., Stone, C. (1984). Classification and Regression Trees. Wadsworth.

van Buuren, S., Groothuis-Oudshoorn, K. (2011). mice: Multivariate Imputation by Chained Equations in R. Journal of Statistical Software, 45(3), 1-67.

Examples

data(iris)
iris_na <- iris
iris_na$Sepal.Length[c(2, 10, 25)] <- NA

imp <- imputation_tree("Sepal.Length")
imp <- fit(imp, iris_na)
iris_imp <- transform(imp, iris_na)
summary(iris_imp$Sepal.Length)
sum(is.na(iris_imp$Sepal.Length))

daltoolbox documentation built on May 14, 2026, 9:06 a.m.