Posts for Tag: programming

Shall We Play A (Market Timing) Game?

Posted In: Financial Independence | Money
Facebooktwittergoogle_plusredditpinterestlinkedinmail


The Market Timing Game simulation is premised on the idea that buying-and-holding index investing and index funds are a no-brainer investment strategy and market timing (i.e. trying to predict market direction and trading accordingly) is a less than optimal strategy. The saying goes “Time in the market not timing the market”. In this simulation, you are given a 3-year market period from sometime in history (between 1950 and 2018) and you start fully invested in the market and can trade out of (and into) the market if you feel like the market will fall (or rise). The goal is to see if you can beat the market index returns.

If you get the 80’s movie reference to “WarGames”, then you might guess the best way to avoid losing the Market Timing Game.

Another way to put this is just to buy and hold. Put your investments into low-cost index funds and don’t worry (too much) about the ups and downs of the market. They always happen, but over time, stocks tend to go up and trying to time when to get into or out of the market leads to sub-optimal result for most regular investors and even many professional investors.

Data and Tools: Daily, historical dividend adjusted prices for the S&P500 stock index (between 1950 and 2018) were downloaded from Yahoo! Finance. The game was programmed in Javascript using the Plot.ly engine to create the graph.

Counting to One Million in Different Languages (Chinese, English and Spanish)

Posted In: Counting | Math
Facebooktwittergoogle_plusredditpinterestlinkedinmail

Updated: Lots of folks on Reddit pointed out some mistakes in the Spanish calculations, and helped me figure out the solutions, so the Spanish graphs are now updated. The Spanish calculator is now live!

Building off of the last post about Counting to One Million in English, I received some comments about looking at other languages.  That seemed like a very good idea, so I looked at a list of the world’s most popular languages and saw Chinese and Spanish listed with English in the Top 3.  Having a little experience with both of those, I set out to compare how long it’d take to count in each of these languages, if you had to pronounce every single number from one to one million.

Again, here’s the plot of the number of syllables per number for English.  The longest word is seven hundred seventy seven thousand seven hundred seventy seven (20 syllables).

Count to one million in English
(more…)

March Madness Bracket Picker Based on Historical Probabilities (and Monte Carlo Simulation)

Posted In: Sports
Facebooktwittergoogle_plusredditpinterestlinkedinmail


(more…)

March Madness Matchup Visualizer

Posted In: Sports
Facebooktwittergoogle_plusredditpinterestlinkedinmail

It’s March and for those who follow sports, that means college basketball and March Madness.  The tournament is mainly interesting because of two reasons: (1) filling out brackets and (2) watching and hoping for upsets .  This interactive March Madness matchup visualizer helps do both of these things by showing you the history of the tournament (since 1985 when the tournament expanded to 64 teams) in terms of matchups between teams with different seeds (1 through 16 in four regions).
(more…)