Introduction

Monte Carlo methods are a broad class of computational approaches that rely upon repeated random sampling to solve problems.

As an introductory example, Monte Carlo methods can determine the value of \(\pi\) by randomly generating data-points uniformly across a unit square, finding the proportion that have a distance of less than 1 to the origin (leftmost corner of the square), then scaling (multiplying by 4 in the depiction shown below).

Question #1: Why does this method work? That is, how does \(\pi\) relate to what this simulation is looking at?

\(~\)

Monte-Carlo and Probability Models

In this simple example we can see that Monte-Carlo methods involve two fundamental components:

  • One or more random variables with accompanying probability model(s)
  • Mathematical calculations involving those random variables which convey a practical meaning

Question #2: What are the random variable(s) and probability model(s) in the \(\pi\) example described in the introduction? What calculations are done using the draws from these random variables?

\(~\)

Application - Retirement Planning

The goal of this portion of the activity is to illustrate how you could create your own Monte-Carlo simulation with a modest amount of training.

I’ll ask you to explore an R Shiny application here:

To provide some additional context, R Shiny is an interactive framework involving an HTML user interface and back-end R code. Currently (as of Fall 2023), Sta-230 (Intro to Data Science) and CSC-324 (Software Design and Development) both include the development of R Shiny applications.

  • You can find a short tutorial that I use in Sta-230 at this link.

Question #3: Notice this app has 8 different inputs that can be set by the user. Do you think that each of these inputs represents different a random variable in the underlying simulation? Hint: think about what you might consider “fixed” and what you might consider “random” in the context of retirement planning.

Question #4: In your own words, describe what is shown in the “Projected Value of Initial Capital” output graph. For this you should describe what each line depicts and why some lines go all the way to the right end of the graph while others stop early. I encourage you to try out different values in the app’s inputs to help you better understand this graph.

Question #5: In your own words, describe what the “Percentage of Paying Scenarios” and “Distribution of Final Capital X% are still paying” graphs are showing and how they relate to the graph you described in Question #5.

\(~\)

Where’s the Monte-Carlo?

In this section I will ask you to look at the app’s underlying code to identify how it is using Monte-Carlo methods. If you’ve never looked at or written computer code on your own before, feel free to consult with another group with someone who has if you get stuck or feel lost.

The code for the “server” portion of the app can be found at the link below:

Although it isn’t relevant for the following questions, here’s the “UI” portion of the app (in case you’re curious):

Question #6: In R, the function rnorm() is used to generate a specified number of random draws from a normal distribution with a certain mean and standard deviation. In total, how many random values are generated when using the default inputs of this app? (note the defaults are: 20 years, 2.5% inflation, 2M invested, 1.5% inflation volatility, 5% return, 10k monthly withdrawals, 7% investment volatility, 200 simulations)

Question #7: What assumption(s) are made by the creator of this simulation regarding monthly investment returns and monthly inflation? Hint: think about whether randomly drawn return/inflation values in one month has any relationship with each other, or if they have any influence on the values in another month.

Question #8: Does it seem realistic for one month’s return to not depend upon the previous month’s return? Conduct a brief search and justify your answer with a quote from a reputable source.

Question #9 Does it seem realistic for one month’s inflation to not depend upon the previous month’s return? Conduct a brief search and justify your answer with a quote from a reputable source.

Question #10: Based upon your answers to Questions 7-9, do you believe this app is still a useful tool? Briefly explain. Note: There isn’t a right or wrong answer here, but you should justify your beliefs. You should aim to right at least 3 complete sentences for this question.