Site icon R-bloggers

Diffusion models in ESGtoolkit + announcements

[This article was first published on T. Moudiki's Webpage - R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Contents

1 – news

Version 0.6.2 of ESGtoolkit is now available:

It is now possible to use Hermite cubic spline and Smith-Wilson methods for yield curve interpolation.

Starting with version 1.0.0, the next version, ESGtoolkit will be renamed as esgtoolkit or something similar, as I’m removing all my packages from CRAN.

A Python version of esgtoolkit will also be available soon on Techtonique.

2 – examples

Single curve

library(ESGtoolkit)

# Yield to maturities
txZC <- c(0.01422,0.01309,0.01380,0.01549,0.01747,0.01940,0.02104,0.02236,0.02348,
         0.02446,0.02535,0.02614,0.02679,0.02727,0.02760,0.02779,0.02787,0.02786,0.02776
         ,0.02762,0.02745,0.02727,0.02707,0.02686,0.02663,0.02640,0.02618,0.02597,0.02578,0.02563)

# Observed time to maturities
u <- 1:30

par(mfrow=c(2,2))
fwd1 <- ESGtoolkit::esgfwdrates(in.maturities = u, in.zerorates = txZC, 
                    n = 10, horizon = 20, 
                    out.frequency = "semi-annual", method = "fmm")
matplot(as.vector(time(fwd1)), fwd1, type = 'l', 
        main = "Forward rates with \n fmm",
        xlab = "time to maturity", ylab = "forward rates")

fwd2 <- ESGtoolkit::esgfwdrates(in.maturities = u, in.zerorates = txZC, 
                    n = 10, horizon = 20, 
                    out.frequency = "semi-annual", method = "SW")
matplot(as.vector(time(fwd2)), fwd2, type = 'l', 
        main = "Forward rates with \n Smith-Wilson",
        xlab = "time to maturity", ylab = "forward rates")

fwd3 <- ESGtoolkit::esgfwdrates(in.maturities = u, in.zerorates = txZC, 
                    n = 10, horizon = 20, 
                    out.frequency = "semi-annual", method = "HCSPL")
matplot(as.vector(time(fwd2)), fwd3, type = 'l', 
        main = "Forward rates with \n Hermite cubic spline",
        xlab = "time to maturity", ylab = "forward rates")

fwd4 <- ESGtoolkit::esgfwdrates(in.maturities = u, in.zerorates = txZC, 
                       n = 10, horizon = 20, 
                       out.frequency = "semi-annual", method = "hyman")
matplot(as.vector(time(fwd4)), fwd4, type = 'l', 
        main = "Forward rates with \n Hyman method",
        xlab = "time to maturity", ylab = "forward rates")

To leave a comment for the author, please follow the link and comment on their blog: T. Moudiki's Webpage - R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Exit mobile version