Oh and while I'm thinking of it, I would suggest supporting flexsurv::flexsurvspline()
in addition to flexsurv::flexsurvreg()
for survival_reg()
. The latter is based on known parametric distributions (e.g. Weibull, etc.), while the former supports arbitrarily flexible baseline (cumulative) hazards with natural cubic splines (Royston-Parmar model).
Maybe some sentinel function like dist_spline(k, knots, bknots, scale = 'hazard', timescale = 'log')
that defines the spline model, where k
is mutually exclusive with knots
/bknots
. An API like:
survival_reg(engine = 'flexsurv', dist = dist_spline(k = tune()))
This might require adding a dials::knots()
function, which would be very similar to the dials::deg_free()
function.