winswgt: Weighted winsorized mean and trimmed total

Description Usage Arguments Details Value Utility functions Note See Also Examples

Description

Weighted winsorized estimators of the mean and total are available in two forms:

Usage

1
2
3
4
5
6
7
8
weighted_mean_winsorized(x, w, LB = 0.05, UB = 1 - LB, na.rm = FALSE)

weighted_total_winsorized(x, w, LB = 0.05, UB = 1 - LB,
  na.rm = FALSE)

svymean_winsorized(x, design, LB = 0.05, UB = 1 - LB, ...)

svytotal_winsorized(x, design, LB = 0.05, UB = 1 - LB, ...)

Arguments

x

numeric vector (weighted_mean_winsorized or weighted_total_winsorized); a formula object or variable name (svymean_winsorized or svytotal_winsorized)

w

numeric vector of weights

LB

lower bound of winsorizing, such that 0 ≤q LB < UB ≤q 1

UB

upper bound of winsorizing, such that 0 ≤q LB < UB ≤q 1

na.rm

a logical value indicating whether NA values should be stripped before the computation proceeds.

design

a survey.design object (see svydesign in survey)

...

additional arguments (not used)

Details

Overview

Robust winsorized Horvitz–Thompson total or Hajek mean

  • bare-bone functions: return the estimate (no variance estimation)

  • estimation methods on the basis of survey (incl. variance estimation)

Variance

Variance estimates of the mean or total estimator are computed as first-order linearization using the design-based-estimation capabilities available in package survey.

Domain estimation

Estimates for domains can be obtained using the svyby wrapper in the survey package (see examples).

Value

Estimate (scalar) or object of class svystat.rob

Utility functions

For the methods svymean_winsorized and svytotal_winsorized, the following utility functions can be used

Note

winswgt is a generic name for the functions documented.

See Also

svymean_huber, svytotal_huber, svymean_trimmed, svytotal_trimmed, weighted_mean_huber, weighted_total_huber, weighted_mean_trimmed, weighted_total_trimmed

Examples

1
2
3
4
5
6
library(survey)
data(api)
dstrat <- svydesign(id=~1, strata=~stype, weights=~pw, data=apistrat, fpc=~fpc)
svymean_winsorized(~api00, dstrat, LB = 0.05)
# Domain estimates
svyby(~api00, by = ~stype, design = dstrat, svymean_winsorized, LB = 0.1)

martinSter/robsurvey documentation built on Oct. 11, 2019, 4:45 p.m.