You could take a look at http://www.netlib.org/dierckx/.

concur.f implements the clamped smoothing spline.

Disclaimer: I haven’t used this library myself, but Dierckx’s book is quite good.

You could take a look at http://www.netlib.org/dierckx/.

concur.f implements the clamped smoothing spline.

Disclaimer: I haven’t used this library myself, but Dierckx’s book is quite good.

concur.f implements the clamped smoothing spline.

Disclaimer: I haven’t used this library myself, but Dierckx’s book is quite good.

You could take a look at http://www.netlib.org/dierckx/.

concur.f implements the clamped smoothing spline.

Disclaimer: I haven’t used this library myself, but Dierckx’s book is quite good.

Thank you -- it looks like Dierckx's book may indeed have what I am searching for -- ordered a decently priced used copy.

- Cuchulainn
**Posts:**59940**Joined:****Location:**Amsterdam-
**Contact:**

- FaridMoussaoui
**Posts:**435**Joined:****Location:**Genève, Genf, Ginevra, Geneva

That's package was removed from CRAN repos. Orphaned and archived on 2014.

It was mainly a call to the fortran librairies.

It was mainly a call to the fortran librairies.

- Cuchulainn
**Posts:**59940**Joined:****Location:**Amsterdam-
**Contact:**

All that work for nothing?That's package was removed from CRAN repos. Orphaned and archived on 2014.

It was mainly a call to the fortran librairies.

- FaridMoussaoui
**Posts:**435**Joined:****Location:**Genève, Genf, Ginevra, Geneva

It means it is not actively maintained but it is still there. I even installed it for a test and it's working (you need a fortran compiler).

- Cuchulainn
**Posts:**59940**Joined:****Location:**Amsterdam-
**Contact:**

This might be useful; in particular, estimation of the smoothing parameter [$]\lambda[$].

- Cuchulainn
**Posts:**59940**Joined:****Location:**Amsterdam-
**Contact:**

Alan,Hi Daniel,

Thank you for the code. I haven't opened it yet. Let me know if I will find the solution to the following problem, which will answer your question.

I want to find the piecewise cubic polynomial [$]g(t)[$] that solves the following problem:

(*) minimize [$] \left( \sum_{i=1}^n \{ y_i - g(t_i) \}^2 + \lambda \int_a^b \{ g''(u) \}^2 \, du \right)[$],

subject to

(A) given values for [$]g'(a)[$] and [$]g'(b)[$], where [$] a < t_1 < t_2 < \cdots < t_n < b[$],

(B) given data [$]\{t_i,y_i\}[$] and

(C) given [$]\lambda > 0[$], the 'smoothing' parameter.

Without (A), this is the standard smoothing spline problem, solved by Reinsch (1967) (fulltext here) and with many subsequent treatments.

BTW, I've got your 2018 book. Correct me if I'm wrong, but it looks like the cubic splines discussed there are just *interpolating* splines; i.e., the solution to (*) when [$]\lambda=0[$]?

.

Don't suppose you have a numeric example for this?

Daniel, Thanks for the book link. Sorry, don't have a good numerical example because I abandoned this approach for another. But, may get back to it.

What's the underlying (financial?) problem? It looks a bit like something my friend Jesse Jones was working years ago. I don't think it went anywhere, but it was a brilliant idea!

The problem is finding a risk neutral density from option quotes. The spline approach which I abandoned was: fit a smoothing spline to option smile data, with given derivative endpoints. The purpose of the derivatives, as opposed to so-called 'natural' boundary conditions, was to be improved extrapolation to small and large strikes.

Ok, completely different problem! Jesse's was forward rate curve stuff.

- Cuchulainn
**Posts:**59940**Joined:****Location:**Amsterdam-
**Contact:**

I see. I would be pleasantly surprised if (any kind of) splines would work in this case (arbitrage, overshoot, extrapolation very scary, need C2 differentiability, all well known).The problem is finding a risk neutral density from option quotes. The spline approach which I abandoned was: fit a smoothing spline to option smile data, with given derivative endpoints. The purpose of the derivatives, as opposed to so-called 'natural' boundary conditions, was to be improved extrapolation to small and large strikes.

here is my (non-tested) idea:

If I have understood, you want to estimate the pdf from a finite data sample? In that case, kernel density estimation is used. So, the kd estimator coincides with the characteristic function (CF) and then use the Levy Inversion Formula to recover the pdf from CF. This can be easily done in Python (or MM I reckon as well). I suspect a key element is to find a good free parameter that fine-tunes extrapolation.

The data sample is not draws from a pdf, but option prices.

However you approach the problem, you have to tackle the issue of extrapolation (of the risk-neutral pdf) to non-marketed strikes.

Anyway, I am close to finishing a write-up for a larger problem (which contains this risk-neutral density estimation as a sub-problem). Will announce it once I get it posted -- rather than pre-empting myself here.

If I ever return to this spline approach, all the responses here to that were quite helpful -- thanks to all!

However you approach the problem, you have to tackle the issue of extrapolation (of the risk-neutral pdf) to non-marketed strikes.

Anyway, I am close to finishing a write-up for a larger problem (which contains this risk-neutral density estimation as a sub-problem). Will announce it once I get it posted -- rather than pre-empting myself here.

If I ever return to this spline approach, all the responses here to that were quite helpful -- thanks to all!

- Cuchulainn
**Posts:**59940**Joined:****Location:**Amsterdam-
**Contact:**

Good point. Does this mean that kernel functions are not 'suitable' for data with no discernible underlying density? I need to think a bit more about this. It might be the wrong solution for the wrong problem.The data sample is not draws from a pdf, but option prices.

However you approach the problem, you have to tackle the issue of extrapolation (of the risk-neutral pdf) to non-marketed strikes.

This article does discuss a related problem it seems and authors are using slice kernel for interpolation and even a reference to extrapolation.

https://mathfinance.com/wp-content/uplo ... elling.pdf

GZIP: On