 Forcing a spline to be insensitive to changes in one end of the curve

Let me explain. Suppose i have a model with

y ~ s(time,k=4)



where time = 1 ... N and i want the spline to be insenstive to changes in y when time \in [N-14,N] (here N is ~700).

One thing i’ve been doing is placing tight priors (to reduce the prior sigma for the spline)

 prior = c( set_prior("exponential(8)", class = "sds",coef="s(i,k=4)"))


but how can i allow it be ‘freer’ for time<(N-14) but very insensitive for N >= time >=(N-14)

It sounds like you want a restricted cubic spline. If you search for rcs on Discourse a few threads will come up about how to do that.

Thanks for the suggestion. Will look into it

There are splines where you can specify linear effects at the end, or constant effect.
You could set the time N >= time >=(N-14) to time - 14.

You may also get some ideas from wavelet implementations depending on your signal.
https://www.mathworks.com/help/wavelet/ug/dealing-with-border-distortion.html

Sorry for the late reply. Yes this is very nice idea.