NYC Data Science Academy| Blog
Bootcamps
Lifetime Job Support Available Financing Available
Bootcamps
Data Science with Machine Learning Flagship ๐Ÿ† Data Analytics Bootcamp Artificial Intelligence Bootcamp New Release ๐ŸŽ‰
Free Lesson
Intro to Data Science New Release ๐ŸŽ‰
Find Inspiration
Find Alumni with Similar Background
Job Outlook
Occupational Outlook Graduate Outcomes Must See ๐Ÿ”ฅ
Alumni
Success Stories Testimonials Alumni Directory Alumni Exclusive Study Program
Courses
View Bundled Courses
Financing Available
Bootcamp Prep Popular ๐Ÿ”ฅ Data Science Mastery Data Science Launchpad with Python View AI Courses Generative AI for Everyone New ๐ŸŽ‰ Generative AI for Finance New ๐ŸŽ‰ Generative AI for Marketing New ๐ŸŽ‰
Bundle Up
Learn More and Save More
Combination of data science courses.
View Data Science Courses
Beginner
Introductory Python
Intermediate
Data Science Python: Data Analysis and Visualization Popular ๐Ÿ”ฅ Data Science R: Data Analysis and Visualization
Advanced
Data Science Python: Machine Learning Popular ๐Ÿ”ฅ Data Science R: Machine Learning Designing and Implementing Production MLOps New ๐ŸŽ‰ Natural Language Processing for Production (NLP) New ๐ŸŽ‰
Find Inspiration
Get Course Recommendation Must Try ๐Ÿ’Ž An Ultimate Guide to Become a Data Scientist
For Companies
For Companies
Corporate Offerings Hiring Partners Candidate Portfolio Hire Our Graduates
Students Work
Students Work
All Posts Capstone Data Visualization Machine Learning Python Projects R Projects
Tutorials
About
About
About Us Accreditation Contact Us Join Us FAQ Webinars Subscription An Ultimate Guide to
Become a Data Scientist
    Login
NYC Data Science Acedemy
Bootcamps
Courses
Students Work
About
Bootcamps
Bootcamps
Data Science with Machine Learning Flagship
Data Analytics Bootcamp
Artificial Intelligence Bootcamp New Release ๐ŸŽ‰
Free Lessons
Intro to Data Science New Release ๐ŸŽ‰
Find Inspiration
Find Alumni with Similar Background
Job Outlook
Occupational Outlook
Graduate Outcomes Must See ๐Ÿ”ฅ
Alumni
Success Stories
Testimonials
Alumni Directory
Alumni Exclusive Study Program
Courses
Bundles
financing available
View All Bundles
Bootcamp Prep
Data Science Mastery
Data Science Launchpad with Python NEW!
View AI Courses
Generative AI for Everyone
Generative AI for Finance
Generative AI for Marketing
View Data Science Courses
View All Professional Development Courses
Beginner
Introductory Python
Intermediate
Python: Data Analysis and Visualization
R: Data Analysis and Visualization
Advanced
Python: Machine Learning
R: Machine Learning
Designing and Implementing Production MLOps
Natural Language Processing for Production (NLP)
For Companies
Corporate Offerings
Hiring Partners
Candidate Portfolio
Hire Our Graduates
Students Work
All Posts
Capstone
Data Visualization
Machine Learning
Python Projects
R Projects
About
Accreditation
About Us
Contact Us
Join Us
FAQ
Webinars
Subscription
An Ultimate Guide to Become a Data Scientist
Tutorials
Data Analytics
  • Learn Pandas
  • Learn NumPy
  • Learn SciPy
  • Learn Matplotlib
Machine Learning
  • Boosting
  • Random Forest
  • Linear Regression
  • Decision Tree
  • PCA
Interview by Companies
  • JPMC
  • Google
  • Facebook
Artificial Intelligence
  • Learn Generative AI
  • Learn ChatGPT-3.5
  • Learn ChatGPT-4
  • Learn Google Bard
Coding
  • Learn Python
  • Learn SQL
  • Learn MySQL
  • Learn NoSQL
  • Learn PySpark
  • Learn PyTorch
