Libor.LiborProcess
Class Calibrator

java.lang.Object
  extended byLibor.LiborProcess.Calibrator

public class Calibrator
extends java.lang.Object

This is a restricted version of a Libor process which has all the methods needed for calibration (computing the relevant prices at time zero, solving for implied volatilities etc) but no methods for path computation. Obviously this implies that Monte Carlo simulation is not used in calibration. See LiborProcess.ps.

Calibration is carried out for the CS_FactorLoading only. The calibration routine does not build an initial term structure of forward Libors. This term structure is handed to the constructor as an argument. In all our experiments this will be the exact intial term structure of the corresponding Libor process.

The model parameters A,D,alpha,beta,rho00 for the CS_FactorLoading are calibrated to caplets cplt([T_i,T_{i+1}],kappa) and swaptions swpn(T_p, [T_p,T_q],kappa) with arbitrary strikes satisfying 1<=p<=n-2. Note in particular that no forward start swaptions are used. The swaption is exercised into a swap starting at the time of exercise.

Warning:

the calibration routine works with cash prices (at time zero) not forward prices at the horizon! The calibration routine tries to minimize the mean percent error over all available swaption prices.


Nested Class Summary
 class Calibrator.Swpn
          Structure containing swaption parameters and price.
 
Field Summary
 double A
          CS_FactorLoading parameter
 double alpha
          CS_FactorLoading parameter
 double beta
          CS_FactorLoading parameter
 double[] capletSigma
          Array of caplet implied aggregate volatilities, capletSigma=sigma_i*sqrt(T_i), where sigma_i is the annual caplet price implied volatility of Libor L_i.
 double D
          CS_FactorLoading parameter
 double rho00
          CS_FactorLoading parameter
static java.util.Vector swaptions
          list of swaptions
 
Constructor Summary
Calibrator(int n, double[] l, double[] c, double[] Tc)
          This constructor does not allocate the file readers to read the caplet and swaption prices.
Calibrator(int n, double[] l, double[] c, double[] Tc, java.lang.String capletFile, java.lang.String swaptionFile)
          This constructor allocates everything necessary to carry out the calibration procedure.
 
Method Summary
 double B_pq(int p, int q)
          The annuity B_pq(t)=sum_{k=p}^{q-1}delta_kB_{k+1}(t) at time t=0.
 double B0(int i)
          The zero coupon bond B_i(0)=B(0,T_i).
 LMM_Parameters calibrate(int nPoints)
          Calibration of a CS_FactorLoading to caplet and swaption prices.
 double capletImpliedSigma(int i, double kappa, double c)
          The capletSigma computed from price c, strike kappa and time T_i by inversion the Black caplet formula.
 double capletPrice(int i, double kappa)
          Black caplet cash price at time zero.
 double capletSigma(int i)
          The quantity Sigma=sigma*sqrt(T_i), where sigma is the annualized volatility of the caplet cplt([T_i,T_{i+1}],kappa).
 double integral_g_squared(double T)
          integral_0^T g(u)^2du, where g(u) is the function defining the volatilities sigma_j(t)=c_jg(1-t/T_j) in the CS_FactorLoading.
 ColtMatrix logCovariationCholeskyRoot(int p, int q, double t, double T)
          The Cholesky root of FactorLoading.logCovariationMatrix(int,int,double,double).
static void main(java.lang.String[] args)
          Calibration test, calibrates a CS_FactorLoading to a set of data in dimension n=15.
 void setCholeskyRoots()
          Sets the array of transposed Cholesky roots of the covariation matrices from the current factor loading.
 void setFactorLoading(CS_FactorLoading fl)
          Sets the factor loading from the current parameters.
 void setParameters(double A, double D, double alpha, double beta, double rho00)
          Sets the parameters for the CS_FactorLoading.
 double Sigma(int p, int q)
          Deterministic approximation to the aggregate volatility (square root of the quadratic variation <log(S_pq)>_0^{T_p}) to expiration of the swap rate S_pq.
 double swapRate(int p, int q)
          The forward swap rate S_pq(t)=k(t,[T_p,T_q]) at time t=0.
 double swaptionPrice(int p, int q, double kappa)
          Analytic approximation to the swaption price.
 double wpq(int p, int q, int j)
          The weight w^{p,q}_j(t) in the representation of the swap rate S_pq(t) as a convex combination of Libors at time t=0.
 ColtVector xpq(int p, int q)
          The vector x_pq(0) used in the computation of the approximation of the swap rate volatility.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

