Previously, we used the impute() function from the Hmisc library to simply impute the missing value using defined statistical methods (mean, median, and mode). However, Hmisc also has the aregImpute() function that allows mean imputation using additive regression, bootstrapping, and predictive mean matching:
> impute_arg <- aregImpute(~ ptratio + rad , data = housingData, n.impute = 5)> impute_arg
argImpute() automatically identifies the variable type and treats it accordingly, and the n.impute parameter indicates the number of multiple imputations, where five is recommended.
The output of impute_arg shows R² values for predicted missing values. The higher the value, the better the values predicted.
Check imputed variable ...