Interview Questions
  • Python Hard
  • R Easy
  • R Hard
  • SQL Easy
  • SQL Hard
  • Python Easy
Data Science Blog > Python > Data Analysis on The Effect of Inflation on Primary Assets

Data Analysis on The Effect of Inflation on Primary Assets

Jonah Gerstel
Posted on Sep 10, 2021
The skills I demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.

Background

What is inflation?

Inflation is the decline of purchasing power of a given currency over time. A quantitative data estimate of the rate at which the decline in purchasing power occurs can be reflected in the increase of an average price level of a basket of selected goods and services in an economy over some period of time. The rise in the general level of prices, often expressed as a percentage, means that a unit of currency effectively buys less than it did in prior periods.

Key Measures of Inflation

There are numerous ways to calculate inflation including:

  • CPI (Consumer Price Index)
  • US M2 (United States Money Supply)
  • PCE (Personal Consumption Expenditures)
  • Wage Inflation
  • RPI (Retail Price Index)

For this project, the focus was on CPI and US M2.

CPI was chosen as it is the most popular measure of inflation.

US M2 was chosen due to the extremely drastic changes seen in the US M2 due to the various stimulus checks and other government subsidized help to consumers and businesses in recent months.

CPI: Consumer Price Index

The Consumer Price Index (CPI) is a measure that examines the weighted average of prices of a basket of consumer goods and services, such as transportation, food, and medical care. It is calculated by taking price changes for each item in the predetermined basket of goods and averaging them. Changes in the CPI are used to assess price changes associated with the cost of living.

The CPI is one of the most frequently used statistics for identifying periods of inflation or deflation.

US M2: United States Money Supply

M2 is a calculation of the money supply that includes all elements of M1 as well as "near money." M1 includes cash and checking deposits, while near money refers to savings deposits, money market securities, mutual funds, and other time deposits. These assets are less liquid than M1 and not as suitable as exchange mediums, but they can be quickly converted into cash or checking deposits.

Hedging Inflation

As of June 2021, the nation saw both its largest monthly and year-over-year increase in inflation (CPI) in the last 13 years.

In 2020, the US printed 24% of the all the money in circulation prior to 2020 (US M2).

Due to these drastic changes in these inflation markers, it is important for investors to understand what assets have performed well during these times in the past, both recently and historically.

This project will focus in on three primary assets, Gold, Bitcoin, and the S&P 500, and how they have performed in times of drastic changes in CPI and M2.

Datasets & Methodology

Datasets Used:

  • Monthly CPI since 1980
  • Weekly M2 since 2013
  • Daily Gold Prices since 1980
  • Daily BTC Prices since 2013
  • Daily S&P 500 Prices since 2013

Note: In an ideal world, more frequently sampled CPI and M2 data would have been used to create more data points, and provide a clearer picture on how Gold, BTC, and the S&P 500 change with inflation. Additionally, S&P 500 data prior to 2013 would have been used. However, due to data availability, and financial restraints, this was not possible.

Methodology

All datasets were cleaned and manipulated to allow for seamless aggregation of the datasets

Calculated % Change of US M2 and CPI

Categorized US M2 and CPI periodic changes into 'High', 'Normal', and 'Low' periods of change based on the mean and standard deviations of the datasets

Calculated % Change of Gold, BTC, and the S&P 500 over given US M2 and CPI timeframes

Created series for Gold, BTC, and the S&P 500 % changes based on categorical change variables for US M2 and CPI

Compared and hypothesis tested various series created for Gold, BTC, and the S&P 500 in order to understand:

  • How these assets perform during 'High', 'Normal', and 'Low' changes in US M2 and CPI
  • If there is statistical significance to changes in asset performance based on changes in US M2 and CPI (p-value < 0.10)

Note: The Mann-Whitney U Hypothesis Test was used for this analysis as it is better for smaller, non-normally distributed datasets.

CPI Exploration and Data Analysis

Data on The Historical Effect of Drastic Changes in CPI on Gold

