chjackson / flexsurv

The flexsurv R package for flexible parametric survival and multi-state modelling
http://chjackson.github.io/flexsurv/
54 stars 28 forks source link

Add "quantile" as an option for the type of summary.flexsurvreg. #48

Closed leonardommarques closed 5 years ago

leonardommarques commented 6 years ago

I have made the 'quantile' option for the summary.flexsurvreg since I need estimates for quantiles other than the median (usually 0.1 and 0.05)

The quantiles are passed in the t argument as it is the same one used for type='median'.

fitg <- flexsurvreg(formula = Surv(futime, fustat) ~ 1, data = ovarian, dist="gengamma")

summary(fitg,
        type = 'quantile',
        ci = TRUE,
        t = c(0.1, 0.05 , .5) # the quantiles to estimate.
)

I was wondering if I should send a pull request, an e-mail or something. I am not used to contributing to projects of other developers so please tell me how I can do it the right way.

chjackson commented 6 years ago

Thanks for the suggestion. Yes - this sounds worthwhile, so feel free to send a pull request. Could you include some tests for the feature using the testthat package, and make sure all the existing tests pass.

And please also include documentation in the Roxygen comments, and check that the documentation builds OK. I've just noticed that the "median" option is currently missing from the help page! I guess it would also be sensible to reimplement the "median" option as a special case of your "quantile" option.

chjackson commented 6 years ago

I'd create a new argument, in the position after "t", and call it "q"

On 20/06/18 16:02, Leonardo wrote:

I have written the functions, documentation and tests, but was wondering: In |type='quantile'|, should the survival probabilities be passed to |t| or should I create another parameter, like |s|?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/chjackson/flexsurv-dev/issues/48#issuecomment-398783780, or mute the thread https://github.com/notifications/unsubscribe-auth/AHcgeDZLUeGGECGdnm0xL5b1MeLpd_pZks5t-mP8gaJpZM4UX5Vs.

-- Christopher Jackson chris.jackson@mrc-bsu.cam.ac.uk. Senior Statistician, MRC Biostatistics Unit, University of Cambridge, School of Clinical Medicine, Cambridge Institute of Public Health, Forvie Site, Robinson Way, Cambridge, UK, CB2 0SR. +44 (1223) 330381