Closed kkmann closed 4 years ago
Been meaning to do this for ages. Do these look OK?
tidy.flexsurvreg <- function(x, transform=FALSE, ...){
res <- if (transform) x$res.t else x$res
broom::fix_data_frame(res, newnames=c("estimate","conf.low","conf.high","std.error"))
}
glance.flexsurvreg <- function(x, ...){
data.frame(
logLik = x$loglik,
df = x$npars,
nobs = x$N,
AIC = x$AIC,
BIC = -2*x$loglik + log(x$N)*x$npars
)
}
Not sure what to do about augment
, the concept of predict()
for survival models is not obvious, see work in progress.
The output from summary.flexsurvreg
functions can already be returned in a somewhat tidy format but maybe it could be improved.
I'll try to understand the problem a bit better and whisk together a PR, might be better to discuss specifics there.
Merged with #75
Hi Chris,
I find the broom package tremendously useful for model comparisons etc.
Would be very helpful to implement methods for the glance etc generics for flexsurvreg objects.