Over the last 40 years, CPI has shown a consistent, linear rise (Figure 1A). Additionally, we see a very clean, normal distribution for CPI's monthly rate of change (Figure 1B).

Figure 1A: CPI Trend since 1980

Data Analysis on The Effect of Inflation on Primary Assets

Figure 1B: Histogram of Monthly CPI Change since 1980

 

Using CPI's monthly rate of change, its mean (0.249%), and its standard deviation (0.340%), ranges were created to categorize 'High', 'Normal', and 'Low' changes in CPI.

  • 'High' category consisted of any month showing a change of more than 2 standard deviations above the mean
  • 'Low' category consisted of any month showing a change of less than 2 standard deviations above the mean
  • 'Normal' category encompassed all remaining data points

Due to the small sample sizes for BTC and the S&P 500 at 'High' and 'Low' CPI changes, this portion of the project will focus solely on Gold.

Data on Gold's Rate of Change

For 'Normal' CPI changes, Gold's rate of change shows a fairly normal distribution. However, for both 'Low' and 'High' CPI changes, Gold's rate of change does not show a clean, normal distribution (Figure 2). The means for 'High', 'Normal', and 'Low' CPI changes were calculated to be -2.49%, 0.43%, and -0.28%, respectively (Figure 3).

Data Analysis on The Effect of Inflation on Primary Assets

Figure 2: Histograms of Monthly Gold Change by CPI Change Categories

Figure 3: Mean Gold Monthly Change by CPI Change Categories

 

Although there is a difference in means across all three series, only changes in Gold at 'High' and 'Normal' changes in CPI show a statistically significant difference (p-value = 0.09) (Figure 4).

Figure 4: P-Values for Gold Monthly Changes for CPI Change Categories

This data suggests that contrary to popular belief, Gold has not been a good hedge against CPI inflation over the last 40 years. When monthly CPI has shown a drastic increase (< 0.93%), Gold's value has shown to decrease by an average of 2.49% compared to its normal average increase of 0.43%.

In other words, during months of high inflation, Gold has decreased both in totality and versus its normal monthly change.

Data on The Current Effect of Significant Changes in CPI on Gold, BTC, and the S&P 500

Since 2013, CPI has shown a consistent, linear rise (Figure 5A). Additionally, we continue to see a fairly normal distribution for CPI's monthly rate of change (Figure 5B). However, the CPI trend is noisier and the rate of change distribution is not quite as clean as seen over the last 40 years.

Figure 5A: CPI Trend since 2013

Figure 5B: Histogram of Monthly CPI Change since 2013

 

The same methodology for the 40 year review was repeated in order to categorize 'High', 'Normal', and 'Low' changes in CPI. The only difference here was that one standard deviation above and below the mean were used for the 'High' and 'Low' CPI change categories. This allowed for more data points to be placed in the 'High' and 'Low' CPI change categories for all assets.

Once again, most of the change distributions by asset and CPI change category reflect a non-normal distribution (Figures 6A-C). For Gold, the means for 'High', 'Normal', and 'Low' CPI changes were calculated to be 0.30%, 0.23%, and -0.02%, respectively. For BTC, the means for 'High', 'Normal', and 'Low' CPI changes were calculated to be 14.11%, 13.36%, and 0.92%, respectively. Finally, for the S&P 500, the means for 'High', 'Normal', and 'Low' CPI changes were calculated to be 2.16%, 1.37%, and -1.22%, respectively (Figure 7).

Figure 6A: Histograms of Monthly Gold Change by CPI Change Categories

Figure 6B: Histograms of Monthly BTC Change by CPI Change Categories

Figure 6C: Histograms of Monthly SP500 Change by CPI Change Categories

Figure 7: Mean Asset Monthly Change by CPI Change Categories

Analysis

After hypothesis testing these datasets (Figure 8):

  • Gold - no statistical significance between datasets
  • BTC - statistical significance between 'Low' and 'Normal' datasets (p-value = 0.100)
  • S&P 500 - statistical significance between both 'Low' and 'Normal' (p-value = 0.041) and 'Normal' and 'High' datasets (p-value = 0.049)

