I have a big dataset containing zero-coupon bond yields with different relative maturities. I fix a time horizon on my dataset and I want to calculate instantaneous forward rate. I'm going to write how I calculated:
The yield curve is given by: $Y(t,T)=-\frac{\log(P(t,T))}{T-t}$ formula.
So by inverting it we get bondprice:
$P(t,T)=\exp(-Y(t,T)(T-t))$
We get instantaneous forward rate from partial derivate of $\log(P(t,T))$ by $T$ so the formula I use is:
$f(t,T_k)=-\frac{\log(P(t,T_k))-\log(P(t,T_{k-1}))}{T_k-T_{k-1}}$.
where $T_0=0$.
My goal is to set up an observation matrix of instant. forward rates for volatility estimation in a model and I want to be sure if my pre-calculations are fine. Thanks for help in advanced.