impute function

Impute New Data With Existing Models

Impute New Data With Existing Models

Impute data using the information from an existing miceDefs object.

impute( data, miceObj, datasets = 1:miceObj$callParams$m, iterations = miceObj$callParams$maxiter, verbose = TRUE )

Arguments

  • data: The data to be imputed. Must have all columns used in the imputation of miceDefs.
  • miceObj: A miceDefs object created by miceRanger().
  • datasets: A numeric vector specifying the datasets with which to impute data. See details for more information.
  • iterations: The number of iterations to run. By default, the same as the number of iterations currently in miceObj.
  • verbose: should progress be printed?

Returns

An object of class impDefs, which contains information about the imputation process. - callParams: The parameters of the object.

  • data: The original data provided by the user.

  • naWhere: Logical index of missing data, having the same dimensions as data.

  • missingCounts: The number of missing values for each variable.

  • imputedData: A list of imputed datasets.

Details

This capability is experimental, but works well in benchmarking. The original data and random forests (if returnModels = TRUE) are returned when miceRanger

is called. These models can be recycled to impute a new dataset in the same fashion as miceRanger, by imputing each variable over a series of iterations. Each dataset created in miceObj

can be thought of as a different imputation mechanism, with different initialized values and a different associated random forests. Therefore, it is necessary to choose the datasets which will be used to impute the data. When mean matching a numeric variable, the candidate values are drawn from the original data passed to miceRanger, not the data passed to this function.

Examples

ampDat <- amputeData(iris) miceObj <- miceRanger(ampDat,1,1,returnModels=TRUE,verbose=FALSE) newDat <- amputeData(iris) newImps <- impute(newDat,miceObj)
  • Maintainer: Sam Wilson
  • License: MIT + file LICENSE
  • Last published: 2021-09-06