get_data_brfss: Get BRFSS microdata with adjusted weights from storage.

View source: R/get_data.R

get_data_brfssR Documentation

Get BRFSS microdata with adjusted weights from storage.

Description

Retrieves Behavioral Risk Factor Surveillance System (BRFSS) data and adjusts survey weights to ensure accurate representation for multi-year analysis.

Usage

get_data_brfss(cols = NULL, year = NULL, kingco = TRUE, wt_method = "obs")

Arguments

cols

Character vector specifying which columns to include in the returned data. If NULL, all columns identified by list_dataset_columns('brfss') will be included. Defaults to cols = NULL

year

Integer vector specifying which years to include in the data. If NULL, the most recent year available in the data set will be used. Defaults to year = NULL

kingco

Logical. TRUE returns a dataset for King County analyses. FALSE returns a dataset for WA State analyses and should not be used for King County analyses. Defaults to kingco = TRUE

wt_method

Character string specifying the name of the method used to rescale the weights when selecting multiple years. 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'

Details

Note that while get_data_brfss automatically creates multi-year weights for all years included in the data download, these weights may not be appropriate for all analyses. Some BRFSS questions are only asked in specific years, requiring custom weights to be calculated for those specific time periods. Please refer to pool_brfss_weights to learn how to easily re-weight and survey set the data.

As stated in the Value section below, this function will return a imputationList when selecting King County Health Reporting Area (HRA) or region variables. This is necessary because BRFSS is provided at the ZIP code level and ZIP codes do not nest perfectly within HRAs (and regions are defined by HRAs). When using a BRFSS imputationList as the ph.data argument in calc, the function will properly process the imputationList to account for the uncertainty in allocation of ZIP codes to HRAs. In other words, it is fine if you are unfamiliar with imputation because calc will deal with the details for you.

Value

If 'hra20_id', hra20_name', and 'chi_geo_region' are not requested: Returns a survey-weighted dtsurvey/data.table object with the specified columns, years, and 'default_wt' (the rescaled / adjusted weight).

If any of 'hra20_id', 'hra20_name', or 'chi_geo_region' are requested: Returns an imputationList comprised of survey-weighted dtsurvey/data.table objects with the specified columns, years, and 'default_wt' (the rescales / adjusted weight).

References

For information regarding the BRFSS ETL process, file locations, etc., see: https://github.com/PHSKC-APDE/BRFSS

Examples

## Not run: 
# Get data for specific columns and years
brfss_data <- get_data_brfss(
  cols = c('chi_sex'),
  year = 2019:2022
)

# Get data for all columns for the most recent year
brfss_data <- get_data_brfss()

## End(Not run)


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