A

public double A
CS_FactorLoading parameter


D

public double D
CS_FactorLoading parameter


alpha

public double alpha
CS_FactorLoading parameter


beta

public double beta
CS_FactorLoading parameter


rho00

public double rho00
CS_FactorLoading parameter


capletSigma

public double[] capletSigma
Array of caplet implied aggregate volatilities, capletSigma=sigma_i*sqrt(T_i), where sigma_i is the annual caplet price implied volatility of Libor L_i. Missing caplets will be interpolated from nearest neighbors.


swaptions

public static final java.util.Vector swaptions
list of swaptions

Constructor Detail

Calibrator

public Calibrator(int n,
                  double[] l,
                  double[] c,
                  double[] Tc)

This constructor does not allocate the file readers to read the caplet and swaption prices. It is used for unit testing of other methods.

Parameters:
n - dimension (number of Libors including L_0)
l - initial Libors l[j]=L_j(0).
c - the c[j]=c_j in the definition of the volatilities sigma_j(t).
Tc - tenor structure, Tc[j]=T_j.

Calibrator

public Calibrator(int n,
                  double[] l,
                  double[] c,
                  double[] Tc,
                  java.lang.String capletFile,
                  java.lang.String swaptionFile)

This constructor allocates everything necessary to carry out the calibration procedure.

The file capletFile must contains the prices of the caplets cplt([T_i,T_{i+1}],kappa) in precisely the following form: i kappa price, where this pattern is repeated separated only by spaces. Calibration will try to match all caplet prices. Missing caplets will be interpolated from nearest neighbors.

The file swaptionFile must contains the prices of the swaptions swpn([T_p,T_q],kappa) in precisely the following form: p q kappa price, where this pattern is repeated separated only by spaces. Calibration will try to match the existing swaption prices by minimizing the squared error.

Parameters:
n - dimension (number of Libors including L_0)
l - initial Libors l[j]=L_j(0).
c - the c[j]=c_j in the definition of the volatilities sigma_j(t).
Tc - tenor structure, Tc[j]=T_j.
capletFile - file containing the caplet prices.
swaptionFile - file containing the swaption prices.
Method Detail

logCovariationCholeskyRoot

public ColtMatrix logCovariationCholeskyRoot(int p,
                                             int q,
                                             double t,
                                             double T)

The Cholesky root of FactorLoading.logCovariationMatrix(int,int,double,double).

Parameters:
p - Libors L_j, j=p,...,q-1.
q - Libors L_j, j=p,...,q-1.
t - time interval [t,T], continuous time.
T - time interval [t,T], continuous time.

setParameters

public void setParameters(double A,
                          double D,
                          double alpha,
                          double beta,
                          double rho00)
Sets the parameters for the CS_FactorLoading.


setFactorLoading

public void setFactorLoading(CS_FactorLoading fl)
Sets the factor loading from the current parameters.


setCholeskyRoots

public void setCholeskyRoots()
Sets the array of transposed Cholesky roots of the covariation matrices from the current factor loading.


B0

public double B0(int i)
The zero coupon bond B_i(0)=B(0,T_i).

Parameters:
i - bond matures at time T_i

swapRate

public double swapRate(int p,
                       int q)

The forward swap rate S_pq(t)=k(t,[T_p,T_q]) at time t=0.

Parameters:
p - swap begins at T_p.
q - swap ends at T_q (settled).

B_pq

public double B_pq(int p,
                   int q)

The annuity B_pq(t)=sum_{k=p}^{q-1}delta_kB_{k+1}(t) at time t=0.

Parameters:
p - annuity begins at T_p.
q - annuity ends at T_q (settled).

capletSigma

public double capletSigma(int i)

The quantity Sigma=sigma*sqrt(T_i), where sigma is the annualized volatility of the caplet cplt([T_i,T_{i+1}],kappa).

In other words Sigma is the squareroot of the quadratic variation <log(L_i)>_0^{T_i}. Remember that this is the quantity that must be entered into the Black caplet formula.

Parameters:
i - caplet caps Libor on [T_i,T_{i+1}]

capletImpliedSigma

public double capletImpliedSigma(int i,
                                 double kappa,
                                 double c)
                          throws NoSolutionException

