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).
32 stars 10 forks source link

Missing data error / lmtp package #1

Closed MFosset closed 1 year ago

MFosset commented 1 year ago

Hi,

When I run the analysis.R script, I end up with

Error in lmtp_sdr(dat_lmtp, trt = a, outcome = y, baseline = bs, time_vary = tv, : Assertion on 'data' failed: Missing data found in treatment and/or covariate nodes for uncensored observations.

It occurs after I tried to define the res_steroid object with the lmtp_sdr function.

I have indeed a lot of missing data in the dat_lmtp file, but is it a problem of missing data or is the censoring variable that don't have the correct output ?

Thanks in advance

kathoffman commented 1 year ago

Thanks for catching this @MFosset! I just fixed this.

The error stemmed from a line of code naming the baseline covariates in the bs object. It incorrectly contained names of some time-varying covariates (M_*) that were indeed missing! I am now directly naming the baseline covariates for clarity.