View source: R/cellwise_utils.R
| cellIRWLS | R Documentation |
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
)
X |
|
y |
numeric n-vector (response) |
w_cell |
|
w_response |
numeric n-vector of cell weights for the
response variable. If |
maxit |
maximum number of IRWLS iterations, Default: 50 |
eps |
convergence tolerance on the relative change in coefficients, Default: 1e-6 |
method |
weight function: |
alpha |
tuning constant. If |
init |
initialisation for the coefficients:
|
damping |
logical; if |
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.
Matthias Templ
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.