This data analysis portfolio piece will present a preliminary data investigation, showing how a typical data exploration starts from initial data collection to identifying preliminary trends and discussing them. In this analysis, we pull information from U.S. Bureau of Labor Statistics (BLS) databases that includes economic statistics on inflation, prices, unemployment, and pay & benefits. Specifically, in this piece, we explore the change in the Consumer Price Index (CPI) over the years and initialize an investigation into interesting trends that occur around the COVID-19 pandemic.
Our data source is the U.S. Inflation and Unemployment dataset from the U.S. Bureau of Labor Statistics.
These data were accessed via BigQuery public datasets using R-Studio.
“The Consumer Price Index (CPI) is a measure of the average change over time in the prices paid by urban consumers for a market basket of consumer goods and services.” (From the BLS).
Below, the diagram presents the monthly Chained CPI for All Urban Consumers (C-CPI-U) value over time, from December 1999 to December 2021. “The Chained Consumer Price Index for All Urban Consumers (C-CPI-U) is a monthly measure of the average change over time in the prices paid by urban consumers for a market basket of consumer goods and services. The C-CPI-U employs a formula that reflects the effect of substitution that consumers make across item categories in response to changes in relative prices. Index data are available for the U.S. City Average (or national average) only. Indexes are available for the all items index and for selected major subcomponents and aggregates” (From the BLS). Thus, the C-CPI-U avoids overestimating the influence of inflation on consumers compared to the CPI-U in general.
Upon initial investigation, we notice a possible significant change in the C-CPI-U trend at around May, 2020 (Indicated by the red vertical dotted line in the diagram) brought about by the COVID-19 pandemic. Prior to May 2020, we see periodic trends in the C-CPI-U where it is above or below the average C-CPI-U value, but the overall rate of change of the C-CPI-U was relatively stable, on average. After May 2020, however, we can eyeball a seemingly significant increase to this previously stable C-CPI-U rate of change. We will save a time series investigation for a later portfolio piece, in which we will attempt to decompose this observed C-CPI-U curve into its trend, seasonal, and random components. For our preliminary analysis, we will focus on investigating the the average trends.
To investigate the effect of COVID-19 on the rate of change of the C-CPI-U, we fit a linear regression with a spline at the identified inflection point of May 2020. This linear fit is represented by a solid blue line on the diagram above. Prior to May 2020, the average rate of change of the C-CPI-U (with standard error) was around 2.1044 (± 0.0025) CPI points per year. After May 2020, this rate of change increased to around 4.6865 (± 0.0023) CPI points per year. This is a 122.7% increase in the rate of change of the C-CPI-U, indicating that after the start of the COVID-19 pandemic in the U.S., the rate of inflation change elevated greatly. Comparing these two slopes via Cohen’s d effect size calculation, we get an effect size of approximately d = 1.5100. In general, a Cohen’s d value greater than 0.8 is considered large; thus, a value of >1 indicates a relatively acute change in how quickly inflation has been rising in the United States around the start of the COVID-19 pandemic.
The BLS database also provides the same C-CPI-U information broken down by product type. Let’s explore the data, look for interesting trends, and focus on one or two aspects for initial investigation.
Due to the large number of categories and only so many colors available to use, we add a grey background to increase the contrast for our plotted lines. Though this diagram is quite busy, we can get important information at a glance and then focus on some interesting aspects. We see some product categories out of the 27 total experienced price deflation, indicated by the curve staying below the CPI = 100 line. We also see that the acute effect of COVID-19 seen for “All items” in not seen in all product categories. To get a better look at the possible effects of the COVID-19 pandemic, Let’s focus in on an area centered around May 2020, ranging from October 2018 to December 2021.
This diagram is still quite busy, and it is not easy to pick out each trend, even with the grey background added to provide better color contrast. Thus, let us make individual C-CPI-U diagrams for each Product Category, fitting a linear regression with a spline at the identified inflection point of May 2020 to help evaluate the effect of the COVID-19 pandemic. We utilize loops here to make all 27 plots in short time.
Let us also visualize the effect of the COVID-19 pandemic by extending the linear regression prior to May 2020 represented in the plots below as a dashed blue line and calculating the angle between the linear regression before and the linear regression after the inflection point. This will give us a measure of the degree to which the rate of change of the C-CPI-U was effected by the COVID-19 pandemic within each Product Category. We will call this the “Deflection Angle.”
You can skip down to the Discussion Section to read about the initial impressions of the differential effects of the COVID-19 pandemic on C-CPI-U by clicking here.
Click a Product Category below to jump to that plot, or scroll down to puruse them all. NOTE: The deflection angle given may not match the angle estimated by eye visually on the presented graphs due to the difficulty of maintaining the same axes scales for each graph.
Household furnishings and operations
Slope Before = 0.16 CPI/Month; Slope After = 0.29 CPI/Month; Deflection Angle = 7.07 deg;
Click here to return to graph selection list.
Slope Before = -0.42 CPI/Month; Slope After = 0.11 CPI/Month; Deflection Angle = 29.3 deg;
Click here to return to graph selection list.
Slope Before = -0.15 CPI/Month; Slope After = 0.79 CPI/Month; Deflection Angle = 46.59 deg;
Click here to return to graph selection list.
Slope Before = -0.1 CPI/Month; Slope After = 0.02 CPI/Month; Deflection Angle = 7.18 deg;
Click here to return to graph selection list.
Slope Before = -0.17 CPI/Month; Slope After = 0.68 CPI/Month; Deflection Angle = 43.66 deg;
Click here to return to graph selection list.
Slope Before = 0.43 CPI/Month; Slope After = 0.33 CPI/Month; Deflection Angle = -4.6 deg;
Click here to return to graph selection list.
Slope Before = -0.03 CPI/Month; Slope After = 0.09 CPI/Month; Deflection Angle = 6.48 deg;
Click here to return to graph selection list.
Slope Before = -1.38 CPI/Month; Slope After = 2.87 CPI/Month; Deflection Angle = 124.86 deg;
Click here to return to graph selection list.
Slope Before = 0.35 CPI/Month; Slope After = 0.55 CPI/Month; Deflection Angle = 9.58 deg;
Click here to return to graph selection list.
Slope Before = 0.34 CPI/Month; Slope After = 0.53 CPI/Month; Deflection Angle = 9.38 deg;
Click here to return to graph selection list.
Slope Before = 0.24 CPI/Month; Slope After = 0.47 CPI/Month; Deflection Angle = 11.63 deg;
Click here to return to graph selection list.
Slope Before = 0.46 CPI/Month; Slope After = 0.73 CPI/Month; Deflection Angle = 11.26 deg;
Click here to return to graph selection list.
Slope Before = -0.13 CPI/Month; Slope After = 1.06 CPI/Month; Deflection Angle = 53.8 deg;
Click here to return to graph selection list.
Slope Before = 0.06 CPI/Month; Slope After = 0.33 CPI/Month; Deflection Angle = 14.98 deg;
Click here to return to graph selection list.
Slope Before = 0.25 CPI/Month; Slope After = 0.46 CPI/Month; Deflection Angle = 10.7 deg;
Click here to return to graph selection list.
Slope Before = 0.59 CPI/Month; Slope After = 0.19 CPI/Month; Deflection Angle = -20.04 deg;
Click here to return to graph selection list.
Slope Before = 0.01 CPI/Month; Slope After = -0.21 CPI/Month; Deflection Angle = -12.81 deg;
Click here to return to graph selection list.
Slope Before = 0.77 CPI/Month; Slope After = 0.31 CPI/Month; Deflection Angle = -20.35 deg;
Click here to return to graph selection list.
Slope Before = -0.09 CPI/Month; Slope After = 0.59 CPI/Month; Deflection Angle = 35.66 deg;
Click here to return to graph selection list.
Slope Before = -0.13 CPI/Month; Slope After = 0.78 CPI/Month; Deflection Angle = 45.07 deg;
Click here to return to graph selection list.
Slope Before = 0.29 CPI/Month; Slope After = 0.41 CPI/Month; Deflection Angle = 6.36 deg;
Click here to return to graph selection list.
Slope Before = -0.68 CPI/Month; Slope After = 1.84 CPI/Month; Deflection Angle = 95.62 deg;
Click here to return to graph selection list.
Slope Before = -0.87 CPI/Month; Slope After = -0.1 CPI/Month; Deflection Angle = 35.14 deg;
Click here to return to graph selection list.
Slope Before = 0.04 CPI/Month; Slope After = 0.26 CPI/Month; Deflection Angle = 12.2 deg;
Click here to return to graph selection list.
Slope Before = 0.26 CPI/Month; Slope After = 0.43 CPI/Month; Deflection Angle = 8.57 deg;
Click here to return to graph selection list.
Slope Before = 0.35 CPI/Month; Slope After = 0.41 CPI/Month; Deflection Angle = 3.05 deg;
Click here to return to graph selection list.
Slope Before = -0.68 CPI/Month; Slope After = 1.66 CPI/Month; Deflection Angle = 92.95 deg;
Click here to return to graph selection list.
Below, we have an interactive table that lists, by default, the Product Categories in order of decreasing deflection angle. You can reorder the table by clicking on the column headers. You can also use the search bar to find desired information in the table.
A larger magnitude deflection angle indicates a larger effect on the rate of change of the C-CPI-U due to the COVID-19 pandemic. A positive deflection angle indicates that the rate of change of the C-CPI-U for that product category increased, and a negative deflection angle indicates that the rate of change of the C-CPI-U for that product category decreased.
We see a majority of the Product Categories (23 out of 27) experienced an increase in the rate of change of the C-CPI-U due to COVID-19, with four (4) Product Categories showing a decrease in the rate of change of the C-CPI-U due to COVID-19. The cost of Medical care services, Medical care, Medical care commodities, and Education began rising at a rate slower than the trend prior to COVID-19 would yield, with the COVID-19 pandemic have a larger cooling effect on the Medical Product Categories compared to Education (deflection angles of -20.4, -20.0, & -12.8 degrees compared to -4.6 degrees) . Further investigation is need to make a definitive conclusion, but my initial hypothesis is that the massive increase in the demand and supply of medical services that accompanied the COVID-19 pandemic drove down the rate of increase in the prices of Medical products and services.
The Product Category with the largest deflection angle of 124.8 degrees is Energy. With an already erratic trend, it is hard to predict Energy C-CPI-U trends based solely on the Energy C-CPI-U values themselves; however, we do see that, for the period of times investigated, COVID-19 had the largest relative effect on Energy, with the Energy Product Category possessing the largest estimated slope after the start of the COVID-19 pandemic (2.9 CPI/Month). The Categories with the next largest increase in the rate of change of C-CPI-U after COVID-19 was by far Private Transportation and Transportation, with deflection angles of 95.6 and 93.0 degrees, respectively. Further investigation is needed, but I hypothesize this effect on Transportation occurred as travel during the COVID-19 pandemic was servery restricted, causing what little travel to occur to become more expensive in order to maintain revenue streams at desired levels.
Overall, we indeed see the effects of COVID-19 were not universal across the different Product Categories, and the effects of the COVID-19 pandemic for any particular Category can be further investigated if curiosity remains.
In a future portfolio piece, I will delve into a time series analysis of the C-CPI-U data, breaking the data down into its seasonal and average components. This will help us tease apart the periodic fluctuations from the overall trend, allowing us to possibly make more informed assessments about the C-CPI-U and how it changes overtime.