# Affine term structure for CDS

in papres such as https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2686284 (Exploring Mispricing in the Term Structure of CDS Spreads by Robert A. Jarrow, Haitao Li, Xiaoxia Ye, and May Hu) a state space model is applied to the term structure of the CDS. what are the variables that make up the state variables? How can I calibrate the uscented kalman filter? Have you some matlab examples?

• Hi, I just had a look: isn't everything laid out in the paper, especially in the appendix? If you present your effort so far, we might be better able to help you. Oct 16, 2020 at 8:49
• Hi, I would like calibrate an affine term structure model on a matrix of CDS spreads where each column it's a specific maturity (6m,1Y,...,30Y) and each row it's an observation date. I haven't understood, principally, what are the parameters of input for the UKF. I've to use the CDS spread, directly, or the bootstrapped intensities? Oct 16, 2020 at 9:05

In a (very small) nutshell, the estimation idea is the following:

1. Quoted CDS contracts are driven by a risk neutral default probability $$PD_Q(\tau\leq T)$$.
2. The default probability is again modeled via a default intensity process $$\lambda_t$$, i.e. $$P_Q(\tau \leq T)=\mathrm{E_Q}\left(e^{-\int_0^T\lambda(s)ds}\right)$$
3. The default intensity process may be modeled as a CIR process (strictly positive), i.e. $$d\lambda_t=\kappa(\theta-\lambda_t)dt+\sigma\sqrt{\lambda_t}dW_t$$

Thus we may observe (daily) CDS quotes (at various, fixed, maturities, i.e. 1Y, 3Y, 5Y) but we cannot observe the underlying $$-$$ model-specific $$-$$ default intensities. In order to estimate the latent level $$\lambda_t$$ for each observation time point $$t\in(0,1,\ldots ,T)$$ as well as all unobservable parameters $$\kappa,\theta,\sigma$$ we need to find a way to glue observations $$CDS_t$$ (potentially with an observation error $$\epsilon_t$$) onto the (latent) state space process and do some inference.

Linear world: If the observation model (CDS quote) were a truly linear function of the underlying intensity, we could very easily make use of the standard Kalman filter machinery:

1. Discretize the state space process, i.e. $$\lambda_{i+1}=a+b\lambda_{i}+\sigma_iz_{i+1}$$
2. Formulate the (vector of) observations: $$CDS_i=A+B\lambda_i+y_{i}$$
3. Apply the Kalman Filter (If you want to do full inference (i.e. if you want to find the 'true' underlying distribution etc.), you may need to apply forward and backward sweeps of the Kalman Filter).
4. Optimize $$\kappa,\theta,\sigma,\lambda_0,...$$ so that the likelihood of the CDS observation errors is minimised.

As the CDS pricing equation is not linear in the underlying intensity state, we cannot simply invert the (linear) observation equations, but must resort to more computationally intensive means, e.g. the UKF or even brute force Markov Chain Monte Carlo.

Again: All this on a very high level.

• Thanks a lot, it's a little bit more clearer now. Have you some example implementation in Matlab? Another question, how I can switch from the risk neutral measure Q to the objective measure P? Oct 16, 2020 at 12:38
• I did part of this during my PhD in Matlab, yes. PSA: it's a real pain; don't go there! Nevertheless, this could be starting point theorywise papers.ssrn.com/sol3/papers.cfm?abstract_id=2512198. This is an MCMC implementation. You may 'strip out' the FX option components, drop the jump parts, and arrive at a very simple model of CDSs and default intensities. Should be not too hard from there (though, still a bit of effort involved)... Oct 16, 2020 at 12:48