Figure 8: P-Values for Asset Monthly Changes for CPI Change Categories

This data suggests that, since 2013:

When monthly CPI has shown a drastic increase (> 0.47%):

  • The S&P 500's value has shown to increase by an average of 2.16% compared to its normal average increase of 1.37%

When monthly CPI has shown a drastic decrease (< -0.15%):

  • The S&P 500's value has shown to decrease by an average of 1.22% compared to its normal average increase of 1.37%.
  • BTC's value has shown to increase by an average of 0.92% compared to its normal average increase of 13.36%.

In other words, during high months of inflation, the S&P 500 has performed very well, with a monthly change nearly double compared to normal months. During low months of inflation, the S&P 500 has not performed well, decreasing in totality and versus its normal monthly change, while BTC has still shown gains, but extremely modest when compared with its normal monthly change.

US M2 Exploration and Data Analysis

Data on The Effect of Significant Changes in US M2 on Gold, BTC, and the S&P 500

Since 2013, US M2 has shown a more parabolic rise (Figure 9A). Additionally, we see a fairly normal distribution for M2's weekly rate of change with a slight skew to the right (Figure 9B).

Figure 9A: M2 Trend since 1980

Figure 9B: Histogram of Weekly M2 Change since 1980

 

The same methodology for categorizing 'High', 'Normal', and 'Low' in CPI changes were used for the US M2. One standard deviation above and below the mean were used for the 'High' and 'Low' CPI change categories.

As with CPI, most of the change distributions by asset and M2 change category reflect a non-normal distribution (Figures 10A-C). For Gold, the means for 'High', 'Normal', and 'Low' CPI changes were calculated to be 0.22%, 0.09%, and -0.16%, respectively. For BTC, the means for 'High', 'Normal', and 'Low' CPI changes were calculated to be 3.13%, 1.71%, and 3.85%, respectively. Finally, for the S&P 500, the means for 'High', 'Normal', and 'Low' CPI changes were calculated to be 0.17%, 0.26%, and 0.12%, respectively (Figure 11).

Figure 10A: Histograms of Weekly Gold Change by M2 Change Categories

Figure 10B: Histograms of Weekly BTC Change by M2 Change Categories

Figure 10C: Histograms of Weekly SP500 Change by M2 Change Categories

Figure 11: Mean Asset Weekly Change by M2 Change Categories

 

Data Analysis

After hypothesis testing these datasets (Figure 12):

  • Gold - statistical significance between 'Low' and 'Normal' datasets (p-value = 0.095)
  • BTC - no statistical significance between datasets
  • S&P 500 - no statistical significance between datasets

Figure 12: P-Values for Asset Weekly Changes for M2 Change Categories

 

This data suggests that, since 2013 when weekly M2 has shown a drastic decrease (< -0.11%%) Gold's value has shown to decrease by an average of 0.16% compared to its normal average increase of 0.09%.

In other words, during months of low inflation, Gold has decreased both in totality and versus its normal monthly change.

Conclusions

  • Gold has performed poorly over the last 40 years at both 'High' changes in CPI and 'Low' changes in M2
  • The S&P 500 has performed well since 2013 at 'High' changes in CPI and poorly during 'Low' changes in CPI
  • BTC shows little statistically significant behavior due to changes in inflation markers besides showing minimal returns during 'Low' changes in CPI compared its normal monthly returns

Future Work to be Explored

  • Find datasets for CPI and M2 with more frequent sampling
  • Adjust 'High' and 'Low' parameters for CPI and M2
  • Apply analysis to ETH
  • Look at global markets and inflation
  • Use weakening dollar vs other currencies as a proxy for inflation
  • Categorize periods of high inflation to understand if the specific causes result in different responses in Gold/BTC/S&P 500 prices
  • Correct for the effects of social media on BTC

Additional Sources

 

Guide to Inflation

Consumer Price Index (CPI)

M2

About Author

Jonah Gerstel

