View source: R/imputeCellwise.R
| imputeCellIRMI | R Documentation |
Extends IRMI (Templ, Kowarik, and Filzmoser, 2011) with cellwise contamination handling. Each conditional regression uses a cell-weighted IRWLS engine where per-cell weights in the design matrix downweight contaminated cells without discarding entire observations.
imputeCellIRMI(
data,
method = "tukey",
alpha = NULL,
maxit = 100,
maxit_irwls = 50,
eps = 0.005,
eps_irwls = 1e-06,
uncert = "pmm",
weight_update = "multivariate",
init_weights = "ddc",
hard_threshold = 0.5,
trace = FALSE
)
data |
a |
method |
weight function: |
alpha |
tuning constant. |
maxit |
maximum number of outer IRMI iterations (default: 100). |
maxit_irwls |
maximum number of inner IRWLS iterations per regression (default: 50). |
eps |
convergence tolerance for the outer loop (default: 5e-3). Convergence is declared when the relative change in imputed values falls below this threshold. |
eps_irwls |
convergence tolerance for the inner IRWLS (default: 1e-6). |
uncert |
imputation uncertainty method: |
weight_update |
strategy for updating cell weights between outer
iterations: |
init_weights |
method for initialising cell weights, one of
|
hard_threshold |
numeric in |
trace |
logical; if |
The algorithm works iteratively: in each outer iteration, every variable
with missing values is used as response in a conditional regression on
all remaining variables. For continuous responses, the custom
cellIRWLS() engine fits a weighted regression where each cell in
the design matrix receives its own weight reflecting potential cellwise
contamination. For categorical responses, a weighted multinomial model
is used. After each regression, cell weights for the response variable
are updated from the residuals.
The algorithm proceeds as follows:
Missing values are initialised using initialise.
Initial cell weights are computed with cellWeights() on
all continuous variables in the initialised data.
Outer loop (up to maxit iterations):
For each variable j with missing values:
Form predictor matrix X (all other variables) and
response y (variable j).
If j is continuous: fit cellIRWLS(X, y,
w_cell, w_response) and impute missing values in j
using the fitted model plus uncertainty.
If j is categorical: fit nnet::multinom()
with row weights derived from the cell weight matrix and
impute by sampling from predicted probabilities.
Update cell weights for j from residuals via
cellWeightsFromResiduals().
Check convergence: relative change in imputed values
falls below eps.
A list with components:
data_imputed |
the imputed |
cellweights |
|
converged |
logical indicating whether the outer loop converged. |
iterations |
number of outer iterations used. |
Matthias Templ
Templ, M., Kowarik, A. and Filzmoser, P. (2011). Iterative stepwise regression imputation using standard and robust methods. Computational Statistics & Data Analysis, 55(10), 2793–2806.
imputeCellM, imputeCellEM,
initialise, irmi
Other imputation methods:
hotdeck(),
impPCA(),
imputeCellEM(),
imputeCellM(),
imputeCellMCD(),
imputeCellwise(),
imputeRobust(),
imputeRobustChain(),
irmi(),
kNN(),
matchImpute(),
medianSamp(),
rangerImpute(),
regressionImp(),
sampleCat(),
vimmi,
vimpute(),
xgboostImpute()
data(sleep, package = "VIM")
result <- imputeCellIRMI(sleep)
head(result$data_imputed)
image(result$cellweights, main = "Cell weights")
# With Huber weights (less aggressive downweighting)
result2 <- imputeCellIRMI(sleep, method = "huber", trace = TRUE)
# Mixed data example
data(testdata)
result3 <- imputeCellIRMI(testdata$wna)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.