The capletSigma computed from price c, strike kappa and time T_i by inversion the Black caplet formula.

Parameters:
i - caplet caps Libor on [T_i,T_{i+1}]
c - caplet cash price at time t=0
kappa - strike rate
Throws:
NoSolutionException

capletPrice

public double capletPrice(int i,
                          double kappa)

Black caplet cash price at time zero.

Parameters:
i - caplet caps Libor on [T_i,T_{i+1}].
kappa - strike rate.

wpq

public double wpq(int p,
                  int q,
                  int j)

The weight w^{p,q}_j(t) in the representation of the swap rate S_pq(t) as a convex combination of Libors at time t=0. See LiborProcess.ps.


xpq

public ColtVector xpq(int p,
                      int q)

The vector x_pq(0) used in the computation of the approximation of the swap rate volatility. See LiborProcess.ps. Note that the vector is allocated in size n-p and set to zero beyond coordiante q-1 to fit with the n-p by n-p matrix choleskyRoots[p].

Parameters:
p - swap begins at T_p
q - swap ends at T_q

Sigma

public double Sigma(int p,
                    int q)

Deterministic approximation to the aggregate volatility (square root of the quadratic variation <log(S_pq)>_0^{T_p}) to expiration of the swap rate S_pq.

This quantity is used in the analytic approximation to the swaption price. See LiborProcess.ps

Parameters:
p - swap starts at T_p
q - swap stops at T_q

swaptionPrice

public double swaptionPrice(int p,
                            int q,
                            double kappa)

Analytic approximation to the swaption price. Based on a log-normal distribution of the swap rate.

Parameters:
p - swap starts at T_p
q - swap stops at T_q
kappa - strike rate.

integral_g_squared

public double integral_g_squared(double T)
integral_0^T g(u)^2du, where g(u) is the function defining the volatilities sigma_j(t)=c_jg(1-t/T_j) in the CS_FactorLoading. Makes use of the current values of the fields A,D,rho00,alpha,beta.


calibrate

public LMM_Parameters calibrate(int nPoints)

Calibration of a CS_FactorLoading to caplet and swaption prices. All caplets are used and missing caplets interpolated. Caplet prices are matched precisely. Only available swaptions are used, missing swaptions are ignored.

The calibration routine is an "exhaustive" search of the parameter rectangle along a low discrepancy sequence. The routine repeatedly narrows the search space to a smaller rectangle around the current optimum.

The calibration routine tries to minimize the mean percent deviation of model computed analytic swaption prices from quoted prices and returns an LMM_Parameters object which can be handed to a constructor to instantiate a LiborProcess.

Intial search region for the CS_FactorLoading parameters:
A ε[0,30], D ε[0.1,0.9], rho00 ε[0.01,0.8], alpha ε[0,-6log(rho00)], beta ε[0,alpha/n].
It is a good idea to modify these settings (in the source code) to see how this alters the performance. Experiments show some unexpected phenomena.


main

public static void main(java.lang.String[] args)
                 throws java.io.IOException

Calibration test, calibrates a CS_FactorLoading to a set of data in dimension n=15.

The data are synthetic prices generated from a Libor process based on a EP_FactorLoading. These data are then used to calibrate a CS_FactorLoading.

Recall that the calibration routine does not build an initial term structure of forward Libors (from quoted Libors and swap rates) but instead receives the precise initial term strucutre as a parameter. Likewise an EP_FactorLoading is close in spirit to a CS_FactorLoading. Both have humped forward Libor volatilities and a correlation structure of the form rho_ij=b_i/b_j, i<=j where b_i is an increasing sequence. Needless to say this makes calibration easier.

Obviously it is extremely important to test this routine and the concept of a CS_FactorLoading on market data. Thus this class and its methods should mainly be viewed as an infrastructure to base your own calibration experiments on and as an example of how one might go about doing this.

Even so some interesting phenomena are already evident in this rudimentary example. In particular it is observed that the optimal parameter values are often highly nonintuitive. For example very large volatility bumps (large parameter A) combined with very low correlations (much lower than in the data) often match the data very closely. Moreover widely different parameter tuples yield very good approximations. Of course this could be interpreted as saying that we are not close to an optimum yet. On the other hand the model swaption prices show a mean percentage error of less than 0.5%, a very good approximation indeed.

Throws:
java.io.IOException