Saturday, December 8, 2018

Book recommendation

Looking for a fun book? Check this one out! (The author is my sister.)


Saturday, February 25, 2017

Time to retirement

There is a vast amount of misleading advice out there about how to save for retirement. Unfortunately, there are no secret tricks that allow you to retire early (unless you are lucky enough to inherit a large fortune). In reality, early retirement requires saving a large chunk of your after tax income. But just how much of your income do you need to save? Many people have already published excellent articles on how to calculate the amount of savings needed to retire after working for a given length of time (see this article, and this article.) I took their method, simplified it a bit, and plotted the results. I'll explain a bit more about how I generated this plot, but for now, here it is:

The essential idea behind this figure is that the fraction of your income that you save indicates two things -- 1. how much you are putting away each month, and 2. how little money you can live on. This number, which I'll call savings rate, is the one that is easiest for a worker to control. As a concrete example, let's say that Joe makes $100,000 after taxes each year. If he saves $10,000 each year, then his savings rate is 10%. OK, pretty simple so far. Now we need just one more number: the rate of return on investments. This is where my simplifying assumption comes in. Many people suggest that you withdraw no more than 4% of your savings each year in retirement, but they also maintain that you can expect to earn more than that in the stock market. To be conservative, I assume that you only earn 4% return on your investments annually. (If you're intersted, we'll see the impact of changing this number below.) I also assume that we're starting at the very begninning of our subject's career, so Joe has no money already saved, and that his income doesn't change over time. (Hopefully this is not the case, but it's safer not to count on big raises in the future.) Finally, our most stringent criterion: we want Joe to be able to live indefinitely in retirement, so he doesn't out-live his savings, and he'll have something for his kids to inherit. OK, those are the assumptions. By looking at the figure, we can see that at Joe's savings rate of 10%, he can retire after working for about 60 years. That doesn't sound very appealing, but I hope it is empowering to notice that if Joe manages to save 30%, or $30,000 per year, he could retire safely in just 30 years!

Now, I promised that we could look into the effect of our assumption that the annual rate of return on investments is 4%. In the following figure I have plotted the results of this calculation for different rates of return. Note that these also assume the subject withdraws that amount every year in retirement, which might not be a good idea because it doesn't allow for bad years early in retirement.

I've also posted this analysis on my github site.

Disclosure: Nothing in this article should be construed as tax advice, a solicitation or offer, or recommendation, to buy or sell any security. This article is not intended as investment advice, and I do not represent in any manner that the circumstances described herein will result in any particular outcome. Past performance is no guarantee of future results.

Friday, December 9, 2016

Power analysis in A/B Tests

I recently wrote a very basic jupyter notebook demonstrating how to calculate the sample sizes necessary to detect a minimum effect size given desired false positive and false negative rates. I used a web site A/B test as an example, but the technique is generally applicable.

Thursday, June 2, 2016

Using Inkscape and FreeCad with Epilog Laser cutters

Our 75 watt Epilog Helix 24 is a tremendously useful piece of laboratory equipment for quickly prototyping or fabricating parts. Using it to cut out parts designed in Solidworks is fairly simple, but I was interested to see if it can be used with open source alternatives. Happily, the answer is yes!

Inkscape

First of all, because laser cutting is essentially a 2-dimensional process, I wanted to be able to cut out designs produced in Inkscape, the premier open-source 2D drawing application. Because our Epilog has a 24"x18" cutting surface, I created a 24"x18" document, and then I drew the lines I wished to have cut. Now, to have the lines cut (instead of raster engraved) it is necessary to make all the line widths sufficiently small (under Fill and Stroke>Stroke style>Width). I chose .001 px. Unfortunately this makes them smaller than a pixel on most screens, but don't worry, they are still there. To actually send the file to the laser cutter, in Inkscape Windows Version 0.91, choose Extensions>Export>Win32 Vector Print. This brings up the Epilog print screen. Make sure the height and width match the document, and you are ready to cut!

Laser cutting with Inkscape

FreeCad

Although Inkscape is great for quick 2D designs, for more complicated parts full 3D design software is necessary. FreeCad is starting to reach the point where it is ready for real use. After designing a part, it is easy to save an orthographic view to an svg file, then use the laser cutter to cut it out: First, select the part and go to the Drawing Workbench. From there you can create a new drawing, and add the orthographic projection. Finally, click the save drawing icon:

Exporting from FreeCad to svg to cut on a Epilog laser cutter
The drawing is saved as an svg file. I had some trouble cutting designs from these files directly, but if you open the document we first created in Inkscape, then import the FreeCad file, it seems to work. After importing the part drawing, it is apparently necessary to select all the elements and convert them to paths:  go to Path>Object to Path. (I discovered this necessity because my part contained many circles, which were not getting cut by the laser cutter.) Now make sure your line widths are .001 pixels, and follow the directions above!

Monday, April 4, 2016

Photoreceptor paper accepted!

Our paper on polarization processing by photoreceptors is out in the Journal of Neuroscience! Here is some supplementary information that describes our process for mounting flies for simultaneous functional imaging and behavioral experiments.