Student-t distribution for stock returns

I have been working on the SimFinance 2.0 application and have been struggling to find a way to simulate the stock market. (Note: I am not trying to predict the stock market, I just need a way to generate a random stock market return that is similar to historic returns)

My first idea was to use a normal distribution centered around the average return with the same standard deviation that the real data has. This was close to correct, but if I plotted sample returns from history against the normal distribution, the historical returns had much longer tails. Meaning that, in reality, there are more really bad and really good years than there would be in a normal distribution.

After doing some research (I am not the only one interested in simulating the stock market), I found that some people are using a Student-t distribution. After playing with the parameters of that distribution I was able to get a much more realistic curve. Based on the historical data for the S&P 500, I am using the following parameters for the distribution: DOF = 3.40234, SCALE = 35, OFFSET = 0.00725

In software, I am using the boost library to generate random numbers according to the student-t distribution.

SimFinance 2.0

I am starting work on SimFinance 2.0.

A long time ago, I tried to create a retirement analyzer/simulator. It would allow a user to enter everything about their finances, including their plans for the future. It then simulated the future by generating thousands of possible scenarios and displaying your odds of still having money when you die. It built these futures probabalistically based on historic performance of different investment types, the user’s life expectancy, etc. The project was too ambitious and I never completed it.

Now, as I consider retirement, I’d like to have this tool. And I realized that I could complete the project if I would limit the scope to just my own situation. It wouldn’t be useful for other people, but it would give me a better idea if I can really retire.

The old project was created with C++ and wxWidgets. I would like to build the new version in C# because it would be easier to create the user interfaces. But C++ would be faster for simulating thousands of futures month by month. It would also let me re-use some of the code from the original project. So I am going to compromise and build it with C++/CLI. I can use the GUI builder and the .NET libraries and also have the speed of native C++ for the time critical parts of the code.

Practice Log – completed

I have finished the PracticeLog software. Here is what it looks like:

 

I am happy with the software. I created countdown and stopwatch timer modes so that the program will time my practice and automatically update the log for today. I added the “Same as Yesterday” button since I practice a particular set of pieces for at least a week at a time.

I also put in a “10000 hours date” field. This is the date when I will have practiced 10000 hours. I have recently read Outliers by Malcolm Gladwell and am intrigued by the notion that, while talent matters, becoming an expert is mostly a matter of putting in the time practicing.

Practice Log

I am staring work on a new application for my own use. It is called the Practice log and I plan to use it to keep track of the time that I spend practicing violin. When I started violin, the first book contained a paper log where you would fill in your practice time each day and it had a column for your parents to sign off on the entries. When I switched over to the Suzuki books, the books no longer included a paper log. I kept using the paper system for a while, but now I would like to computerize it. I will be able to collect statistics and keep a running total of my hours.

I will keep the paper log format and have a way to add a note and a list of pieces practiced to each day.

I am going to develop this in C# using their DataGridView and a SQLite back end database.

New Photo Gallery

I have changed web hosting companies and re-designed my web page. The biggest change is to the photo galleries. There are a lot of photo gallery programs out there, but I couldn’t find one with the feature that I wanted. I wanted to be able to upload a large set of pictures, but only display a sub-set of them on the main page. The rest of the pictures would be “behind” the displayed set. So, if I go to Paris and take a bunch of pictures of the Eiffel tower, I can put one picture on the main page, but allow users to see the rest of them if that is something they are interested it.

I wrote my own system with php and mySql that lets me manage the photos and the galleries. It also lets me separate the galleries into public and private areas. I have been scanning prints of family photos from my childhood and I put those online for the rest of my family to see.

Added board games to the MediaDB

I have added board games to my MediaDB program. I first created the application in java, and then re-wrote it while I was on the Paragon “bench” program. The purpose of the application is to track your personal collection of books, DVDs and now board games. The application originally used Amazon.com’s Product API to fetch item data and an image for books and DVDs in your collection. I have added board games and I am using boardgamegeek.com‘s API to load information and an image for board games.

BoardGameGeek also allows you to track and rate your board games on their web site, so I have added code to download an existing collection, or to upload a collection that you create in the program.

Learning C#

After my job on Sonja at Raytheon ended in late April I continued to be a Paragon Dynamics employee, using their “bench” program. No one was really sure what I was supposed to do while on the “bench”, but I had to come in to their office each day and put in 8 hours of desk time. Some of the time was spent helping Paragon with proposals, computer maintenance and even an office move. But most of the time was my own to fill and I used it to learn C#.

I think of the language as a mix between C++ and Java. It is managed like Java, and has a large set of convenience classes (.NET), but the feel of the language is closer to C++. The Visual Studio IDE is a beautiful piece of software and makes putting together graphical applications simple.

To really learn something, I just have to start using it, so I have written some small applications. A couple of them are good enough to make public, and a couple aren’t.

I re-wrote the Media Database which tracks your books and DVDs using Amazon Web Services to download book/DCD data. It now uses C# instead of Java, so it is faster. And it uses SQLite to store the collection instead of a bunch of little files.

I wrote a Gallery Builder for creating a web page out of a set of digital photos.

I wrote a program to convert an image (jpg, gif, png, etc) into an icon.

And last, and least, I wrote a color picker app that bring up a color dialog and then lists the RGB/HSB values, the web hex code, and the color name.

Thanks to Paragon Dynamics for continuing to pay me while I learned C#.