svymean_trimmed function

Weighted Trimmed Mean and Total

Weighted Trimmed Mean and Total

Weighted trimmed population mean and total.

svymean_trimmed(x, design, LB = 0.05, UB = 1 - LB, na.rm = FALSE, ...) svytotal_trimmed(x, design, LB = 0.05, UB = 1 - LB, na.rm = FALSE, ...)

Arguments

  • x: a one-sided [formula], e.g., ~myVariable.
  • design: an object of class survey.design; see svydesign.
  • LB: [double] lower bound of trimming such that 00 \leq LB << UB 1\leq 1.
  • UB: [double] upper bound of trimming such that 00 \leq LB << UB 1\leq 1.
  • na.rm: [logical] indicating whether NA values should be removed before the computation proceeds (default: FALSE).
  • ...: additional arguments (currently not used).

Details

Package survey must be attached to the search path in order to use the functions (see library or require).

  • Characteristic.: Population mean or total. Let μ\mu denote the estimated trimmed population mean; then, the estimated trimmed total is given by NhatμNhat \mu with Nhat=sum(w[i])Nhat = sum(w[i]), where summation is over all observations in the sample.

  • Trimming.: The methods trims the LB 100%~\cdot 100\%

     of the smallest observations and the (1 - `UB`)$~\cdot 100\%$
     
     of the largest observations from the data.
    
  • Variance estimation.: Large-sample approximation based on the influence function; see Huber and Ronchetti (2009, Chap. 3.3) and Shao (1994).

  • Utility functions.: summary, coef, SE, vcov, residuals, fitted, robweights.

  • Bare-bone functions.: See weighted_mean_trimmed and weighted_total_trimmed.

Returns

Object of class svystat_rob

References

Huber, P. J. and Ronchetti, E. (2009). Robust Statistics, New York: John Wiley and Sons, 2nd edition. tools:::Rd_expr_doi("10.1002/9780470434697")

Shao, J. (1994). L-Statistics in Complex Survey Problems. The Annals of Statistics 22 , 976--967. tools:::Rd_expr_doi("10.1214/aos/1176325505")

See Also

Overview (of all implemented functions)

weighted_mean_trimmed and weighted_total_trimmed

Examples

head(workplace) library(survey) # Survey design for stratified simple random sampling without replacement dn <- 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) } # Estimated trimmed population total (5% symmetric trimming) svytotal_trimmed(~employment, dn, LB = 0.05, UB = 0.95) # Estimated trimmed population mean (5% trimming at the top of the distr.) svymean_trimmed(~employment, dn, UB = 0.95)
  • Maintainer: Tobias Schoch
  • License: GPL (>= 2)
  • Last published: 2024-08-22