nt-williams / lmtp

:package: Non-parametric Causal Effects Based on Modified Treatment Policies :crystal_ball:
http://www.beyondtheate.com
GNU Affero General Public License v3.0
56 stars 16 forks source link

Common error accumulation #40

Open nt-williams opened 4 years ago

nt-williams commented 4 years ago

Common errors/issues that aren't explicitly checked for should now be listed here:

kathoffman commented 3 years ago

Other potential errors you might want to cover:

Accidentally putting the treatment or outcome in the predictor matrix (lol) could yield an error from lmtp instead of sl3's non-informative one to make it easier for users to figure out what's going on.

library(lmtp)

# Code modified from Example 5.1
a <- "trt"
y <- paste0("Y.", 1:6)
cens <- paste0("C.", 0:5)
baseline <- c("W1", "W2", "trt")

progressr::with_progress({
  psi5.1 <- lmtp_tmle(sim_point_surv_constant, a, y, baseline, cens = cens,
                      shift = static_binary_on, folds = 2,
                      outcome_type = "survival")
})

Error in private$.train(subsetted_task, trained_sublearners) : All learners in stack have failed Error in private$.train(subsetted_task, trained_sublearners) : All learners in stack have failed Error in self$compute_step() : Error in private$.train(subsetted_task, trained_sublearners) : All learners in stack have failed Failed on Stack
Warning message:
In private$.train(subsetted_task, trained_sublearners) : Lrnr_glm_TRUE failed with message: Error in data.table::setnames(subset, true_columns, columns): Some duplicates exist in 'old': [trt] . It will be removed from the stack

kathoffman commented 3 years ago

You could also add a warning message that the k argument will be ignored for point treatments if users input it.