-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
predict.flexsurvreg()
doesn't nest for a single time point
#191
Comments
@mattwarkentin would you be able to look at this, as the original author? I have no idea about the pros and cons of this. |
predict.flexsurvreg()
doesn't nest for "1 observation and 1 time point" casepredict.flexsurvreg()
doesn't nest for a single time point
Absolutely! Happy to take a look. Will report back. |
I don't think I have a strong opinion on the nesting/non-nesting for single row per-observation predictions. I do agree with @hfrick that format consistency is a nice feature. I think if we want to revert to always nesting results into list-columns of For context, I think I chose to have single time-point predictions return as non-nested since it saved the user an extra step of unnesting a single observation, and also But I could pretty easily be convinced to just go with a consistent output format over forced convenience. Moreover, we have already gone to lengths to have the |
Thanks both, and sorry for leaving this issue so long! I would be happy to go with this suggested change, so feel free to send a PR @hfrick . |
I noticed that flexsurv's predict method does not nest the survival probabilities if there's only one time point to calculate the probability at.
While nesting isn't neccessary in that case to get to a data frame that has one row per observation, it does make the output format consistent. (I've added an example with censored which does that.)
Is that behaviour something you want preserved or could I send a PR to change that? I think it might only be a matter of changing
flexsurv/R/predict.flexsurvreg.R
Line 201 in d5537c7
but I haven't been able to test that yet. One of the tests in the corresponding test file segfaults for me locally with the current dev version and I haven't figured out why.
Here's a reprex to illustrate the behaviour:
Created on 2024-04-19 with reprex v2.1.0
The text was updated successfully, but these errors were encountered: