Pallara and Renne (2023) and Renne and Pallara (2023) investigate the pricing the sovereign credit risk in the context of shadow-intensity frameworks. In that type of framework, the prices of defaultable bonds are given by conditional expectations of the form:
\[\begin{equation}
\mathbb{E}_t(\exp[\color{blue}{-z_{t+1}-\dots-z_{t+h}}-\max(0,\lambda_{t+1})-\dots -\max(0,\lambda_{t+h})]),\tag{1.1}
\end{equation}\]
where \(z_t\) (risk-free short-term rate) and \(\lambda_t\) (*shadow default intensity*) are affine functions of the state vector \(x_t\). In addition, \(x_t\) follows a Gaussian vector auto-regressive (VAR) model. That is, we have:
\[\begin{eqnarray*}
z_t &=& \dot{a}'x_t + \dot{b}\\
\lambda_t &=& a'x_t + b,
\end{eqnarray*}\]
and
\[\begin{equation}
x_t = \mu + \Phi x_{t-1}+ \Sigma\varepsilon_t,\tag{1.2}
\end{equation}\]
with \(\varepsilon_t \sim \mathcal{N}(0,Id)\) (where \(Id\) denotes the identity matrix).

Equation (1.1) gives the risk-neutral price of a bond of maturity \(h\), issued by an entity whose default intensity is \(\underline{\lambda}_t = \max(0,\lambda_t)\). (That is, the conditional default probability of the issuer, on date \(t\), is \(1-\exp(-\underline{\lambda}_t)\).)

Absent the blue terms, the conditional expectations appearing in (1.1) would be of the same type as the ones considered in the shadow-rate literature (see Black (1995)). In that case, one could for instance use the approaches proposed by Priebsch (2013) or Wu and Xia (2016) to calculate approximations for these conditional expectations. Pallara and Renne (2023) and Renne and Pallara (2023) extend the approach of Wu and Xia (2016) to compute approximate values to (1.1). Th present page uses the latter approach, employing codes contained in package `TSModels`

to implement this approach.

To start with, load package `TSModels`

. This library is available on GitHub and can be accessed using the following lines of code:

```
install.packages("devtools")
library(devtools)
install_github("jrenne/TSModels")
```

Consider a two-factor model, that is \(x_t = [x_{1,t},x_{2,t}]'\). Assume that \(z_t\) (that can be interpreted as the risk-free short term rate) depends on \(x_{1,t}\) only, and that \(\lambda_t\) (the shadow default intensity) depends on \(x_{2,t}\).

We consider the following VAR dynamics for \(x_t\): \[ x_t = \left[\begin{array}{cc}0.9 & 0 \\ 0 & 0.9\end{array}\right] x_{t-1} + \left[\begin{array}{cc}1 & 0.1 \\ 0 & 1\end{array}\right]\varepsilon_t, \] which determines \(\mu\), \(\Phi\), and \(\Sigma\) of (1.2).

Further, we want \(z_t\) (respectively \(\lambda_t\)) to be of mean 2% (respectively 0) and of standard deviation \(1\%\) (resp. 2/%).

Let us code these specifications:

```
Phi_x <- .9 * diag(2) # set Phi
Sigma_x <- diag(2) # set Sigma
Sigma_x[1,2] <- .1
Mu_x <- matrix(0,2,1) # set mu
stdv.z <- .01 # set the unconditional std dev of z
stdv.lambda <- .02 # set the unconditional std dev of lambda
# Compute the unconditional variance of x_t:
uncond.Variance.X <- matrix(solve(diag(2*2) - Phi_x %x% Phi_x) %*%
c(Sigma_x %*% t(Sigma_x)),2,2)
# Deduce a and a.dot:
a.dot <- matrix(c(stdv.z/sqrt(uncond.Variance.X[1,1]),0))
a <- matrix(c(0,stdv.lambda/sqrt(uncond.Variance.X[2,2])))
# Set the unconditional means of and lambda:
b.dot <- .02
b <- .0
```

Let us have a look at simulated paths for \(z_t\) and \(\lambda_t\):

```
library(TSModels)
nb.periods <- 200
X <- simul.X(Phi_x,Mu_x,Sigma_x,nb.periods)
z <- b.dot + a.dot[1] * X[1,1,]
lambda <- b + a[2] * X[2,1,]
```