Skip to content

Convergence issues with larger datasets #2

@yjml

Description

@yjml

I ran into an convergence issue trying SBW on a dataset of mine, which seems size related, once ≥N samples (dependent on the treatment distribution?), optweight fails to converge.

ow_test.zip

library(optweight)
library(WeightIt)

testdf = readRDS("ow_test.rds")

optweight(trt ~ age, data=testdf, estimand = "ATE")           # fails
optweight(trt ~ age, data=testdf[1:16765,], estimand = "ATE") # runs
optweight(trt ~ age, data=testdf[1:16766,], estimand = "ATE") # fails
weightit(trt ~ age, data=testdf, method = "ebal", estimand = "ATE")

data("lalonde", package = "cobalt")
set.seed(123)
lalonde_dup = lalonde[sample(nrow(lalonde), 50000, replace = T),]
optweight(treat ~ age + educ + married + nodegree + re74,             # original  
          data = lalonde, tols = .01, estimand = "ATE")               
optweight(treat ~ age + educ + married + nodegree + re74,             # fails
          data = lalonde_dup, tols = .01, estimand = "ATE")           
optweight(treat ~ age + educ + married + nodegree + re74,             # success
          data = lalonde_dup[1:14339,], tols = .01, estimand = "ATE") 
optweight(treat ~ age + educ + married + nodegree + re74,             # fails
          data = lalonde_dup[1:14340,], tols = .01, estimand = "ATE") 
optweight(treat ~ age,                                                # continues to fail despite simplification
          data = lalonde_dup[1:14340,], tols = .01, estimand = "ATE") 
> sessionInfo()
R version 4.0.5 (2021-03-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] WeightIt_0.14.2 optweight_0.2.5

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.7       rstudioapi_0.14  magrittr_2.0.1   cobalt_4.5.1     tidyselect_1.1.1 munsell_0.5.0    colorspace_2.0-3 lattice_0.20-44 
 [9] R6_2.5.1         rlang_1.1.1      fansi_0.5.0      dplyr_1.0.7      tools_4.0.5      grid_4.0.5       gtable_0.3.1     osqp_0.6.0.8    
[17] utf8_1.2.2       cli_3.4.1        ellipsis_0.3.2   tibble_3.1.4     lifecycle_1.0.3  crayon_1.4.1     Matrix_1.3-4     purrr_0.3.4     
[25] ggplot2_3.4.2    vctrs_0.6.3      glue_1.4.2       compiler_4.0.5   pillar_1.6.2     chk_0.9.0        backports_1.4.1  generics_0.1.0  
[33] scales_1.2.1     pkgconfig_2.0.3 

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