RobinDenz1 / adjustedCurves

An R-Package to estimate and plot confounder-adjusted survival curves (single event survival data) and confounder-adjusted cumulative incidence functions (data with competing risks) using various methods.
https://robindenz1.github.io/adjustedCurves/
GNU General Public License v3.0
35 stars 4 forks source link

Thanks! #1

Closed davidrosspainter closed 1 year ago

davidrosspainter commented 2 years ago

Thanks for this contribution. Under my brief testing I needed to start with a clean R install with the latest R (4.1.3 Windows). It seemed I needed to rename time and event columns in my dataset to be "time" and "event". Is there a best way to compute the overall adjusted curve (collapsed across all variables)? Would the mean of all variables/categories be valid?

RobinDenz1 commented 2 years ago

Thank you very much for creating this issue.

What error message did you get when trying to use column names other than "time" and "event"? And could you perhaps provide a small reproducible example of this behavior? This would help me a lot to fix the error.

Interestingly, there is no "overall adjusted curve". Confounder-adjustment is always relative to the causal question at hand. That is why the usual definition of a confounder-adjusted survival function for one group is something along the lines of: "the survival curve that would have been observed if every individual in the sample would have been allocated to group Z". Without a grouping of interest, what should the curve be adjusted for exactly? I am not trying to be difficult. This is an interesting question I have thought about for some time as well.

To me the best course of action seems to be plotting the overall curves using standard estimators (Kaplan-Meier, Aalen-Johansen, ...) and only using the adjustedCurves package when trying to visualize a specific causal effect. The survminer package might be useful to you for that first part.

Jingrubeyond commented 2 years ago

Thanks for this contribution.when i used this function, it shows: Error in ate_checkArgs(call = call, object.event = object.event, object.censor = object.censor, : Cannot handle missing values in the model coefficients (event)

RobinDenz1 commented 2 years ago

Without a reproducible example I can only guess, but to me this sounds like the model you passed to the adjustedsurv function did not converge correctly. If some coefficients are infinite or NA there is no way to use this object for survival curve estimation. You could try using a different method for confounder-adjustment such as method="iptw_km".