as_imputed_brfss: Convert modified BRFSS data.table to an imputationList

View source: R/utilities.R

as_imputed_brfssR Documentation

Convert modified BRFSS data.table to an imputationList

Description

Converts a modified BRFSS dtsurvey/data.table back into a imputationList by creating multiple imputed datasets for HRA and region assignments. This is necessary after modifying variables in BRFSS data that contains HRA or region variables.

Usage

as_imputed_brfss(
  ph.data,
  impute_cols = c("hra20_id", "hra20_name", "chi_geo_region")
)

Arguments

ph.data

A dtsurvey/data.table containing BRFSS survey data, typically created using as_table_brfss

impute_cols

Character vector specifying which geographic imputation columns to retain in the output. Must be some combination of 'hra20_id', 'hra20_name', and 'chi_geo_region'. Defaults to impulte_cols = c('hra20_id', 'hra20_name', 'chi_geo_region')

Details

When working with BRFSS data that includes Health Reporting Area (HRA) or region variables, modifications to the data must be made on a single data.table. After modifications are complete, this function recreates the proper imputationList structure required for analysis of HRA and region variables.

This function:

  • Creates 10 copies of your modified dataset

  • Assigns different HRA IDs to each copy based on ZIP code probabilities

  • Adds corresponding HRA names and region assignments

  • Combines the copies into an imputationList

Value

Returns an imputationList containing 10 imputed datasets, each a survey-weighted dtsurvey/data.table with different HRA and region assignments based on ZIP code probabilities.

See Also

as_table_brfss for converting an imputationList to a single data.table

Examples

## Not run: 
# Starting with a modified BRFSS data.table
brfss_table[, age_category := fcase(
  age %in% 18:66, "working age",
  age >= 67, "retirement age",
  default = NA_character_
)]

# Convert back to imputationList for analysis
brfss_imputed <- as_imputed_brfss(brfss_table)

# Now ready for analysis with rads::calc()

## End(Not run)


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