Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This improves upon #4. I slopped this down pretty quickly but let me say first that I did test it against
stcompet
from Stata and it gave identical results, so I've got that going for me.I started with the
CompetingEventTime
as an extension ofEventTime
. I made it very general, which could probably also be done toEventTime
in the same spirit. There is probably a way to mesh them together much better. I do think it is better to herd users toward these types (as opposed to always allowing them to supply lots of vectors) because it allows for easier handling within the estimators if you do this bit of "pre-organization".The estimator computes only the CIF for the event of interest, not for all events. It is certainly possible to do all of them in a single pass, but I didn't see a quick easy way to do so and keep it flexible like it is now. The downside is that if you need the CIF for all 5 of your competing events, you need to run this estimator 5 times. The upside is that I made it pretty easy to do so by providing a
swapeventofinterest
function, so that you can quickly convert your event times and rerun the estimator. I think making it compute all of them at once could be done at a later time.I initially tried to not add a new
_estimator
method forCumulativeIncidence
, but it requires tracking some additional variables over time so I didn't see a way to do that in the existing framework. So, it sort of looks like the existing method but functionally it is not integrated.I have not implemented any CI tests and some docstring cleanup is needed. Would appreciate some help polishing this up a bit.