Apply a time shift to a survival distribution
Details
A positive shift moves the fit backwards in time. That is,
a shift of 4 will cause time 5 to be evaluated as time 1, and so on.
If shift == 0
, dist
is returned unchanged.
Examples
dist1 <- define_surv_dist(distribution = "gamma", rate = 0.25, shape = 3)
shift_dist <- apply_shift(dist1, 4)
compute_surv(dist1, 1:10)
#> Loading required namespace: flexsurv
#> [1] 0.002161497 0.012252665 0.026499021 0.041475959 0.055704051 0.068650610
#> [7] 0.080209420 0.090451640 0.099511595 0.107536400
compute_surv(shift_dist, 1:10)
#> [1] 0.000000000 0.000000000 0.000000000 0.000000000 0.002161497 0.012252665
#> [7] 0.026499021 0.041475959 0.055704051 0.068650610