Welcome!

Created 4-24-2022 by Lucas Voichick

The following code shows the data processing pipeline that I created for my Honors Thesis.

You can click here to read my thesis

.

Next line runs only if data has not yet been concatted. Gzip version is imported in next cell

Import all data

Filtering, Aggregating at Quarter Level, Classifying by Electric / Non-Electric

Organizing data by canton, registration quarter-year, eletric vehicle, EV Ratio

Horizontal and Vertical Organization

Horizontal Organization

Horizontally organized df has all four Data Terms for each canton across all quarters

Sampled selection of row and columns shown below:

Organizes vertically for regression

Appending regressors (purchase premiums, charging subsidies, tax ratio, population density)

Info on Purchase Premium Policies:

Thurgau
In 2019, a premium of 4000 CHF is offered
In 2020, decrease offer to 3500 CHF
In 2021, decrease to 2000 CHF

Ticino
Starting July 1, 2019, a premium of 2000 CHF is offered

Valais
From Nov. 1 2020 to end of 2022, a premium of 3500 CHF is offered

Schaffhausen
Starting in Jan 2021, a premium of 2000 CHF is offered

Info on Charging Station Subsidies:

Geneva
Starting Jan 1 2029, a subsidy of 2000 CHF is offered

Ticino
Starting June 19, 2019, a subsidy of 500 CHF is offered (which was no longer offered by end of 2021)

Valais
Starting Nov 1 2020, a subsidy of 1500 CHF is offered (for a single 11-22 kW charging station)

Vaud
Starting Dec 2020, a subsidy of 2000 CHF is offered

(More info on charging station subsidies)

Appending Vehicle Price Ratio and Social Controls (Tertiary and Pop Density)

Info on controls:

Vehicle Price Ratio Controls: Touring Club Suisse - 2021

Tertiary Education Percentage Controls: ASTRA - 2021

Filtering CO2 outliers for calculating CO2 mean regressand

Merging CO2 data with Regression Dataset

Taking natural log of regressands

Note - this cell will run an error due to taking the natural log of 0s. The couple canton-year-quarter measurements without any EV registrations will be removed in the regressions

Summary Statistic tables

Verticallly Organized Dataset Sample

Converting dummy variables (at Canton and Year-Quarter level)

Regression set-up

Running Regressions

1) The natural log of electric vehicle sales by quarter-year-canton

2) The natural log of electric vehicle market share by quarter-year-canton

3) The natural log of all vehicle sales by quarter-year-canton

4) The natural log of the average CO2 emissions of newly registered vehicles within each quarter-year-canton

Making some graphs

Average CO2 emissions vs. EV Market Share

Total Number of EVs, Non EVs, EVs

Plotting Electric Vehicle Market Share by Canton over Time

Plotting by number of EV sales

Plotting by total number of vehicle sales

Plotting the residuals at the canton level for a particular control-group model

This residual analysis allows for better visualization of regression output meanings

Thank you for your time.

-Lucas