[R] Make natural splines constant outside boundary
g.abraham at ms.unimelb.edu.au
Fri Dec 7 03:10:41 CET 2007
I'm using natural cubic splines from splines::ns() in survival
regression (regressing inter-arrival times of patients to a queue on
queue size). The queue size fluctuates between 3600 and 3900.
I would like to be able to run predict.survreg() for sizes <3600 and
>3900 by assuming that the rate for <3600 is the same as for 3600 and
that for >4000 it's the same as for 4000 (i.e., keep the splines cubic
within the boundaries but make them constant outside the boundaries).
(By default, natural splines will be linear outside the boundaries,
which is very bad here because the predictions grow without bound.
Setting the boundary knots to extreme values such as (0, 10000) doesn't
help, because there are no intermediate knots to constrain the spline
and you get a very large cubic curve between these boundaries and the
Department of Mathematics and Statistics
The University of Melbourne
Parkville 3010, Victoria, Australia
email: g.abraham at ms.unimelb.edu.au
More information about the R-help