SERVING THE QUANTITATIVE FINANCE COMMUNITY

Petipace
Posts: 1
Joined: January 21st, 2019, 4:33 am

### Re: Smoothing splines (clamped spline)

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.

Alan
Topic Author
Posts: 10497
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

### Re: Smoothing splines (clamped spline)

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: 63835
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Re: Smoothing splines (clamped spline)

My C++ Boost code gives
262537412640768743.999999999999250072597198185688879353856337336990862707537410378210647910118607313

http://www.datasimfinancial.com
http://www.datasim.nl

FaridMoussaoui
Posts: 507
Joined: June 20th, 2008, 10:05 am
Location: Genève, Genf, Ginevra, Geneva

### Re: Smoothing splines (clamped spline)

That's package was removed from CRAN repos. Orphaned and archived on 2014.
It was mainly a call to the fortran librairies.

Cuchulainn
Posts: 63835
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Re: Smoothing splines (clamped spline)

That's package was removed from CRAN repos. Orphaned and archived on 2014.
It was mainly a call to the fortran librairies.
All that work for nothing?
My C++ Boost code gives
262537412640768743.999999999999250072597198185688879353856337336990862707537410378210647910118607313

http://www.datasimfinancial.com
http://www.datasim.nl

FaridMoussaoui
Posts: 507
Joined: June 20th, 2008, 10:05 am
Location: Genève, Genf, Ginevra, Geneva

### Re: Smoothing splines (clamped spline)

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: 63835
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Re: Smoothing splines (clamped spline)

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

My C++ Boost code gives
262537412640768743.999999999999250072597198185688879353856337336990862707537410378210647910118607313

http://www.datasimfinancial.com
http://www.datasim.nl

Cuchulainn
Posts: 63835
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Re: Smoothing splines (clamped spline)

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$?
.
Alan,
Don't suppose you have a numeric example for this?
My C++ Boost code gives
262537412640768743.999999999999250072597198185688879353856337336990862707537410378210647910118607313

http://www.datasimfinancial.com
http://www.datasim.nl

Alan
Topic Author
Posts: 10497
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

### Re: Smoothing splines (clamped spline)

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.

Paul
Posts: 11066
Joined: July 20th, 2001, 3:28 pm

### Re: Smoothing splines (clamped spline)

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!

Alan
Topic Author
Posts: 10497
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

### Re: Smoothing splines (clamped spline)

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.

Paul
Posts: 11066
Joined: July 20th, 2001, 3:28 pm

### Re: Smoothing splines (clamped spline)

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

Cuchulainn
Posts: 63835
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Re: Smoothing splines (clamped spline)

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.
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).

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.
My C++ Boost code gives
262537412640768743.999999999999250072597198185688879353856337336990862707537410378210647910118607313

http://www.datasimfinancial.com
http://www.datasim.nl

Alan
Topic Author
Posts: 10497
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

### Re: Smoothing splines (clamped spline)

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!

Cuchulainn
Posts: 63835
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Re: Smoothing splines (clamped spline)

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.

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.

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
My C++ Boost code gives
262537412640768743.999999999999250072597198185688879353856337336990862707537410378210647910118607313

http://www.datasimfinancial.com
http://www.datasim.nl

Wilmott.com has been "Serving the Quantitative Finance Community" since 2001. Continued...

 JOBS BOARD

Looking for a quant job, risk, algo trading,...? Browse jobs here...

GZIP: On