Skip to contents

estimate poststratification weights based on Beesley & Mukhherjee

Usage

psw(
  int_data,
  ext_data = NULL,
  id_var = "id",
  age_var = "AgeLastEntry",
  age_bin = FALSE,
  age_bin_breaks = c(0, 18, 35, 65, 80, 150),
  covs = c("age_bin", "cad", "smoker", "diabetes", "female"),
  not_num_vars = NULL,
  psu_var = "psu_nhanes",
  strata_var = "strata_nhanes",
  weight_var = "weight_nhanes",
  chop = TRUE
)

Arguments

int_data

internal data to use for estimating weights

ext_data

external data to use for estimating weights

id_var

variable name for id

age_var

variable name for age

age_bin

logical, whether to bin age

age_bin_breaks

breaks for age binning

covs

covariates to use for estimating weights

not_num_vars

variables to exclude from numeric covariates

psu_var

variable name for psu

strata_var

variable name for strata

weight_var

variable name for weight

chop

logical, whether to truncate weights

Value

return data.table with id and poststratification weights