File Exchange

image thumbnail

Inflation Adjust

version 1.0.0.0 (183 KB) by Chad Greene
Calculate the present value using the Bureau of Labor and Statistics' Consumer Price Index.

2 Downloads

Updated 07 Aug 2012

View License

INFLATION_ADJUST calculates the present value (in today's dollars) of purchases from years past using the Consumer Price Index (CPI) from the Bureau of Labor and Statistics (BLS) website. Note: It takes ~30 seconds! Valid only for dates after 1947!

INPUTS:
purchase_prices = the price (scalar or array) paid for an item.
purchase_dates = the date(s) corresponding to purchase price(s) in datenum format.

OUTPUT:
The present value in today's dollars of the purchase.

EXAMPLE 1: You paid $125,000 for a house on Feb. 1, 1992:

inflation_adjust(125000,datenum(1992,2,1))
ans =
206185.06

So that $125k house in 1992 is roughly equivalent to paying $206k today.

EXAMPLE 2: Create the plot at the top of this page, cost of a first-class postage stamp (also provided as an example m-file, inflation_stamp_example.m)

load postage_stamp
post_dates = datenum(postage_stamp(:,1),1,1);
post_rates = postage_stamp(:,2);
adjusted_rate = inflation_adjust(post_rates,post_dates);

figure
rgb = imread('stamp.jpg');
imgh = imagesc([post_dates(1) post_dates(end)],[60 0],(rgb));
set(imgh,'alphadata',0.3); hold on
plot(post_dates,adjusted_rate,'b','linewidth',2)
plot(post_dates,post_rates,'r','linewidth',2)
datetick
xlim([post_dates(1) post_dates(end)])
set(gca,'ydir','normal');
legend('adjusted price in 2012 dollars','unadjusted price','location','southeast')
legend boxoff
box off
title('Price of a First Class Stamp')
xlabel('year')
ylabel('price in cents')

Cite As

Chad Greene (2020). Inflation Adjust (https://www.mathworks.com/matlabcentral/fileexchange/37754-inflation-adjust), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (1)

Arnav Sood

The BLS has changed its link from ftp.bls.gov to download.bls.gov, so we should change that to http://download.bls.gov/pub/time.series/cu/cu.data.1.AllItems

MATLAB Release Compatibility
Created with R2011a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired by: Cost of Gas