Yield to Maturity: A Basic Interactive

The yield to maturity concept describes the approximate rate of return a bond generates if it’s held until redemption date. It’s dependent on a few things including the coupon rate (nominal interest rate), face value of the bond, price of the bond and the time until maturity.

It can get a little confusing with the mathematics behind it, so I’ve created a simple Shiny App that allows you to manipulate the inputs to observe what happens. Bear in mind this is not a financial calculator, it’s an interactive for educational purposes. It’s also the approximate not exact yield to maturity of a bond which is fine for our purposes.

I’ve mapped the yield up to 30 year redemption and assumed a face value of $100. Coupon rate varies between 0% and 25%. Current price of the bond can vary between $50 and $150. Mostly, the yield curve is very flat in this simplified approximation- but observe what happens when there is only a short time to maturity (0-5 years) and rates or price are extreme. You can find the interactive directly here.

 

 

Remember, this is just an approximation. For a more accurate calculation, see here.

Kids can code: update

So the kid heard I might know a thing or two about random number generators and could see how these might be useful to choose a drink for dinner. So we worked on a short program together and he was quite happy with the result. We also had a good discussion about random seeds and when/if you want to use them. Altogether a great nerd-bonding session.

Then, being ten years old, he had to alter the program to his own satisfaction. He used his own name, but privacy and all of that- you get the point.

Cheeky child's code

Scifi fans tweet and watch Dark Matter at the same time

This isn’t a very serious post. I’m something of a scifi fan and Dark Matter is a current favourite. It screens in the U.S. before it’s available on iTunes for download here in Australia so every Saturday, my twitter feed is full of my fellow fans gushing as I seethe with jealousy.

What’s a nerd to do?

Make a graph, obviously.

Line graph of number of tweets on dark matter

It’s clear when the show is screening, because people start tweeting like crazy. It’s actually pretty fun to watch people’s reactions to a show they love in real time. The good news is, it’s been picked up for a third season. In my view, it’s just hitting its stride.

So apparently this week the Android and team got up to something, it was exciting and I could tell you what everyone said on twitter, post the word clouds and top tweeters, analyse twitter sentiment, create network analyses of cast and fans interacting.. or I could just go watch the show now that I can download it.

Bye.

Does it matter in practice? Normal vs t distribution

One of the perennial discussions is normal vs t distributions: which do you use, when, why and so on. This is one of those cases where for most sample sizes in a business analytics/data science context it probably makes very little practical difference. Since that’s such a rare thing for me to say, I thought it was worth explaining.

Now I’m all for statistical rigour: you should use the right one at the right time for the right purpose, in my view. However, this can be one of those cases where if the sample size is large enough, it’s just not that big a deal.

The actual simulations I ran are very simple, just 10 000 draws from normal and t-distributions with the t varying at different degrees of freedom. Then I just plotted the density for each on the same graph using ggplot in R. If you’d like to have a play around with the code, leave a comment to let me know and I’ll post it to github.