Weighted trimmed mean and total (bare-bone functions with limited
functionality; see svymean_trimmed
and
svytotal_trimmed
for more capable methods)
weighted_mean_trimmed(x, w, LB = 0.05, UB = 1 - LB, info = FALSE,
na.rm = FALSE)
weighted_total_trimmed(x, w, LB = 0.05, UB = 1 - LB, info = FALSE,
na.rm = FALSE)
The return value depends on info
:
info = FALSE
:estimate of mean or total [double]
info = TRUE
:a [list]
with items:
characteristic
[character]
,
estimator
[character]
,
estimate
[double]
,
variance
(default: NA
),
robust
[list]
,
residuals
[numeric vector]
,
model
[list]
,
design
(default: NA
),
[call]
[numeric vector]
data.
[numeric vector]
weights (same length as x
).
[double]
lower bound of trimming such that
LB
UB
[double]
upper bound of trimming such that
LB
UB
[logical]
indicating whether additional information
should be returned (default: FALSE
).
[logical]
indicating whether NA
values should
be removed before the computation proceeds (default: FALSE
).
Population mean or total. Let
The methods trims the LB
UB
)
See survey methods:
svymean_trimmed
,
svytotal_trimmed
.
Overview (of all implemented functions)
svymean_trimmed
and svytotal_trimmed
head(workplace)
# Estimated trimmed population total (5% symmetric trimming)
weighted_total_trimmed(workplace$employment, workplace$weight, LB = 0.05,
UB = 0.95)
# Estimated trimmed population mean (5% trimming at the top of the distr.)
weighted_mean_trimmed(workplace$employment, workplace$weight, UB = 0.95)
Run the code above in your browser using DataLab