Closed juliannaharwood closed 3 months ago
The prediction routine had updates due to an error in some cases, including addition of a further set of tests (tests/predsurv.R) to further verify correctness. You are correct that I added the new check, but I had not thought through the case of conditional survival. You can get what you want via exp(predict(..., type="expected")).
I have a solid use case for per-subject expected hazard, each id with unique covariates and time point (it is the 'E' part of the martingale residual) and also for per subject expected and survival with per id covariates and a single common time point tau for all. But I have never found one for assessing each subject's predicted survival at a different time point for each. I would be very curious to learn the back story behind your example. Assuming that there was no use case is part of the genesis of that error message.
The error message has been removed, and more detail added to the help file
Thank you for updating to accommodate this use case! The example code I gave above wasn't reflective of my actual use case, it was just the easiest way I could think to generate the error. My use case involves a subscription product where I want to measure a subscriber's likelihood of unsubscribing at a given time T. I don't always observe a subscriber at T = 0, so if I observe them at t > 0, I want to know p(unsubscribed at T | subscribed at t). Is that a valid use case for this package?
Yes, individual prediction is a valid use case. I was thinking of model validation, where the "bulk" results from everyone at individual times is not interesting. Thanks for the reply.
Hello,
In the latest version there was an error handler added to
predict.coxph
that seems to be thrown whenevertstart != 0
. I am using time dependent covariates in my model training, and am also interested in making predictions like "what is the probability of survival at time Y given the observation has survived until time X." I now get errors for these use cases. Here is a reproducible example where the model can't make predictions for the data it was trained on:Error:
And session info: