| impute {miceRanger} | R Documentation |
Impute New Data With Existing Models
Description
Impute data using the information from an existing miceDefs object.
Usage
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 |
datasets |
A numeric vector specifying the datasets with which to impute |
iterations |
The number of iterations to run.
By default, the same as the number of iterations currently in |
verbose |
should progress be printed? |
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.
Value
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 |
missingCounts |
The number of missing values for each variable. |
imputedData |
A list of imputed datasets. |
Examples
ampDat <- amputeData(iris)
miceObj <- miceRanger(ampDat,1,1,returnModels=TRUE,verbose=FALSE)
newDat <- amputeData(iris)
newImps <- impute(newDat,miceObj)