
Robust (M/MM-Estimator) Regression Inference for Continuous Responses
Source:R/inference_continuous_robust_regr.R
InferenceContinRobustRegr.RdFits a robust linear regression — by default via this package's
fast_robust_regression_cpp C++ backend (use_rcpp = TRUE;
see that page for the full M/MM-estimator model, weight functions, and
asymptotic variance formula), or via MASS::rlm when use_rcpp =
FALSE — for a continuous response using the treatment indicator and,
optionally, all recorded covariates as predictors. This provides a
Huber/MM-style robustness upgrade over ordinary least squares when outcomes
are heavy-tailed or outlier-prone, down-weighting large residuals rather
than letting them dominate the fit the way squared-error loss does.
The method argument is passed through to either backend and may be
either "M" (Huber's psi function) or "MM" (Tukey's bisquare
weight, the default — higher breakdown point than "M" at some cost
in asymptotic efficiency under normality). When use_rcpp = TRUE
(the default), coefficient standard errors come from the C++ backend's own
M-estimator asymptotic variance (ssq_b_j); when FALSE, they
come from the coefficient table returned by summary.rlm(). Either
way, confidence intervals and p-values use that standard error with
residual degrees of freedom \(n - p\) in a normal-theory Wald
approximation (not an exact finite-sample distribution).
Super class
Inference -> InferenceContinRobustRegr
Methods
+ inherited public methods from Inference
Inference$capabilities()Inference$compute_exact_confidence_interval()Inference$compute_exact_two_sided_pval_for_treatment_effect()Inference$duplicate()Inference$get_analysis_data()Inference$get_covariates()Inference$get_design_object()Inference$get_model_formula()Inference$get_nonestimable_reason()Inference$get_nonestimable_stage()Inference$get_optimization_alg()Inference$get_response()Inference$get_response_type()Inference$get_treatment()Inference$is_nonestimable()Inference$set_optimization_alg()Inference$set_seed()Inference$supports()
InferenceContinRobustRegr$new()
Uses the shared randomization two-sided p-value contract; see
InferenceRand.
Initialize a robust-regression inference object for a completed design with a continuous, uncensored response.
Usage
InferenceContinRobustRegr$new(
des_obj,
model_formula = NULL,
method = "MM",
use_rcpp = TRUE,
verbose = FALSE,
smart_cold_start_default = NULL
)Arguments
des_objA completed
Designobject with a continuous response.model_formulaOptional formula for covariate adjustment. If
NULL(default), the formula from the design object is used and its pre-computed design matrix is reused. If a formula is provided, a new design matrix is constructed from the design's imputed covariates.methodRobust estimation method,
"M"(Huber) or"MM"(Tukey bisquare, higher breakdown point). Default"MM".use_rcppWhether to use the
fast_robust_regression_cppC++ backend (TRUE, default) instead ofMASS::rlm(FALSE).verboseWhether to print progress messages. Default
FALSE.smart_cold_start_defaultWhether to use smart starting values for the optimizer.
InferenceContinRobustRegr$compute_estimate()
Computes the robust-regression treatment coefficient
\(\hat\beta_T\) from an M/MM-estimator fit (see class documentation
for the full model and use_rcpp backend choice). Rank-deficient
covariate columns are dropped before fitting via
private$fit_with_hardened_qr_column_dropping().
InferenceContinRobustRegr$compute_estimate_with_bootstrap_weights()
Recomputes the robust-regression treatment estimate under
subject/block bootstrap weights, used by the Bayesian bootstrap and
related weighted-resampling machinery; see
InferenceBayesianBootstrap.
When use_rcpp = TRUE, reproduces MASS::rlm's default
wt.method = "inv.var" weighting exactly by pre-multiplying
X and y by \(\sqrt{\text{weight}}\) and running
unweighted M-estimation on the transformed data via the C++ backend
(rather than adding native weight support to that backend); when
use_rcpp = FALSE, passes weights directly to
MASS::rlm. This variant never populates a standard error or
degrees of freedom (both left NA) — it is estimate-only by
construction, matching the estimate_only default of the fast
path it always uses internally.
InferenceContinRobustRegr$compute_asymp_confidence_interval()
Computes a \(1-\alpha\) level confidence interval for the
robust-regression treatment coefficient \(\hat\beta_T\), using the
M/MM-estimator's asymptotic standard error (see class documentation
for its source depending on use_rcpp) and residual degrees of
freedom \(n - p\) in a normal-theory Wald approximation. See
InferenceAsymp for the shared
asymptotic confidence-interval contract this delegates to.
InferenceContinRobustRegr$compute_asymp_two_sided_pval()
Computes a two-sided Wald p-value testing \(H_0:
\beta_T = \code{delta}\), from the same M/MM-estimator standard error
and residual degrees of freedom used by
$compute_asymp_confidence_interval(). See
InferenceAsymp for the shared
asymptotic two-sided p-value contract this delegates to.
Examples
# \donttest{
seq_des = DesignSeqOneByOneBernoulli$new(n = 10, response_type = 'continuous')
for (i in 1:10) {
seq_des$add_one_subject_to_experiment_and_assign(data.frame(x1 = rnorm(1)))
}
seq_des$add_all_subject_responses(rnorm(10))
inf = InferenceContinRobustRegr$new(seq_des)
inf$compute_estimate()
#> [1] -0.2321722
# }