Skip to contents

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 psu

w

A data frame with primary sampling unit (PSU) in column named psu and survey weight (i.e. PSU population) in column named pop

statistic

A function operating on data in x (see example)

params

Parameters (named columns in x) passed to the function specified in statistic

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)
#>       50%      2.5%     97.5% 
#> 0.2266858 0.2183163 0.2672711