# Using splines in a likelihood

**URL:** <https://discourse.julialang.org/t/using-splines-in-a-likelihood/49340>\
**Category:** Statistics\
**Tags:** optimization, splines\
**Created:** [October 30, 2020, 10:47pm UTC](https://discourse.julialang.org/t/using-splines-in-a-likelihood/49340 "2020-10-30T22:47:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ross\_Boylan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ross_boylan/32/9210_2.png) [@Ross\_Boylan](https://discourse.julialang.org/u/Ross_Boylan)\
**Post date:** [October 30, 2020, 10:47pm UTC](https://discourse.julialang.org/t/using-splines-in-a-likelihood/49340/1 "2020-10-30T22:47:27Z")

</div>

I am looking to add splines to the type of functions that can go in `@formula` to support a conditional likelihood model I’ve developed. Once that is working I plan to add automatic smoothing parameter selection.

The packages I’ve found that use splines all have them embedded in a fitting process that is of no direct interest to me. Their intended use seems to be to take data and a type of spline as inputs, returning interpolated data. In contrast I want a type of spline and specific parameters as inputs, with a spline function as the result. Have I missed something? Should I just raid one of those packages (e.g., `interpolations`) for the parts I want? Is the specification of a spline function just too simple to merit separate treatment?

My optimization uses automatic differentiation, and so I think using an external library (as, e.g., ` Dierckx` does) would not work.

Then there is the question of what syntax I should use to specify the spline in the `formula`. None of the packages with splines I’ve examined used `formula`, though most have some way of specifying what type of spline to use.

Since GAMs use splines and automatic smoothing selection, and recent discussion seems to confirm they aren’t in Julia, I take it this area is a bit underdeveloped. What I’m trying to do is a lot like GAMs except the likelihood function is non-standard.

Thanks for any help.  
Ross
