Learn R Programming

VIM (version 7.3.0)

xgboostImpute: Xgboost Imputation

Description

Impute missing values based on a random forest model using xgboost::xgboost()

Usage

xgboostImpute(
  formula,
  data,
  imp_var = TRUE,
  imp_suffix = "imp",
  verbose = FALSE,
  nrounds = 100,
  objective = NULL,
  ...
)

Value

the imputed data set.

Arguments

formula

model formula for the imputation

data

A data.frame containing the data

imp_var

TRUE/FALSE if a TRUE/FALSE variables for each imputed variable should be created show the imputation status

imp_suffix

suffix used for TF imputation variables

verbose

Show the number of observations used for training and evaluating the RF-Model. This parameter is also passed down to xgboost::xgboost() to show computation status.

nrounds

max number of boosting iterations, argument passed to xgboost::xgboost()

objective

objective for xgboost, argument passed to xgboost::xgboost()

...

Arguments passed to xgboost::xgboost()

See Also

Other imputation methods: hotdeck(), impPCA(), imputeCellEM(), imputeCellIRMI(), imputeCellM(), imputeCellMCD(), imputeCellwise(), imputeRobust(), imputeRobustChain(), irmi(), kNN(), matchImpute(), medianSamp(), rangerImpute(), regressionImp(), sampleCat(), vimmi, vimpute()

Examples

Run this code
data(sleep)
sleepx <- sleep
sleepx$Pred <- as.factor(LETTERS[sleepx$Pred])
sleepx$Pred[1] <- NA
# a numeric and a factor target imputed at once; nrounds = 30 keeps the
# example fast (the default is 100 boosting rounds)
imp <- xgboostImpute(Dream + Pred ~ BodyWgt + BrainWgt, data = sleepx, nrounds = 30)
head(imp)

Run the code above in your browser using DataLab