trimwgt: Weighted trimmed mean and trimmed total

Description Usage Arguments Details Value Utility functions Note See Also Examples

Description

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

Usage

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

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

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

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

Arguments

x

numeric vector (weighted_mean_trimmed or weighted_total_trimmed); a formula object or variable name (svymean_trimmed or svytotal_trimmed)

w

numeric vector of weights

LB

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

UB

upper bound of trimming, 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 trimmed 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_trimmed and svytotal_trimmed, the following utility functions can be used

Note

trimwgt is a generic name for the functions documented.

See Also

svymean_huber, svytotal_huber, svymean_winsorized, svytotal_winsorized, weighted_mean_huber, weighted_total_huber, weighted_mean_winsorized, weighted_total_winsorized

Examples

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

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