Exercise

Stochastic nature of Monte Carlo simulation

In the previous exercise, you modeled information deterministically. You'll now attempt to estimate future inflation with a stochastic model, using a Monte Carlo simulation.

Recall that stochastic models simulate randomness in variables by using sampling. This randomness means that each simulation will likely arrive at a different expected outcome, even if the inputs are the same. We saw this in the video by running Monte Carlo simulations with different seeds.

In this exercise, assume 8.6% inflation in 2022 and a stochastic increase of 1%, 2%, or 3% each year over the previous year (with equal probabilities of 1%, 2%, or 3%) for the following years. What will the inflation rate look like in 2050 under these assumptions?

The random package has already been imported for you as random.

Instructions 1/2

undefined XP
    1
    2
  • Use random.randint() to generate a random integer that represents the three possibilities for the yearly_increase in inflation each year: 1, 2, or 3 percent.