Visualizing Economic Indicators Related to Inflation with Graphs
Lately, inflation seems unstoppable! I wonder how high it will go…
Hello, it’s been a while. I’m Hiroki, a data scientist. In this blog post, I will explain:
- ・How to download economic indicators like employment numbers or CPI using Matlab code from FRED
- ・How to compare data with Matlab code
- ・Deeply contemplating Taro Buffett's YouTube videos with data
You can get such graphs.
What is Inflation?
If inflation (the increase in the value of goods and the decrease in the value of money) continues, the U.S. government will reduce the amount of money circulating in the market to increase the value of money by raising long-term interest rates.
This leads to multiple contraction (decrease in PER) and becomes a factor for stock price decline.
On the other hand, if inflation settles down, the U.S. government may not raise interest rates.
This leads to the opposite of multiple contraction, an increase in PER, and becomes a factor for stock price increase.
For details, please watch Taro Buffett’s YouTube channel,which I always refer to.
And, as Taro Buffett says, it’s currently impossible to predict which way it will go, so he advises to “keep a close eye on economic data going forward.”
What are the Economic Indicators Related to Inflation?
The economic indicators related to inflation that appear repeatedly in the videos are as follows: Below are the Japanese names of the economic indicators and their FRED names.
・Number of Employees: All Employees, Total Nonfarm (PAYEMS)
・Unemployment Rate: Unemployment Rate (UNRATE)
・Labor Participation Rate: Labor Force Participation Rate (CIVPART)
・Average Hourly Wage: Average Hourly Earnings of All Employees, Total Private (CES0500000003)
・CPI (Consumer Price Index): Consumer Price Index for All Urban Consumers: All Items in U.S. City Average (CPIAUCSL)
・JOLT (Job Openings and Labor Turnover Survey): Job Openings: Total Nonfarm (JTSJOL)
・Gasoline Prices: US Regular Conventional Gas Price (GASREGCOVW)
In this blog, we will introduce how to obtain these data fromFREDand compare the data by yourself to deeply contemplate the economic indicators.
Matlab Code
For basic operations, please refer tothis past article
This time, I’ll just post the code.
% Input parameters. Specify the name of the time series data you want to retrieve and the start and end dates.
start_date = '9/3/2013'; %mm/dd/yyy beginning of date range for historical data
end_date = '9/3/2023'; %mm/dd/yyy ending of date range for historical data
% Store the economic indicators specified in the series into fredData. (Just copy and paste)
PAYEMS = get_fred_data(start_date, end_date, 'PAYEMS');%雇用者数
UNRATE = get_fred_data(start_date, end_date, 'UNRATE');%失業率
CIVPART = get_fred_data(start_date, end_date, 'CIVPART');%労働参加率
AHAE = get_fred_data(start_date, end_date, 'CES0500000003');%平均時給
CPI = get_fred_data(start_date, end_date, 'CPIAUCSL');%消費者物価指数
JOLT = get_fred_data(start_date, end_date, 'JTSJOL');%米雇用動態調査
GAS = get_fred_data(start_date, end_date, 'GASREGCOVW');%ガソリン価格
% Create graphs.
subplot(7,1,1)
plot(PAYEMS.t,PAYEMS.data1)
ylabel('雇用者数')
subplot(7,1,2)
plot(UNRATE.t,UNRATE.data1)
ylabel('失業率')
subplot(7,1,3)
plot(CIVPART.t,CIVPART.data1)
ylabel('労働参加率')
subplot(7,1,4)
plot(AHAE.t,AHAE.data1)
ylabel('平均時給')
subplot(7,1,5)
plot(CPI.t,CPI.data1)
ylabel('CPI')
subplot(7,1,6)
plot(JOLT.t,JOLT.data1)
ylabel('JOLT')
subplot(7,1,7)
plot(GAS.t,GAS.data1)
ylabel('ガソリン価格')
% This function is to obtain data from the FRED website. (Just copy and paste)
function fredData = get_fred_data(startdate, enddate, series)
url = 'https://fred.stlouisfed.org/';
c = fred(url);
d = fetch(c,series);
d.Data(1:3,:);
format bank
d = fetch(c,series,startdate,enddate);
forex = d.Data(:,2);
maxforex = max(forex);
value = abs(forex-maxforex);
idx = find(value<0.001,1);
date = d.Data(idx,1);
datestr(date);
close(c)
t=datetime(d.Data(:,1),'ConvertFrom','datenum');
data1=d.Data(:,2);
fredData = timetable(t,data1);
end
Subplot is useful for comparing multiple data vertically. It’s easy to see how it has changed before and after COVID-19. Keep an eye on the movement of economic indicators going forward!
That’s all for today. Love & Respect Hiroki