mclements / Splines2.jl

Spline bases for regression modelling in Julia
MIT License
12 stars 5 forks source link

P-splines support? #7

Open arbenede opened 1 year ago

arbenede commented 1 year ago

Any plans to support P-splines?

mclements commented 1 year ago

This is a good question. The B-splines can be easily adapted to calculate the P-spline basis and the difference penalty matrix would not be difficult to calculate.

Can you suggest an API for penalised splines? Perhaps something like ps(x,df=8), ps_(x,df=8) and pen_ps(df=8)?

arbenede commented 1 year ago

If df is the number of basis elements, how about something like ps(start,stop,df=20,order=4) ? Of course start and stop are the limits of the range where the B-spline basis is defined. Referring to the picture below [1, pag. 185], start=0 and stop=1:

image

[1] Marx, B. D., Eilers, P. H. (2021). Practical Smoothing: The Joys of P-splines. Cambridge University Press.