0

I have to calculate a total sum of money which is composed of different values that have to be normalized to the present value of money: I have an array of values each value consisting on the amount of that year: values = [50,100,200,300,......450]

So in my case there are 12 values from years 2000-2011 the first value 50 is a value in the year 2000 while the last value in the array is the a value in the year 2011.

How can I calculate the values of these amounts in the year 2018 accounting for inflation?

1

From your question it looks like you are using Python. Using Python and NumPy, and inflation values from here, we can calculate the present values by compounding the inflation rate from each year:

Python/NumPy code:

import numpy as np
# Years from the first year to present (beginning of 2018)
years = np.arange(2000,2018)
# Values from the first year to present (beginning of 2018)
values = np.array([50,100,150,200,250,300,350,400,450,500,550,0,0,0,0,0,0,0])*1.0
# Annual inflation rate, i.e. year-2001 dollars are worth (1-inflation[i]) relative to year-2000 dollars
inflationPercent = np.array([3.4,2.8,1.6,2.3,2.7,3.4,3.2,2.9,3.8,-0.4,1.6,3.2,2.1,1.5,1.6,0.1,1.3,2.1])
inflation = inflationPercent*0.01

# initialize array of present values
values2018 = values
for i in range(len(years)):
    # only values from the current year or earlier get compounded
    values2018[:i] *= (1+inflation[i])
# print final values
print(values2018)

This gives the following output for values2018:

[ 71.18743903 138.49696309 204.47386283 266.50226501 324.36984544
 376.4446949  425.56732304 472.65564131 512.27128754 571.47622439
 618.72425869   0.           0.           0.           0.
   0.           0.           0.        ]
1

If you have an array (or list in Python) values that consists of values for each of the years, and an array CPIs that gives the CPI for each year, then you can divide each value by the corresponding CPIs, then multiply the sum by the 2018 CPI. In Python, that would be

  total = 0
  for i in range(11):
       total = total + values[i]/CPIs[i]
  total = total*CPI_2018

If you have them stored as Panda series, you can just do (values*CPIs).sum()

If you have the inflation rates for each year, you can start with the initial amount, go the next year. Each year, multiply the previous total by the year's inflation and then add the year's value. So for instance, for year 2009, you take the total of all the value prior to 2009, multiply it by the inflation for 2009, then add the value for 2009. Keep in mind that if you have the inflation listed as percent, you have to divide by 100 to account for the percent, and then add one, to account for the fat that it's percentage change. Also, I'm assuming that the value for each year is how much it's worth at the end of that year.

 total = values[0]
 for i in range(1,19):
      try:
          value = values[i]
      except:
           value = 0 # if you've gone past the end of your list of values, take the value as 0
      total = (total)*(1+inflation[i+1]*.01)+value

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.