bootBW | R Documentation |
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).
bootBW(x, w, statistic, params, outputColumns, replicates = 400)
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 |
A data frame with:
ncol = length(outputColumns)
nrow = replicates
names = outputColumns
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.