How much will my 401k be in 30 years?

Standard

A couple of months ago, I discovered Mr. Money Mustache (MMM). He’s somebody who “retired” at the age of 30 by saving a ~3/4 of his income and living a frugal lifestyle. A unique and enthralling way of living the American Dream. I have been reading through his different posts and like what I read. As you could likely guess, many of MMM’s blogs deal with investing. I like his posts because they encourage me to think about topics and ideas that I may otherwise not think about.

One of these topics is the “safety factor” when dealing with investing. Safety factors are commonly used in engineering and MMM was trained as an engineer. In a nutshell, safety factors often use the worst case scenario and then include a multiplier (e.g., 10 times that value) as a “safety factor”. As an example, perhaps a type of chair breaks with 1,000 lbs during a test. A safety factor of 2 would limit the chair to 500 lbs max in case the wood deteriorates or other stressors are added or not accounted for.

In contract, I have been trained and an ecotoxicologist with a healthy mix of statistics tossed in to my education. We usually deal with messy data and safety factors are often discouraged because they often do not perform well. One alternative approach is probabilistic risk assessment. This approach assigns a probability distribution to inputs (e.g., market returns) and, conditional on the quality of the data, allows one to estimate the probability of an even occurring. In this post, I apply a a probabilistic approach to explore MMM’s investment assumptions.

MMM usually assumes a 5% return rate on the stock market (or more specifically, on broad index funds) after inflation and uses a 4% withdrawal rate as an added layer of safety. He uses this to define the “safe withdrawal rate” as

“the maximum rate at which you can spend your retirement savings, such that you don’t run out in your lifetime.”

Besides applying this to retirement, he also applies this to idea to understanding how investments grow. Overall, I like his approach. It is a nice approximation that is easy to understand. That being said, I use probabilistic tools at work and I want to explore this investment concept more.

Motivating my own case study is my pending switch from a contractor to Federal Term employee. I will have a ~$3,000 in my 401k when I leave and am wondering how much money will be there in 30 years when I can access it. I’ll do my simulations in R because I am familiar with the program and it is free so anybody can “follow along at home” if they would like (Note that you’ll need to not copy the “>” into R).

To start off, I define two variables:

> nYear = 30 # number of years
> growth = 1.05 # annual growth after inflation

and then use this to calculate how much money I will have in 30 years. This is a difference equation that MMM likes to use and the math is simple:

> growth^nYear
[1] 4.321942

Based upon this worst case scenario, I will should expect to have 4.3 times my starting investment. Therefore, my $3,000 will be come about $13,000 when I can access it in 30 years. However, what about the variability in this simulation and uncertainty? This year, I might get 1.05 growth, but next year could be 1.03 and the year after 1.05. We could simply take the product of 30 years:
1.05 * 1.04 * 1.03 * 1.6 …
but this is tedious, error prone, and boring. Programing and simulations come to the rescue for situations such as this. Instead of generating the numbers by hand, we can assume that they come from a normal distribution. This requires me to guess a standard deviation. I’ll guess 0.05 because it seems reasonable and I do not know a great deal about quantitative finance. In R, this looks like:

> rnorm(n = nYear, mean = 1.05, sd = 0.05)
 [1] 1.0460267 1.0851230 0.9941926 1.0551473 1.0233291 1.0695875 1.0287381 1.1444693
 [9] 1.0428234 1.0557862 1.0947897 1.0367700 1.0036091 1.0797985 0.9861632 1.0154970
[17] 0.9705547 1.1681693 1.0083213 1.1077836 1.0220802 1.0551286 0.9268657 0.9814797
[25] 0.9921165 1.1120307 1.0640827 1.0439697 1.0824330 1.0698607
and this gives us 30 different growth rates. We then take the product of this and save it as x:
> x = prod(rnorm(n = nYear, mean = 1.05, sd = 0.05))
> 
> x
[1] 3.318441

In this example, my investment become 3.31 times larger. But, this is just one possible trajectory. To check out more, I created a function that also plots a histogram and tells me where 95% of the simulations fall:

marketReturn <- function(nYear, growth, sd, reps = 10000, title = "Histogram"){
    x <- numeric(reps)
    for(i in 1:reps){
        x[i] <- prod(rnorm(nYear, growth, sd))
        }

hist(x, main = title)
return(list(
    min = min(x), 
    max = max(x), 
    ci95 = quantile(x, c(0.025, 0.975))
    )
    )
    }

I can now use this function to run 10,000 simulations:

> marketReturn(nYear = nYear, growth = growth, sd = sd, reps = 10^4, title = paste("sd =", sd))
$min
[1] 2.070814

$max
[1] 9.194219

$ci95
    2.5%    97.5% 
2.996903 6.019339

sd005

In case you are unfamiliar, a historgram shows the number of counts on the y-axis and the observations on the x-axis. In this case, the x-axis is how many times my money has grown at the end of 30 years (e.g., 4 times).

Thus, assuming a worse case scenario, I can expect my money to grow between 3 and 6 times it current value. However, what if we dig around on the web, perhaps we can do better with the guess for the standard deviation:
This page list 0.0346 as a standard deviation:

> sd = 0.034
> marketReturn(nYear = nYear, growth = growth, sd = sd, reps = 10^4)
$min
[1] 2.360319

$max
[1] 7.885858

$ci95
    2.5%    97.5% 
2.989520 6.035744

sd003

Which yields a similar result. Another site uses 0.15, but this seems high

> sd = 0.15
> marketReturn(nYear = nYear, growth = growth, sd = sd, reps = 10^4, title = paste("sd =", sd))
$min
[1] 2.191817

