pool_brfss_weights: Create New BRFSS Survey Weights for Multi-Year Analyses

pool_brfss_weightsR Documentation

Create New BRFSS Survey Weights for Multi-Year Analyses

Description

Creates a dtsurvey/data.table object with properly adjusted survey weights for analyzing Behavioral Risk Factor Surveillance System (BRFSS) data across multiple years. The built-in BRFSS survey weight (finalwt1 for King County data and x_llcpwt for WA State data) is designed for single-year analyses. When analyzing BRFSS data across multiple years, the survey weights must be proportionately down scaled. This function provides three weight adjustment methods.

Usage

pool_brfss_weights(
  ph.data,
  years,
  year_var = "chi_year",
  old_wt_var = "finalwt1",
  new_wt_var,
  wt_method = "obs",
  strata = "x_ststr"
)

Arguments

ph.data

A data.frame, data.table, dtsurvey object or imputationList containing BRFSS survey data

years

An integer vector specifying which years to include in the weight calculation

year_var

Character string specifying the name of the column containing year values. Defaults to 'chi_year'

old_wt_var

Character string specifying the name of the column containing the single year survey weights. Defaults to 'finalwt1', which is used for King County data.

new_wt_var

Character string specifying the name for the new weight variable to be created

wt_method

Character string specifying the name of the method used to rescale old_wt_var to new_wt_var. Options include:

  • 'obs': Rescales weights based on the number of observations per year. This is WA DOH's recommendation

  • 'pop': Rescales weights by the survey weighted population for each year

  • 'simple': Rescales weights uniformly by the number of surveys. Use when the survey years have approximately the same sample sizes

Defaults to 'obs'

strata

Character string specifying the name for the strata to be used when survey setting the data. Defaults to 'x_ststr'

Details

When analyzing multiple years of BRFSS data together, using the original weights would lead to overestimation of population totals, as each year's weights sum to that year's total survey population. This function down scales the weights proportionately within the specified time period(s), ensuring that estimates approximate an average year's population.

Note that while get_data_brfss automatically creates multi-year weights during the initial data download, you may need to use this function to create new weights when analyzing specific subsets of years. For example, some BRFSS questions are only asked in specific years, requiring custom weights to be calculated for those specific time periods. The original weight will always be saved in order to allow this function to be used repeatedly on the same data set.

When aggregating BRFSS data across years, WA DOH recommends including the survey year as an additional stratifying variable. However, the ETL process includes the survey year in 'x_ststr' ( d1$x_ststr <- d1$year * 1000000 + d1$x_ststr) so there is no need to include the survey year on its own.

Value

For data.frame/data.table input: Returns a survey-weighted dtsurvey/data.table with an additional column containing the new adjusted weights.

For imputationList input: Returns a new imputationList where each dtsurvey/data.table is survey-weighted using the new weights.

In both cases, the new weight column will be specified by the value of new_wt_var.

Examples

## Not run: 
# Create weights for analyzing 2017-2022 BRFSS data
brfss_data <- pool_brfss_weights(
  ph.data = my_brfss_data,
  years = 2017:2022,
  new_wt_var = "wt_2017_2022"
)

# Create weights for specific years when a question was asked
brfss_data <- pool_brfss_weights(
  ph.data = my_brfss_data,
  years = c(2017, 2019, 2021),
  new_wt_var = "wt_odd_years"
)

## End(Not run)


PHSKC-APDE/rads documentation built on April 14, 2025, 10:47 a.m.