Performs robust regression where each predictor cell \((i, k)\) carries its own weight, rather than collapsing to a single row-level weight. This is the key building block for all three cellwise-robust imputation methods (cellM, cellIRMI, cellEM).
cellIRWLS(
X,
y,
w_cell = NULL,
w_response = NULL,
maxit = 50,
eps = 1e-06,
method = "tukey",
alpha = NULL,
init = "s-estimator",
damping = TRUE
)\(n \times p\) design matrix (predictors, without intercept)
numeric n-vector (response)
\(n \times p\) matrix of cell weights for the
predictors (from cellWeights). If NULL, all
weights are set to 1.
numeric n-vector of cell weights for the
response variable. If NULL, all response weights are 1.
maximum number of IRWLS iterations, Default: 50
convergence tolerance on the relative change in coefficients, Default: 1e-6
weight function: "huber" or "tukey",
Default: "tukey"
tuning constant. If NULL, the default for
the chosen method is used.
initialisation for the coefficients:
"s-estimator" (default; robustbase::lmrob.S with a
cell-weighted-OLS fallback) or "ols" (cell-weighted OLS).
logical; if TRUE (default) the cell-weight
update is adaptively damped across iterations for stability.
A list with components:
named numeric vector of regression coefficients (including intercept)
numeric n-vector of fitted values
numeric n-vector of residuals
numeric n-vector of final combined row-level weights (product of psi-weight and response-weight)
the \(n \times (p+1)\) matrix of final total weights (including the intercept column)
final robust scale estimate
logical indicating convergence
number of iterations performed
Initialize coefficients with an S-estimator
(robustbase::lmrob.S) when init = "s-estimator"
and \(n > 2p\), otherwise cell-weighted OLS.
Iterate until convergence:
Compute residuals \(r = y - X \beta\).
Estimate robust scale \(\sigma = \mathrm{MAD}(r)\).
Compute psi-weights \(w^{\psi}_i\) from standardized residuals \(r_i / \sigma\).
Form row weights \(w^{row}_i = w^{\psi}_i \cdot w^{resp}_i\).
Construct weighted design matrix with cell weights entering linearly: \(\tilde{X}_{ik} = \sqrt{w^{row}_i} \cdot w^{cell}_{ik} \cdot X_{ik}\), and weighted response \(\tilde{y}_i = \sqrt{w^{row}_i} \cdot y_i\).
Solve via QR decomposition: \(\beta = (\tilde{X}^T \tilde{X})^{-1} \tilde{X}^T \tilde{y}\).
Return coefficients, residuals, combined weights.