Open joshua-nugent opened 2 years ago
Describe the issue Error messages arising when using the "id" option in lmtp_tmle().
reprex
library(lmtp) # Start with documentation example set.seed(56) n <- 1000 W <- rnorm(n, 10, 5) A <- 23 + 5*W + rnorm(n) Y <- 7.2*A + 3*W + rnorm(n) policy <- function(data, x) { (data[[x]] > 80)*(data[[x]] - 15) + (data[[x]] <= 80)*data[[x]] } e0 <- data.frame(W, A, Y) # This works fine, as per example in the documentation lmtp_tmle( data = e0, "A", "Y", "W", shift = policy, outcome_type = "continuous", intervention_type = "mtp" ) n_clusters <- 4 set.seed(1) e1 <- data.frame(W, A, Y, CL = rep(1:n_clusters, each = n / n_clusters)) lmtp_tmle( # folds < clusters data = e1, "A", "Y", "W", shift = policy, outcome_type = "continuous", .SL_folds = 2, intervention_type = "mtp", id = "CL", ) lmtp_tmle( # folds = clusters data = e1, "A", "Y", "W", shift = policy, outcome_type = "continuous", .SL_folds = 4, intervention_type = "mtp", id = "CL", ) lmtp_tmle( # folds > clusters data = e1, "A", "Y", "W", shift = policy, outcome_type = "continuous", .SL_folds = 10, intervention_type = "mtp", id = "CL", )
More information on how and why to use a reprex can be found here.
Expected behavior Larger standard errors than when using same data without "id" option.
Please include your R session info:
R version 4.1.1 (2021-08-10) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Big Sur 11.6 Matrix products: default LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] lmtp_1.0.0 loaded via a namespace (and not attached): [1] compiler_4.1.1 generics_0.1.0 nnls_1.4 [4] tools_4.1.1 SuperLearner_2.0-28 codetools_0.2-18 [7] splines_4.1.1 gam_1.20 data.table_1.14.2 [10] iterators_1.0.13 foreach_1.5.1
And lastly, please be kind and respectful :smile:
Thanks for your work on this!
Describe the issue Error messages arising when using the "id" option in lmtp_tmle().
reprex
More information on how and why to use a reprex can be found here.
Expected behavior Larger standard errors than when using same data without "id" option.
Please include your R session info:
And lastly, please be kind and respectful :smile:
Thanks for your work on this!