Search code examples
reconomics

Deflate income data with R


Imagine I have income data (the data can be found below) that I want to deflated according to the RPI.

     id year    income
 1:  1 1993   733.4651
 2:  2 1997  2369.1665
 3:  3 1993  1401.0778
 4:  3 1994  1416.6666
 5:  3 1995  1401.0778
 6:  3 1996  1401.0778
 7:  3 1997  1517.8086
 ....

  year  rpi defl1995
1  1993  555.    0.944
2  1994  568.    0.967
3  1995  588.    1    
4  1996  602.    1.02 
5  1997  621.    1.06 

Compute the reference year with

rpi$defl1995 = rpi$rpi / rpi$rpi[rpi$year == 1995]

then merge

dff = merge(dff, rpi, by = c('year'))

My question is this: You would divide the income data to deflate them? Not multiply, right?

dff$income_delf = dff$income / dff$defl1995

Data

rpi = structure(list(year = c(1993, 1994, 1995, 1996, 1997), rpi = c(555.1, 
568.5, 588.2, 602.4, 621.3), defl1995 = c(0.943726623597416, 
0.966507990479429, 1, 1.02414144848691, 1.05627337640258)), row.names = c(NA, 
-5L), class = "data.frame")

dff = structure(list(id = c(1L, 2L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 
4L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L), year = c(1993L, 1997L, 
1993L, 1994L, 1995L, 1996L, 1997L, 1993L, 1994L, 1995L, 1996L, 
1993L, 1994L, 1995L, 1996L, 1997L, 1993L, 1994L, 1995L, 1996L
), income = c(733.465087890625, 2369.16650390625, 1401.07775878906, 
1416.66662597656, 1401.07775878906, 1401.07775878906, 1517.80859375, 
2393.61059570312, 843.074096679688, 1433.33325195312, 605.4619140625, 
2133.33349609375, 2563.62280273438, 2208.33325195312, 2814.4111328125, 
832.193359375, 1839.87182617188, 12673.6337890625, 0, 855.849792480469
)), row.names = c(NA, -20L), class = "data.frame")

Solution

  • Yes, you would divide the dff$income by dff$defl1995 to get the adjusted income in 1995 dollars.

    You know that inflation is occurring since RPI is increasing in the rpi data set.

    Therefore, since you're adjusting the incomes in terms of 1995 dollars, the same income amount for years before 1995 would have more buying power compared to the same income amount in 1995. Similarly, the same income amount for years after 1995 would have less buying power compared to the same income amount in 1995.

    You can see this occurring for the individual with id 3. They had a constant income of $1401.078 for 1993, 1995, and 1996. However, after you adjusted the incomes, you get $1484.622, $1401.078, and $1368.051, which makes sense.