bootBW {bbw} | R Documentation |
Blocked Weighted Bootstrap
Description
The blocked weighted bootstrap (BBW) is an estimation technique for use with data from two-stage cluster sampled surveys in which either prior weighting (e.g. population proportional sampling or PPS as used in SMART surveys) or posterior weighting (e.g. as used in RAM and S3M surveys).
Usage
bootBW(x, w, statistic, params, outputColumns, replicates = 400)
Arguments
x |
A data frame with primary sampling unit (PSU) in column named |
w |
A data frame with primary sampling unit (PSU) in column named |
statistic |
A function operating on data in |
params |
Parameters (named columns in |
outputColumns |
Names of columns in output data frame |
replicates |
Number of bootstrap replicates |
Value
A data frame with:
ncol = length(outputColumns)
nrow = replicates
names = outputColumns
Examples
# Example function - estimate a proportion for a binary (0/1) variable):
oneP <- function(x, params) {
v1 <- params[1]
v1Data <- x[[v1]]
oneP <- mean(v1Data, na.rm = TRUE)
return(oneP)
}
# Example call to bootBW function using RAM-OP test data:
bootP <- bootBW(x = indicatorsHH,
w = villageData,
statistic = oneP,
params = "anc1",
outputColumns = "anc1",
replicates = 9)
# Example estimate with 95% CI:
quantile(bootP, probs = c(0.500, 0.025, 0.975), na.rm = TRUE)