1
$\begingroup$

Suppose that the spot rate is governed by a Vasicek model. We know that there is an analytical solution for the zero-coupon bond.

I guess the discount curve is constructed by the Yield curve in which we have that

\begin{equation} y(t, T) = -\frac{lnP(t, T)}{(T-t)} \end{equation}
where $P(t, T)$ represents the zero-coupon bond price with maturity time $T$. By the way, the solution for the zero-coupon bond price takes the following form: \begin{equation} P(t, T) = exp\{A(t, T)-B(t, T)r(t)\} \end{equation} where $A(.,.)$ and $B(.,.)$ are deterministic functions. We thus have \begin{equation} y(t, T) = -\frac{A(t, T)}{(T-t)} + \frac{B(t, T)}{(T-t)}r(t) \end{equation}

My problem is when I try to plot the yield curve for different maturity times it seems there is something wrong. Here are my R codes and the output. I do not know if I am thinking right about the discounting curve.

r0<- 0.03

theta<- 0.10546209

kappa<- 0.04802047

sigma<- 0.29051285

T<- seq(0, 1, by= 1/252 )

g<- function(kappa, theta, sigma, t, T){
  
  B<- (1-exp(-kappa*(T-t)))/(kappa)
  
  A<- (theta-  ((sigma^2)/(2*kappa^2))  )*(  B- T+t   ) - ( (sigma^2)/(4*kappa) )*B^2   
  
  h<- -(A/(T-t))+(B/(T-t))*r0
  
  return(h)

}

y<- numeric(length(T))

for(i in 1:length(y) ){
  
y[i]<- g(kappa, theta, sigma, 0, T[i])  
  
}
plot(T,y, type="l")

enter image description here

$\endgroup$
4
  • $\begingroup$ Looks ok to me. Some parameter combinations will result in ‚strange‘ yield curves. $\endgroup$ Jul 14 at 17:37
  • $\begingroup$ Thank you for your answer. so, you believe the discount curve is in fact the Yield curve and not the zero-coupon price? Because I wanted to discount my cash flow. $\endgroup$
    – user53249
    Jul 14 at 18:08
  • $\begingroup$ I was able to replicate your zero coupon yield curve; hopefully we‘re not both wrong ;) $\endgroup$ Jul 14 at 18:44
  • $\begingroup$ Thank you, my friend. $\endgroup$
    – user53249
    Jul 14 at 19:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.