$max
[1] 7.982334

$ci95
    2.5%    97.5% 
2.977771 6.008814

sd015

Regardless, the 5% annual growth after inflation is a worst case scenario from MMM. A more optimistic return might be 7%:

> growth = 1.07
> sd = 0.05
> 
> marketReturn(nYear = nYear, growth = growth, sd = sd, reps = 10^4, title = paste("Mean growth of 7% with sd =", sd))
$min
[1] 2.830627

$max
[1] 18.28947

$ci95
     2.5%     97.5% 
 4.491611 12.106446

g7

Thus, if I am lucky, or at least average, I will most likely have 6-7x my initial amount when I retire. Thus, my $3,000 will likely be $18,000 to $21,000 in today’s dollars! If I am unlucky, I will only have ~3x my current amount (actually my worst case was ~2.8, which is more pessimistic that MMM’s worst case). And if the market does very well, I could have 12-18x my current amount!
Einstein is often quoted as saying:

“The power of compound interest the most powerful force in the universe.”

Although this quote may or may not be from him, these simulations demonstrate the power of compound interest.

Although, past performance is no indicator of future gains, the future does look promising! If you’d like to explore different scenarios, please feel free to adapt and share this code. If you find anything cool or any bugs with my code, please share it in the comments.

Midwest Mathematical Biology Conference

Standard

Two weekends ago, I was lucky enough to attend the Midwest Mathematical Biology Conference.

This meeting was hosted by the University of Wisconsin-La Crosse and was the first time for the event. Overall, the meeting was great. I enjoyed the great keynote speakers. Meetings like this help inspire me because I enjoy seeing how other people solve problems. I also enjoy the networking and collaborations formed between researchers.

The keynote address that stood out most to me as the one by Carlos Castillo-Chavez. Carlos provided a great overview on epidemiology modeling and to use multiple scales of modeling together. He summarized a project that used an Individual-based Model to examine how disease spread at the city-level and then scaled up the results to a national level. These results were also compared traditional SIR models. The research does a great job illuminating where people catch infection disease during outbreaks. Surprisingly, most people get sick at home. This happens because people have the most contact with others when they are at home. However, when school is not in session, outbreaks are less likely to occur.

Besides the other great talks, my postdoc mentor had a great observation. He realized the USGS has very few mathematicians and all of them are doing geology (or at least non-biology) research. We wished we had more mathematical support. Furthermore, the Midwest Mathematical Biology Meeting expanded his view of biomath. Even if I gained nothing else from the meeting, having my postdoc mentor appreciate math more made it all worth while! However, I did gain more. So, the meeting was great opportunity!

Meet a Quantitative Ecologist

Standard

“So, what does a quantitative ecologist do?”

This is the first question most people ask me when I rattle off my job title. Basically, I use math to study and solve ecological problems. I am living a giant math story problem and enjoying it! I use ecological model, computational mathematics, and advanced statistics to not only solve problems, but also define them. For those of you familiar with the term, I consider myself a quant. Unlike most quants, I primarily study the environment. On any given day, I might be modeling where a species occurs or studying how a chemicals affect wildlife. In addition to the environment, I also dabble in medical biostatistics and quantifying risk for business. Statistics and mathematics allow me to “play” in many different field’s backyards.

How might one become a Quantitative Ecologist do you ask?

Growing up, I always enjoyed the outdoors. As a family, my parents, brother and I would go on hikes and bike rides often. Through scouting, I went on many a camping trip ranging from backyards and pastures to wilderness areas. This led me to restore a prairie for my Eagle Scout project with a wildlife biologist. My project motivated me to study wildlife ecology  for my undergraduate major. However, the wildlife job market is very tough! So, I chose to go to grad school for environmental toxicology.

Okay, so I see you’re why you’re an ecologist, but where does the “quantitative” part fit in?

Growing up, I always liked to play computer games and enjoyed math until it became hard in high school (I still hate calculus to this day!). I did not link the two interests formally until grad school. I developed a mosquito/dengue model for my MS research. One of my MS committee members, and future PhD co-adviser, told me that I needed to learn mathematics if I wanted to model. Begrudging and almost whimsically, I followed this advice and eventually even took it to heart. Two years of coursework later, I completed a doctoral minor in mathematics. This coursework helped me to completed my doctoral research where I studied the effects of pesticides on Daphnia.

I saw a posting on the TWS Biometrics Working Group email list adverting a postdoctoral position to study the effects of wind energy on cave bats. I applied for the position, and am now a “Quantitative Ecologist”.

Introduction

Standard

“Nothing in the world of living things is permanently fixed.”
Hans Zinnser — Rats, Lice and History, 1935

Our world is ever-changing. Stock prices go up and down. Seas and temperatures are rising. New chemicals emerge from the lab that may either be a deadly poison or a modern miracle or possibly both. Search engines must scan a constantly changing web. Even the American pass time of baseball uses sabermetrics to choose and evaluate players.

These situations are all dynamic. “Dynamic” simply means things are changing rather than staying constant or “static.” Understanding these situations requires the use of models. More specifically, quantitative models. Hence the title of this blog: “Quantitative Dynamics”.

This blog is about quantitative dynamics. We’re going to cover topics ranging from cave bats to health care. I’ll also talk about other things that strike my fancy. Mainly these topics will be about environmental science and ecology, but I have a broad interest in how models may be applied across our lives (e.g,. FiveThirtyEight.com). I am writing this blog for several reasons: to share my research with non-scientists, to write down ideas/techniques so that I do not forget them, and to learn about blogging. Last, I enjoy teaching and will use this blog to share what I am learning both on and off the job.