Learn R Programming

robsurvey (version 0.1.0)

wgtmeantotal: Weighted total and mean (Horvitz-Thompson and Hajek estimators)

Description

Weighted total and mean (Horvitz-Thompson and Hajek estimators)

Usage

weighted_total(x, w, na.rm = FALSE)

weighted_mean(x, w, na.rm = FALSE)

Arguments

x

a numeric vector

w

a numeric vector of weights

na.rm

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

Value

Estimate (scalar)

Details

-

Examples

Run this code
# NOT RUN {
x <- c(0.1, 0.35, 0.05, 0.1, 0.15, 0.05, 0.2)
weighted_total(x, x)
x <- c(0.1, 0.35, 0.05, 0.1, 0.15, 0.05, 0.2)
weighted_mean(x, x)
# }

Run the code above in your browser using DataLab