Google Data Analytics Capstone: Complete a Case Study is the last course in a series of 8 cources that are part of Google Data Analytics Professional Certificate program that I completed online on Coursera in the first half of 2024. For the case study I chose track B, which meant that I have worked on a dataset that I found myself.
Jonas Grave Kristensen, 2024-06-11
The case study is related to analyzing data for passenger cars in Norway. The dataset consists of tables from Statistisk Sentralbyrå in Norway, Statistics Norway (SSB). Specifically I have looked into the following:
Low emission passenger cars are here defined as either battery electric vehicles (BEV) or Plug-in Hybrid Electric Vehicles (PHEV).
Details with respect to the technical aspect of the dataset and the tools use for preparing, processing and analyzing the data, are presented in sections at the end of this document.
Tax exemption and reduction for low emission vehicles cover the following (highlights):
The following figure shows first time registration of passenger vehicles on a monthly basis where the vehicles are categorized by fuel type. The data covers the period of January 2010 until May 2024. The top plot shows absolute registrations in a given month, while the lower plot shows the percentage a given fuel type constitutes of the total monthly registrations. Legend entry Hybrid is equivalent to PHEV's.
Until October 2013 the absolute number of registrations of fossil fuel vehicles are stable around 13,000. However, from that point purchases of fossil fuel vehicles are declining and as of May 2024 is just around 5%. BEV's and PHEV's pick up more and more momentum in the end of 2013 and in 2014. PHEV's do reach a plateau around 5000-6000 monthly registrations with a peak share of 35% in the beginning of 2021. However, from this point the reduction in tax exemption in weight clearly becomes a price element potential buyers consider. As of May 2024 PHEV's are 18% of first time registrations. BEV's have just increased in share with a maximum of 91%. The huge peak of registrations of BEV's in December 2022 is due to VAT being introduced from 1st January 2023.
The data clearly shows how adjustments to taxes can change behavior towards BEV's.
Statistics Norway (SSB) has a table, number 13931, where green house gas emissions (GHG) from among other road traffic has been estimated. Calculated values carried out by SSB: "The table contains CO2 equivalents (GWP-values) according to AR5, the IPCCs Fifth Assessment Report, which are used in the Paris Agreement." (footnote to table query). The figure below, Yearly emissions from road traffic, 2010-2023, shows emssions from road traffic as a total and the individual sources, eg. passenger cars, light duty vehicles, etc. No data present yet for 2023 for the individual sources, which is why those data points are missing in the figure. It is only the vehicle category passenger cars that shows a decreasing trend in emissions which begins around 2017. In order to access whether it is a true decline in emissions due to low-emission vehicles one also needs to look at the distance covered by passenger cars.
The figure below, Yearly distance, passenger cars by fuel type, 2010-2023, shows yearly distance in km covered by passenger cars in total (red) and split by fuel type (here Electricity is BEV's). Since 2016 total covered distance has been relative stable at around 35,000 million km per year. Petrol (gasoline) fueled vehicles has only seen a decline, while diesel has been slightly constant from 2016 to 2019, from where on these vehicles also starts to decline in distance covered as BEV's share starts to become more pronounced. Diesel cars usually got a better fuel economy than petrol, hence when petrol cars share go down, then it will also have an impact on the emissions.
Conclusion is that BEV's started to have an impact on emissions from passenger cars from around 2019-2020.
The dataset consists of the following tables from Statistisk Sentralbyrå in Norway, Statistics Norway.
All data for each table was downloaded as of 2024-06-10 in order to have static data for reproducibility. The files are in JSON stat2 format and the file names of the tables are of the format: [table_no]_[date]-[time_stamp].json
. Data can also be obtained by API request queries which are detailed further down in the document.
All preparing, processing and analyzing of the dataset was carried out in R. Used rjstat
to read JSON stat2 format files, which returns the data as tibble dataframes. Processing the data covered converting (mutate
) character columns to integers, create date columns (lubridate
package), calculations on group_by
variables, merging dataframes, and filter data for proper visualization. Used ggplot2
to create figures and analyzing trends.
I have chosen to share, communicate, this case study on GitHub as a web document. It gives the benefit of having this document and all data plus script files in one location. I authored the web document in Sublime Text. For proper styling of the figures I used Plotly package ggplotly
in R and in order to get HTML output from R I used htmlwidgets
package. R script, data files and HTML document located in repository on GitHub.
URL: https://data.ssb.no/api/v0/en/table/13931/
JSON query:
{ "query": [ { "code": "UtslpTilLuft", "selection": { "filter": "vs:UtslpKildeA01", "values": [ "5" ] } }, { "code": "ContentsCode", "selection": { "filter": "item", "values": [ "UtslippCO2ekvival" ] } }, { "code": "Tid", "selection": { "filter": "item", "values": [ "2010", "2011", "2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020", "2021", "2022", "2023" ] } } ], "response": { "format": "json-stat2" } }
URL: https://data.ssb.no/api/v0/en/table/13931/
JSON query:
{ "query": [ { "code": "UtslpTilLuft", "selection": { "filter": "vs:UtslpKildeA02", "values": [ "5.1", "5.2", "5.3", "5.4" ] } }, { "code": "ContentsCode", "selection": { "filter": "item", "values": [ "UtslippCO2ekvival" ] } }, { "code": "Tid", "selection": { "filter": "item", "values": [ "2010", "2011", "2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020", "2021", "2022", "2023" ] } } ], "response": { "format": "json-stat2" } }
URL: https://data.ssb.no/api/v0/en/table/14020/
JSON query:
{ "query": [ { "code": "TypeRegistrering", "selection": { "filter": "item", "values": [ "N" ] } }, { "code": "DrivstoffType", "selection": { "filter": "item", "values": [ "19", "20", "21", "6" ] } }, { "code": "ContentsCode", "selection": { "filter": "item", "values": [ "Personbiler" ] } }, { "code": "Tid", "selection": { "filter": "item", "values": [ "2010M01", "2010M02", "2010M03", "2010M04", "2010M05", "2010M06", "2010M07", "2010M08", "2010M09", "2010M10", "2010M11", "2010M12", "2011M01", "2011M02", "2011M03", "2011M04", "2011M05", "2011M06", "2011M07", "2011M08", "2011M09", "2011M10", "2011M11", "2011M12", "2012M01", "2012M02", "2012M03", "2012M04", "2012M05", "2012M06", "2012M07", "2012M08", "2012M09", "2012M10", "2012M11", "2012M12", "2013M01", "2013M02", "2013M03", "2013M04", "2013M05", "2013M06", "2013M07", "2013M08", "2013M09", "2013M10", "2013M11", "2013M12", "2014M01", "2014M02", "2014M03", "2014M04", "2014M05", "2014M06", "2014M07", "2014M08", "2014M09", "2014M10", "2014M11", "2014M12", "2015M01", "2015M02", "2015M03", "2015M04", "2015M05", "2015M06", "2015M07", "2015M08", "2015M09", "2015M10", "2015M11", "2015M12", "2016M01", "2016M02", "2016M03", "2016M04", "2016M05", "2016M06", "2016M07", "2016M08", "2016M09", "2016M10", "2016M11", "2016M12", "2017M01", "2017M02", "2017M03", "2017M04", "2017M05", "2017M06", "2017M07", "2017M08", "2017M09", "2017M10", "2017M11", "2017M12", "2018M01", "2018M02", "2018M03", "2018M04", "2018M05", "2018M06", "2018M07", "2018M08", "2018M09", "2018M10", "2018M11", "2018M12", "2019M01", "2019M02", "2019M03", "2019M04", "2019M05", "2019M06", "2019M07", "2019M08", "2019M09", "2019M10", "2019M11", "2019M12", "2020M01", "2020M02", "2020M03", "2020M04", "2020M05", "2020M06", "2020M07", "2020M08", "2020M09", "2020M10", "2020M11", "2020M12", "2021M01", "2021M02", "2021M03", "2021M04", "2021M05", "2021M06", "2021M07", "2021M08", "2021M09", "2021M10", "2021M11", "2021M12", "2022M01", "2022M02", "2022M03", "2022M04", "2022M05", "2022M06", "2022M07", "2022M08", "2022M09", "2022M10", "2022M11", "2022M12", "2023M01", "2023M02", "2023M03", "2023M04", "2023M05", "2023M06", "2023M07", "2023M08", "2023M09", "2023M10", "2023M11", "2023M12", "2024M01", "2024M02", "2024M03", "2024M04", "2024M05" ] } } ], "response": { "format": "json-stat2" } }
URL: https://data.ssb.no/api/v0/en/table/12577/
JSON query:
{ "query": [ { "code": "Kjoretoytype", "selection": { "filter": "vs:Kjoretoykm", "values": [ "15" ] } }, { "code": "DrivstoffType", "selection": { "filter": "item", "values": [ "0", "1", "2", "18" ] } }, { "code": "ContentsCode", "selection": { "filter": "item", "values": [ "Kjorelengde" ] } }, { "code": "Tid", "selection": { "filter": "item", "values": [ "2010", "2011", "2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020", "2021", "2022", "2023" ] } } ], "response": { "format": "json-stat2" } }