kathoffman / steroids-trial-emulation

Tutorial for a target trial emulation with a time-varying exposure, time-dependent confounding, time-to-event outcome, and Sequentially Doubly Robust estimation (Hoffman et al. 2022).
31 stars 9 forks source link

Error in running the 'analysis.R' code #2

Open jromanowska opened 1 year ago

jromanowska commented 1 year ago

Hi, I've just cloned you repository and tried running the code in 'analysis.R' line-by-line. I get error when trying to run the lmtp_sdr command:

  |                                                                                                                      |   0%
Error in .createLibrary(SL.library) : 
  format for SL.library is not recognized
In addition: Warning message:
The 'intervention_type' argument of 'lmtp_sdr()' is deprecated as of lmtp 1.3.1 

I haven't changed anything in your script.

There was also an issue with dat_lmtp_fix_censoring used as argument to lmtp_dsr while only dat_lmtp was loaded, but I just fixed that variable name.

jromanowska commented 1 year ago

Also, when I run with a learner that is default in lmtp_sdr (i.e., SL.glm), I get lots of warnings:

# intervention 1
res_steroid <-
   progressr::with_progress(
     lmtp_sdr(
       dat_lmtp,
       trt = a,
       outcome = y,
       baseline = bs,
       time_vary = tv,
       cens = censoring,
       shift = int_steroids_after_hypoxia,
       outcome_type = "survival",
       learners_outcome = "SL.glm",
       learners_trt = "SL.glm",
       folds = folds,
       .SL_folds = SL_folds,
       .trim = trim,
       k=k#,
       #intervention_type = "dynamic"
     )
  )
# > Loading required package: nnls                                                                                                 
# > There were 639 warnings (use warnings() to see them)

These are some of the warnings:

584: glm.fit: algorithm did not converge
585: glm.fit: fitted probabilities numerically 0 or 1 occurred
586: In predict.lm(object, newdata, se.fit, scale = 1, type = if (type ==  ... :
  prediction from rank-deficient fit; attr(*, "non-estim") has doubtful cases