Jonah graduated Tulane University in 2017 with a B.S. in Chemical Engineering. He then went on to work in the CPG and Food and Beverage Industries as a Process Engineer, gaining his Lean Six Sigma Green Belt. He...
View all posts by Jonah Gerstel >

Related Articles

Capstone
Catching Fraud in the Healthcare System
Capstone
The Convenience Factor: How Grocery Stores Impact Property Values
Capstone
Acquisition Due Dilligence Automation for Smaller Firms
Machine Learning
Pandemic Effects on the Ames Housing Market and Lifestyle
Machine Learning
The Ames Data Set: Sales Price Tackled With Diverse Models

Leave a Comment

No comments found.

View Posts by Categories

All Posts 2399 posts
AI 7 posts
AI Agent 2 posts
AI-based hotel recommendation 1 posts
AIForGood 1 posts
Alumni 60 posts
Animated Maps 1 posts
APIs 41 posts
Artificial Intelligence 2 posts
Artificial Intelligence 2 posts
AWS 13 posts
Banking 1 posts
Big Data 50 posts
Branch Analysis 1 posts
Capstone 206 posts
Career Education 7 posts
CLIP 1 posts
Community 72 posts
Congestion Zone 1 posts
Content Recommendation 1 posts
Cosine SImilarity 1 posts
Data Analysis 5 posts
Data Engineering 1 posts
Data Engineering 3 posts
Data Science 7 posts
Data Science News and Sharing 73 posts
Data Visualization 324 posts
Events 5 posts
Featured 37 posts
Function calling 1 posts
FutureTech 1 posts
Generative AI 5 posts
Hadoop 13 posts
Image Classification 1 posts
Innovation 2 posts
Kmeans Cluster 1 posts
LLM 6 posts
Machine Learning 364 posts
Marketing 1 posts
Meetup 144 posts
MLOPs 1 posts
Model Deployment 1 posts
Nagamas69 1 posts
NLP 1 posts
OpenAI 5 posts
OpenNYC Data 1 posts
pySpark 1 posts
Python 16 posts
Python 458 posts
Python data analysis 4 posts
Python Shiny 2 posts
R 404 posts
R Data Analysis 1 posts
R Shiny 560 posts
R Visualization 445 posts
RAG 1 posts
RoBERTa 1 posts
semantic rearch 2 posts
Spark 17 posts
SQL 1 posts
Streamlit 2 posts
Student Works 1687 posts
Tableau 12 posts
TensorFlow 3 posts
Traffic 1 posts
User Preference Modeling 1 posts
Vector database 2 posts
Web Scraping 483 posts
wukong138 1 posts

Our Recent Popular Posts

AI 4 AI: ChatGPT Unifies My Blog Posts
by Vinod Chugani
Dec 18, 2022
Meet Your Machine Learning Mentors: Kyle Gallatin
by Vivian Zhang
Nov 4, 2020
NICU Admissions and CCHD: Predicting Based on Data Analysis
by Paul Lee, Aron Berke, Bee Kim, Bettina Meier and Ira Villar
Jan 7, 2020

View Posts by Tags

#python #trainwithnycdsa 2019 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day ChatGPT citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay football gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income industry Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI

NYC Data Science Academy

NYC Data Science Academy teaches data science, trains companies and their employees to better profit from data, excels at big data project consulting, and connects trained Data Scientists to our industry.

NYC Data Science Academy is licensed by New York State Education Department.

Get detailed curriculum information about our
amazing bootcamp!

Please enter a valid email address
Sign up completed. Thank you!

Offerings

  • HOME
  • DATA SCIENCE BOOTCAMP
  • ONLINE DATA SCIENCE BOOTCAMP
  • Professional Development Courses
  • CORPORATE OFFERINGS
  • HIRING PARTNERS
  • About

  • About Us
  • Alumni
  • Blog
  • FAQ
  • Contact Us
  • Refund Policy
  • Join Us
  • SOCIAL MEDIA

    ยฉ 2025 NYC Data Science Academy
    All rights reserved. | Site Map
    Privacy Policy | Terms of Service
    Bootcamp Application