I was testing out using lm_weightit and wanted to alert you to a potential bug when FWB is specified, but doesn't error with the default or when bootstrap is specified
library(WeightIt)
library(fwb)
data(lalonde, package ='cobalt')
bart_weights = weightit(treat ~ age + educ + race + married +
nodegree + re74 + re75, data = lalonde, estimand = 'ATT', method = 'bart')
lm_weightit(re78 ~ treat + age + educ + race + married + nodegree + re74 + re75, data = lalonde , weightit = bart_weights, vcov = 'FWB')
#> Error in `weightit()`:
#> ! Sampling weights cannot be used with `method = "bart"`.
lm_weightit(re78 ~ treat + age + educ + race + married + nodegree + re74 + re75, data = lalonde , weightit = bart_weights, vcov = 'BS')
#>
#> Call:
#> lm_weightit(formula = re78 ~ treat + age + educ + race + married +
#> nodegree + re74 + re75, data = lalonde, weightit = bart_weights,
#> vcov = "BS")
#>
#> Coefficients:
#> (Intercept) treat age educ racehispan racewhite
#> -3.066e+03 1.223e+03 1.634e+01 6.395e+02 1.640e+03 1.093e+03
#> married nodegree re74 re75
#> 2.584e+02 7.523e+02 8.859e-02 1.196e-01
#> Standard error: traditional bootstrap
lm_weightit(re78 ~ treat + age + educ + race + married + nodegree + re74 + re75, data = lalonde, weightit = bart_weights)
#>
#> Call:
#> lm_weightit(formula = re78 ~ treat + age + educ + race + married +
#> nodegree + re74 + re75, data = lalonde, weightit = bart_weights)
#>
#> Coefficients:
#> (Intercept) treat age educ racehispan racewhite
#> -3.066e+03 1.223e+03 1.634e+01 6.395e+02 1.640e+03 1.093e+03
#> married nodegree re74 re75
#> 2.584e+02 7.523e+02 8.859e-02 1.196e-01
#> Standard error: HC0 robust
Thanks for letting me know about this. Unfortunately, this is not a solvable problem, but I'll put a clearer error message identifying that vcov = "FWB" cannot be used with BART.
I was testing out using
lm_weightit
and wanted to alert you to a potential bug when FWB is specified, but doesn't error with the default or when bootstrap is specifiedCreated on 2024-07-17 with reprex v2.1.1