asym: [logical] if TRUE, an asymmetric Huber psi-function is used (default: FALSE).
na.rm: [logical] indicating whether NA values should be removed before the computation proceeds (default: FALSE).
verbose: [logical] indicating whether additional information is printed to the console (default: TRUE).
...: additional arguments passed to the method (e.g., maxit: maxit number of iterations, etc.; see svyreg_control).
Details
Package survey must be attached to the search path in order to use the functions (see library or require).
Methods/ types: type = "rht" or type = "rwm"; see weighted_mean_huber or weighted_mean_tukey for more details.
Variance estimation.: Taylor linearization (residual variance estimator).
Utility functions: summary, coef, SE, vcov, residuals, fitted, robweights.
Bare-bone functions: See weighted_mean_huber
`weighted_mean_tukey`, `weighted_total_huber`, and `weighted_total_tukey`.
Failure of convergence
By default, the method assumes a maximum number of maxit = 100
iterations and a numerical tolerance criterion to stop the iterations of tol = 1e-05. If the algorithm fails to converge, you may consider changing the default values; see svyreg_control.
head(workplace)library(survey)# Survey design for stratified simple random sampling without replacementdn <-if(packageVersion("survey")>="4.2"){# survey design with pre-calibrated weights svydesign(ids =~ID, strata =~strat, fpc =~fpc, weights =~weight, data = workplace, calibrate.formula =~-1+ strat)}else{# legacy mode svydesign(ids =~ID, strata =~strat, fpc =~fpc, weights =~weight, data = workplace)}# Robust Horvitz-Thompson M-estimator of the population totalsvytotal_huber(~employment, dn, k =9, type ="rht")# Robust weighted M-estimator of the population meanm <- svymean_huber(~employment, dn, k =12, type ="rwm")# Summary statisticsummary(m)# Plot of the robustness weights of the M-estimate against its residualsplot(residuals(m), robweights(m))# Extract estimatecoef(m)# Extract estimate of scalescale(m)# Extract estimated standard errorSE(m)