Skip to contents

Internal function to create multiple imputed datasets with exposure levels based on county-level probability distributions.

Usage

impute_exposure(
  datmatx_prob,
  rasterprob_combined,
  cellpop,
  births,
  ndraws,
  cat_label,
  id_col,
  record_id_col,
  exposure_level_col,
  apply_imputation_fallback
)

Arguments

datmatx_prob

Data frame containing probability data with geographic identifiers

rasterprob_combined

Matrix of combined probability distributions

cellpop

Vector of cell population weights

births

Data frame containing birth records

ndraws

Number of imputed datasets to create

cat_label

Character vector of exposure category labels

id_col

Column name for geographic/participant identifier in probability data

record_id_col

Column name for matching identifier in health data

exposure_level_col

Column name for exposure level variable

apply_imputation_fallback

Logical indicating whether to apply fallback imputation for missing exposure levels. The fallback fills missing values with the most common category in the respective dataset. If enabled, this fallback will be applied to any missing exposure levels after the initial imputation step. Otherwise, it will remove any rows with missing exposure levels.

Value

List of imputed datasets