As we already know from our earlier recipe, the housing.csv dataset contains two columns, ptratio and rad, with missing values.
The mice library in R uses a predictive approach and assumes that the missing data is Missing at Random (MAR), and creates multivariate imputations via chained equations to take care of uncertainty in the missing values. It implements the imputation in just two steps: using mice() to build the model and complete() to generate the completed data.
The mice() function takes the following parameters:
- m: It refers to the number of imputed datasets it creates internally. Default is five.
- maxit: It refers to the number of iterations taken to impute the missing values.
- method: It refers to the method used ...