# Example Shiny App – Interest Rate Walk

November 27, 2017
By

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

This Shiny app demonstrates the Cox-Ingersoll-Ross interest rate walk and an interest rate walk conducted using a bootstrap resampling technique. The code used to create this app is available on GitHub. Assuming you have the necessary packages installed, you should be able to run this Shiny app on your local computer. A live version of the app is available here.

Please take a look at the app before reading the rest of this post. For maximum clarity, read the post with the app open and look at the inputs/outputs in the Shiny app as they are described in the post.

### Bootstrap Resampling Method

This method takes a starting interest rate (selected by the user of the app) and applies randomly drawn historical treasury yield changes to that initial rate. The treasury yield changes can be drawn from either 1, 5, 10, 20, or 30 year treasuries (depending on the user’s selection). The user can also control the historical time period over which the yield changes are drawn from.

Despite the method’s naivete, the plotted results look reasonable. I could see myself having a hard time distinguishing the results of one of these walks from true interest rates over a given time period.

### Cox-Ingersoll-Ross Walk

I used the `sde::rcCIR()` function to generate this walk. This Shiny app’s inputs for this walk are:

• a which controls the speed at which the interest rate reverts to the mean
• b the mean interest rate
• sigma which controls the volatility

No matter which paramters I select, the resulting walks seem far too concentrated around the mean and/or the yields bounce back and forth across the mean at an unconvincingly fast frequency. It is very posisible that I am doing something wrong, and I will investigate further. The code is available on GitHub (link above); please reach out, if you see any errors.

### Conclusion

Interest rate walks are a fast and easy way to simulate rates similar to real world interest rates. In this app, the bootstrap resampling of historical treasury yield changes gives a far nicer quick eye test result than the CIR. Do you have a preferred method for conducting interest rate walks? That is probably not a question you hear every day :), but if you do, please let us know in the comments below.

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.