top of page

The History of the U.S. Economy using R Programming

What I would give to shareholders. Scroll down, pass the presentation for step-by-step instructions on how I used six sigma to get to this conclusion.
inflation 1 to 3 today.png
Housing market 1 to 3 today.png
average income 1 to 3.png
correlation today.png

                                                                                 Ask Phase

                                               How well is the U.S. economy doing according to government's standards?

                                                                                          The Objective

   My objective is not to blame anyone for economic outcomes or push an agenda. It is simply to look that data from the U.S. government databases, compare the current data to past data to find a trend (inflation, stagnation, or deflation), and lastly, to find out if this trend is leading up into a positive or negative direction, according to the U.S. government's annual goals. No, these are not all of the factors that determine the economic success of the U.S. economy, but they are pivotal. Deflation is not a goal for any economy because that typically means a weakening economy, according to Can Deflation Be Good? You can get the rare good deflation can occur like higher quantities of goods being served for lower prices do to technological advance, according to Good Deflation vs. Bad Deflation - Quickonomics.

   Also, going too deep into how things like how gas got so high or why food has increase in price will lead to political banter and blaming, which goes against what this study is aiming for. The inspiration for this dataset is the 7.9% inflation rate year to year this March 1st, seen in my U.S. Historical Inflation Rates dataset.

                                                                  Prepare Phase

   I collected the data from three locations and made the data into a csv file so it can be compatible with R. The inflation rate of the datasets will only use the two decimal points maximum. All of the data is from third party datasets. They are: Average Sales Price of Houses Sold for the United States (ASPUS) | FRED | St. Louis Fed and I added an inflation rate year by year column in the excel file before I uploaded it using the percent change formula, (The Average Price of Housing in the US dataset), Individual Income by Year: Average, Median, One Percent, and Calculator, and Historical Inflation Rates: 1914-2022 I added a percent change column to the Average_Individual_Income_By_Year_1962_2021 and Average_sales_of_Houses_in_the_US datasets, so we can have an idea on the inflation rate year by year. To find out the difference year by year (inflation), you do the percent change formula.

How will I determine if the U.S. is on target in all three categories?

   I am assuming that 2% inflation is the goal across the board for the U.S. dollar, housing, and income because the FED said 2% inflation is the goal FRB: What is an acceptable level of inflation? This because the government wouldn't like for the average person to be priced out of the market, if they can control it. Any year under 1% and over 3% will be considered a failing year for this case study.

