Skip to content

How are sampling and covariate balance weights combined in glm_weightit() and avg_comparisons()? #87

Description

@LauraCachon

Hello,

I am following your example code https://ngreifer.github.io/WeightIt/articles/estimating-effects.html and https://ngreifer.github.io/blog/treatment-effects-mi/ to estimate ATEs after weighting with multiply imputed data, including attrition weights (using the sampling weights option to incorporate the attrition weights).

We are wondering whether this approach of combining attrition and covariate balance weights is defensible, and for this it would be very useful to better understand how weights are combined within glm_weight() and avg_comparisons(). Are both sets of weights getting multiplied internally?

Thank you so much in advance!

I'm attaching the code in case it helps to understand our doubt:

#Attrition weights
w_attr <- weightthem(
  selected ~ cm1age + race_merged + race1_mother + mother_edu3 + mborn + cognit3_mother + relst1,
  data = imp_mids, method = "ps")

#CB weights
w.gbm_att <- weightthem(lon_3l ~ sex_child1 + race_merged + lowbbweight + cm1age + race1_mother + mborn + relst1 + mother_edu3 + cognit3_mother
                        + cm3md_case_con + cm3alc_case + cm3drug_case + cm3gad_case + m_health3 + health3 + disab3 + mh.scale + nce.scale + chmalt.scale + ppvt.scale + mh_ppvt + nce_ppvt + chmalt_ppvt,
                        data = imp_org_attmids, approach = 'within', method = "gbm", 
                        estimand = "ATE", s.weights = "w_attr")

#Outcome model and comparisons
fits <- lapply(seq_along(w.gbm_att$models), function(i) {
  data <- complete(w.gbm_att, i)
  W <- w.gbm_att$models[[i]]
  
  glm_weightit(edu_nonacad ~ lon_3l + sex_child1 + race_merged + lowbbweight + cm1age + race1_mother + mborn + relst1 + mother_edu3 + cognit3_mother
               + cm3md_case_con + cm3alc_case + cm3drug_case + cm3gad_case + m_health3 + health3 + disab3 + mh.scale + nce.scale + chmalt.scale + mh_ppvt + nce_ppvt + chmalt_ppvt,
               data = data, 
               weightit = W, family = binomial, vcov = "HC0") # W because glm_weightit() automatically incorporates the sampling weights into the estimation of the outcome model
}) 
 
comp.imp <- lapply(fits, function(fit) {
  avg_comparisons(fit,
                  variables = list(lon_3l = "pairwise"),
                  comparison = "lnratioavg", wts = W$s.weights) })

pooled.try <- mice::pool(comp.imp, dfcom = Inf)
summary(pooled.try, conf.int = TRUE, exponentiate = T) 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions