Skip to content
All library documents

Choosing Exponential Spline Basis Size for Discount Curve Fitting

Article Quant Q&A · Author: DS_London

Summary

The document discusses how many exponential basis functions to use when fitting a discount curve with an exponential spline. QuantLib's implementation uses a fixed default, while the answer attributes that choice to a historical US Treasury application. The cited study reportedly found fitted residuals near noise levels from a certain basis size onward, and recommended smaller sizes for some other markets.

The answer argues that basis size should reflect the market and the available instrument distribution. More terms can improve the short end but may create unstable or unwarranted movements farther out, and the contributor reports numerical problems at larger sizes. The discussion suggests using fewer terms when the market has fewer instruments, considering repo data for front-end forwards, and adjusting long-bond weights to improve long-end fitting. These are practitioner observations rather than a universal calibration rule; the excerpt supplies no comparative dataset or detailed fitting procedure.

Key ideas

  • The default number of exponential spline terms reflects a historical market application rather than a universal optimum.
  • Curve stability and fit quality depend on instrument coverage and the market being modeled.
  • Adding basis functions may improve short-end fit while making long-end behavior less stable.
  • The answer recommends lower basis counts for markets with fewer instruments and notes numerical issues at high counts.
  • Long-end weighting and repo curve inputs are presented as additional fitting considerations.

Tags

Full text
# How many parameters in a discount curve exponential spline fit?


# How many parameters in a discount curve exponential spline fit?












I am investigating the ExponentialSplinesFitting class in QuantLib. I've used this fitting technique using a variety of systems in the past (including by hand!). The form is $$df(t) = \sum_{n=1}^{N}(\beta(n)\exp(-n \cdot \alpha \cdot t))$$, ie there is one alpha (which QuantLib calls 'kappa') and 1 to N Betas.

QuantLib seems to be hard-coded with 9 Betas (which will reduce to 8 independent Betas if df(0) constrained = 1):

```
Size ExponentialSplinesFitting::size() const {
       return constrainAtZero_ ? 9 : 10;
    }
```

My question is: Why 9?

When using this method in the past, I've used a maximum of 6 in practice. I have found the "best" number to be influenced by the density of bonds across the term structure. Adding more parameters increases the quality of fit at the short end, but can have the side effect of producing unwarranted perturbations at the long end. So unless you have a lot of bonds in the 0-1 year range, using fewer parameters may give a better fit further out. Bottom line: should I be modifying the QL implementation to have a variable number of parameters?

## Answer by Helin (score 5, accepted)

https://quant.stackexchange.com/a/58962

I believe $N = 9$ is the default because the original paper, "Merrill Lynch Exponential Spline Model," used that value for the US Treasury market when the model was developed back in 1994. To be precise, the paper actually showed results for $N$ up to 14, concluding that fitted residuals are within noise levels at $N \geq 9$; it also recommended lower $N$ for French and Canadian markets.

So yes, as you have pointed out, there is no reason to use $N = 9$. The exact number of basis functions to use depends on the market in question. In my personal experience, $N$ in the range of 7 or 8 works just fine for US Treasuries and results in more stable curves than 9. A book authored by the model's creators used a value of 7 as well. For markets where fewer instruments are available (aka pretty much every other bond market), even lower $N$ should be used. I should also note that I ran into a ton of numerical issues when I tested $N \geq 10$.

Fitting the front end of the curve with this kind of model, in my opinion, is not particularly useful. You're better off appending the GC repo curve, which will give you more usable forward yields. To improve fitting at the long end, you could also try adjusting the weights assigned to long bonds in the weighted least squares estimator, in addition to adjusting the value of $N$.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.