xgboostImpute: Xgboost Imputation

View source: R/xgboostImpute.R

xgboostImputeR Documentation

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,
  ...
)

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()

Value

the imputed data set.

See Also

Other imputation methods: hotdeck(), impPCA(), irmi(), kNN(), matchImpute(), medianSamp(), rangerImpute(), regressionImp(), sampleCat()

Examples

data(sleep)
xgboostImpute(Dream~BodyWgt+BrainWgt,data=sleep)
xgboostImpute(Dream+NonD~BodyWgt+BrainWgt,data=sleep)
xgboostImpute(Dream+NonD+Gest~BodyWgt+BrainWgt,data=sleep)

sleepx <- sleep
sleepx$Pred <- as.factor(LETTERS[sleepx$Pred])
sleepx$Pred[1] <- NA
xgboostImpute(Pred~BodyWgt+BrainWgt,data=sleepx)

alexkowa/VIM documentation built on April 7, 2024, 12:09 p.m.