This is because getting exactly 2% every year is very rare. For example, if you look for any exactly 2% inflation in the month of January for the dataset US_Historical_Inflation_Rates_1914_2022, you will only get 1 year that can match those criteria out of 109 years. This means that America hit the mark of 0.01% (0.009 percent if you don't round).

  1. Is the FED hitting 1-3% inflation year by year, according to first party data from FRB: What is an acceptable level of inflation?

  2. Is the housing market hitting 1-3% year by year? What is the average inflation of housing each January year by year?

  3. Is the average income rising at the same rate or higher than the U.S. inflation and if not, when is the last time we hit it? If not, Americans are losing more and more money each year. This is due to pay not matching U.S. inflation rates. This means that more debt will be accrued as a nation in the forms of personal loans and credit card debt. Be aware that the median income is calculated differently than the average (done the same way you calculate any average), if you choose to look it up on your own.

  4. Is the U.S. Dollar hitting the mark of 1-3% percent inflation? Is the average income rising at the same rate or higher than the U.S. inflation and if not, when is the last time we hit it?

 

 

                                                                   Process Phase

 

   I will install and load packages: tidyverse, readr, dplyr, ggplot2 because these three packages are the standard packages, I use for nearly every project. {r} install.packages("tidyverse") install.packages("readr") install.packages("ggplot2") install.packages("dplyr") {r} library(tidyverse) library(readr) library(ggplot2) library(dplyr) Data Cleaning

U.S. Historical Inflation Dataset

{r} view(US_Historical_Inflation_Rates_1914_2022) Any spot that says "NA" is because that time of the year didn't come yet or data is available on that time when this dataset was made. I can't put 0 because then many looking at the data would believe that there was 0% inflation that month. NA will stay to avoid confusion. No cleaning was needed otherwise for this dataset.

Average Individual Income By Year 1962-2021 Dataset {r} view(Average_Indvidual_Income_By_Year_1962_2021) No cleaning was needed for this dataset.

Average Sale of Houses in The US {r} view(Average_sales_of_Houses_in_Jan) No cleaning was needed for this dataset.

                                                                Analyze Phase

This is the section in which we will see if data is hitting the goals the government has set for itself. My goal is 1-3% increase for everything: inflation, housing, and average individual income. I will also check to see the last time the government has ever hit 1-3% and 2% for each dataset.

Question 1. Analyzing the Average Individual Income

 

 

 

 

 

 

 

 

 

 

 

The code and numbers for the visualization

 

{r} view(filter(Average_Individual_Income_By_Year_1962_2021, PercentChange <3, PercentChange>1)) 15 years out of the available 60 years in the dataset Average_Individual_Income_By_Year_1962-2021 have had an inflation rate of 1-3% which is 25%. These years are: 1966, 1968, 1978, 1979, 1984, 1986, 1988, 1990, 1995, 1997, 2006, 2007, 2014, 2018, and 2019

 

Question 2. When is the last time the housing market hit 1-3% inflation?

 

 

 

I will be judging inflation only for January of every year. I first filter for only percentages between 1-3 Then I only chose the variables that happened on a January to be consistent. This means 59 variables are in January for every year.

The code and numbers for the visualization

{r} view(filter(Average_sales_of_Houses_in_the_US, PercentChangeEveryQuarter <3, PercentChangeEveryQuarter >1))

Out of 59 variables, 11 meet the criteria of 1-3 inflation, which is 19% percent. All of the datapoints are: 1965-01-01, 1969-01-01, 1972-01-01, 1977-01-01, 1979-01-01, 1980-01-01, 1981-01-01, 1983-01-01, 1986-01-01,1989-01-01, 1998-01-01, 2004-01-01, and 2017-01-01. This means that US housing not hitting inflation goals. Provide a graph with points that are highlighted here

Question 3. Is the U.S. Dollar hitting the mark of 1-3% percent inflation?

 

Is the average income rising at the same rate or higher than the U.S. inflation and if not, when is the last time we hit it? For 1-3 inflation in the dataset US_Historical_Inflation_Rates_1914_2022. I will only choose the JAN column to remain consistent across all datasets and to follow the norm.

 

 

 

 

 

 

 

The code and numbers for the visualization

{r} view(filter(US_Historical_Inflation_Rates_1914_2022, JAN <3, JAN >1)) I changed the name of the edited dataset above to FilteredUSInflation because code is too long to write and remember constantly

 

{r} FilteredUSInflation<- filter(US_Historical_Inflation_Rates_1914_2022, JAN <3, JAN>1) Out of 109 available years, only 37 of the available years are between 1914-2022 in JAN column has hit the goals of 1-3% inflation. This is 26%. All the years that are between 1-3% inflation in JAN are: 1914, 1934, 1936, 1937, 1941, 1945, 1946, 1949, 1954, 1959, 1961, 1963, 1964, 1966, 1987, 1992, 1994, 1995, 1996, 1998, 1999, 2000, 2002, 2003, 2004, 2007, 2010, 2011, 2012, 2013, 2014, 2016, 2017, 2018, 2019, 2020, and 2021 Does the inflation rate of the dollar and average income ever match? This is to see if Americans are gaining, losing, or retaining their income year by year.

I had to fuse the US Historical Inflation and Average Individual Income datasets so I can make a line graph with both of them on it. This requires me to use a full_join so I needed to change the column name from "YEAR" to "Year" so I can fuse both datasets without an issue.

{r} After1961USInflation<- rename(AfterUSInflation, 'Year'=YEAR)

Time to fuse the datasets {r} view(full_join(Afterthe1961USInflation, Average_Individual_Income_By_Year_1962_2021, by='Year')) Then I am renaming this new fused dataset to JoinedHistoricalInflationandIncome so I do not have to write the long code above. {r} view(InflationandIncomeFused)

Question 4. Is the U.S. Dollar hitting the mark of 1-3% percent inflation?

 

 

 

 

 

 

 

The code and numbers for the visualization

{r} ggplot(data=InflationandIncomeFused)+geom_line(mapping=aes(x=Year,y= PercentChange), color="red")+geom_point(mapping=aes(x=Year, y=PercentChange), color= "red")+geom_line(mapping=aes(x=Year,y=JAN), color="blue") +geom_point(mapping=aes(x=Year, y=JAN), color="blue")+labs(title="US Historical Inflation (Blue) vs Average Individual Income 1963-2021(Red)") Historical vs Average {r} cor(InflationandIncomeFusedJAN,InflationandIncomeFusedJAN,InflationandIncomeFusedPercentChange) The results are NA or no correlation. This may also correlate with why people are not as eager to work anymore. Many people are losing money year by year working as shown by the graph. When inflation goes up, job wages usually go down.

Share Phase

Explanation of each graph provided

2 screenshot.png
3 screenshot.png
4 screenshot.png
1 screenshot.png
5 Screenshot.png
Act Phase

Historically, it would be through creating more jobs, but we have an influx of jobs right now due to people being underqualified, the jobs not paying a living wage, or many people just unwilling to work. We also got out of financial straits when we went to war like when the U.S. went to war during the Great Depression and we started to produce goods for the army effort.  This is not a political response but simply an observation of history. Has the U.S. been hitting its monetary goals throughout history? All of the data says no.

What you can do in your own life:

Ask for a raise at your job yearly to match inflation minimum. According to process.com 40 percent of people are afraid to ask for a raise.

•Multiple incomes are needed in today’s unstable economic climate. Companies are going out of business everywhere, but your bills are here to stay.

•Spend on investments that historically provided a return on investment and not just luxury goods.

•Have a safety net. According to cnbc.com, the average single person only has $2,729 in their savings account.

inflation 1 to 3 today.png
Housing market 1 to 3 today.png
average income 1 to 3.png
correlation today.png

This is the only data visualization that we could use a line because all of the other data points were so scattered with no trend. There is a clear correlation between inflation and housing. Income increases are common, but inflation is.

bottom of page