The goal of this project is to evaluate the trends in new and used car sales to understand the influence of world events on the number of units sold and the total dollar amount.
I hypothesize that there will be a decrease in the number of units sold and the total value during the years of 2008-2009 due to the financial crisis as well as a decline in sales in the spring of 2020 due to the COVID-19 pandemic.
Since the year of 2002, Maryland car sales have been recorded in terms of units and dollar values for both the new and used categories. The values are recorded on a monthly basis. I want to model the sales by unit and dollar amount for both the new and used categories to see how they are affected over time by world events, as well as to see the differences in the sale of new cars versus used cars per month.
Data were downloaded from https://opendata.maryland.gov/resource/un65-7ipd.json on 01 August, 2020.
I used the data for the total units sold and the dollar amounts for both the new and used categories. I created a data frame which will update from the website. Character objects were converted to numeric and months of each year - to categories for plotting.
Monthly units sold and total value amounts were plotted using line plots generated by the ggplot package. Each year was shown as a separate trend-line with 2008, 2009 and 2020 highlighted to depict the hypothesized changes. To quantify the changes, I calculated percent change between consecutive months. To reveal the change due to COVID-19, the first six months of the years 2018-2020, month to month percent change for units sold and total value are presented. In the table below, positive numbers indicate growth, while negative numbers indicate loss compared to the previous month of the year. January is left as NA to not compare with December of the previous year.
Figures 1 and 2 show the total number of units sold for new and used vehicles. As hypothesized, we observed a sharp decline in units sold for both new and used between the months of March and April in 2020 due to the beginning of shutdowns due to COVID-19.There is a especially large decline in used car sales in this time period, compared to new car sales. This decline is reversed by a comparable increase from May to June 2020.
All other years appear to have consistent trend lines. However, the number of units begin to decline at the end of 2008 with the lowest numbers of new cars sold for almost all of 2009 mirroring the fiscal crisis at the time. The gap between 2008 and 2009 is not as pronounced for the sale of used cars. However, the numbers are still among the lowest.
Figures 3 and 4 show the total dollar amount of sales for new and used vehicles. There is a similar sharp decline in sales for both new and used between the months of March and April in 2020. All other years appear to have consistent trend lines. However, the numbers for the years 2008 and 2009 appear to be the smallest, but they still follow the consistent pattern.
The calculated percent change for the first six months was compared from 2018 to 2020 and is presented in the table below.
There is a consistent decline in February, with a rebound in March for all years. Changes in the month of April are near negligible, except for 2020, when new car sales saw about 40% decline while used car sales saw about 50% decline compared to March. The month of May shows a small increase in sales, and the increase/decrease in June is negligible except for 2020. The month of June sees a near 60% increase in new cars sales, and about 70% increase in used car sales.
| year | month | new | total_sales_new | total_sales_used | used |
|---|---|---|---|---|---|
| 2018 | 1 | NA | NA | NA | NA |
| 2018 | 2 | -25.0 | -27.6 | -10.5 | -1.3 |
| 2018 | 3 | 25.5 | 21.0 | 21.1 | 23.4 |
| 2018 | 4 | -0.7 | 2.0 | -1.0 | -1.8 |
| 2018 | 5 | 15.9 | 6.9 | 3.8 | 2.2 |
| 2018 | 6 | 2.6 | 7.9 | 0.3 | -4.3 |
| 2019 | 1 | NA | NA | NA | NA |
| 2019 | 2 | -30.2 | -32.5 | -16.1 | -10.7 |
| 2019 | 3 | 22.1 | 19.5 | 18.9 | 27.5 |
| 2019 | 4 | 13.4 | 13.0 | 8.6 | 5.1 |
| 2019 | 5 | -2.2 | -3.2 | 1.8 | -1.7 |
| 2019 | 6 | -0.9 | 2.5 | -7.2 | -8.8 |
| 2020 | 1 | NA | NA | NA | NA |
| 2020 | 2 | -19.3 | -23.2 | -9.2 | -4.4 |
| 2020 | 3 | 6.8 | 6.3 | 11.2 | 7.1 |
| 2020 | 4 | -42.6 | -41.9 | -49.2 | -50.1 |
| 2020 | 5 | 8.3 | 4.5 | 8.2 | 27.7 |
| 2020 | 6 | 59.8 | 58.5 | 73.5 | 68.7 |
Figures 5 and 6 are showing percent change for the years 2002-2020 from previous months and January of the current year, respectively. Similar to the table above, positive values indicate an increase and negative values - a loss.
## Warning: Removed 19 row(s) containing missing values (geom_path).
My special thanks to Dr.John Muschelli for his invaluable help with this report.