my-markdown-library 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/F24LS_md/ Lecture 4 - Public.md +347 -0
- data/F24LS_md/Lecture 1 - Introduction and Overview.md +327 -0
- data/F24LS_md/Lecture 10 - Development_.md +631 -0
- data/F24LS_md/Lecture 11 - Econometrics.md +345 -0
- data/F24LS_md/Lecture 12 - Finance.md +692 -0
- data/F24LS_md/Lecture 13 - Environmental Economics.md +299 -0
- data/F24LS_md/Lecture 15 - Conclusion.md +272 -0
- data/F24LS_md/Lecture 2 - Demand.md +349 -0
- data/F24LS_md/Lecture 3 - Supply.md +329 -0
- data/F24LS_md/Lecture 5 - Production C-D.md +291 -0
- data/F24LS_md/Lecture 6 - Utility and Latex.md +440 -0
- data/F24LS_md/Lecture 7 - Inequality.md +607 -0
- data/F24LS_md/Lecture 8 - Macroeconomics.md +704 -0
- data/F24LS_md/Lecture 8 - Macro.md +700 -0
- data/F24LS_md/Lecture 9 - Game Theory_.md +436 -0
- data/F24LS_md/summary.yaml +105 -0
- data/F24Lec_MD/LecNB_summary.yaml +206 -0
- data/F24Lec_MD/lec01/lec01.md +267 -0
- data/F24Lec_MD/lec02/Avocados_demand.md +425 -0
- data/F24Lec_MD/lec02/Demand_Steps_24.md +126 -0
- data/F24Lec_MD/lec02/PriceElasticity.md +83 -0
- data/F24Lec_MD/lec02/ScannerData_Beer.md +171 -0
- data/F24Lec_MD/lec02/demand-curve-Fa24.md +213 -0
- data/F24Lec_MD/lec03/3.0-CubicCostCurve.md +239 -0
- data/F24Lec_MD/lec03/3.1-Supply.md +274 -0
- data/F24Lec_MD/lec03/3.2-sympy.md +332 -0
- data/F24Lec_MD/lec03/3.3a-california-energy.md +120 -0
- data/F24Lec_MD/lec03/3.3b-a-really-hot-tuesday.md +121 -0
- data/F24Lec_MD/lec04/lec04-CSfromSurvey-closed.md +335 -0
- data/F24Lec_MD/lec04/lec04-CSfromSurvey.md +331 -0
- data/F24Lec_MD/lec04/lec04-Supply-Demand-closed.md +519 -0
- data/F24Lec_MD/lec04/lec04-Supply-Demand.md +514 -0
- data/F24Lec_MD/lec04/lec04-four-plot-24.md +34 -0
- data/F24Lec_MD/lec04/lec04-four-plot.md +34 -0
- data/F24Lec_MD/lec05/Lec5-Cobb-Douglas.md +131 -0
- data/F24Lec_MD/lec05/Lec5-CobbD-AER1928.md +283 -0
- data/F24Lec_MD/lec06/6.1-Sympy-Differentiation.md +253 -0
- data/F24Lec_MD/lec06/6.2-3D-utility.md +287 -0
- data/F24Lec_MD/lec06/6.3-QuantEcon-Optimization.md +399 -0
- data/F24Lec_MD/lec06/6.4-latex.md +138 -0
- data/F24Lec_MD/lec06/6.5-Edgeworth.md +269 -0
- data/F24Lec_MD/lec07/7.1-inequality.md +283 -0
- data/F24Lec_MD/lec07/7.2-historical-inequality.md +237 -0
- data/F24Lec_MD/lec08/macro-fred-api.md +313 -0
- data/F24Lec_MD/lec09/lecNB-prisoners-dilemma.md +88 -0
- data/F24Lec_MD/lec10/Lec10.2-waterguard.md +401 -0
- data/F24Lec_MD/lec10/lec10.1-mapping.md +199 -0
- data/F24Lec_MD/lec11/11.1-slr.md +305 -0
- data/F24Lec_MD/lec11/11.2-mlr.md +171 -0
- data/F24Lec_MD/lec12/Lec12-4-PersonalFinance.md +590 -0
- data/F24Lec_MD/lec12/lec12-1_Interest_Payments.md +267 -0
- data/F24Lec_MD/lec12/lec12-2-stocks-options.md +235 -0
- data/F24Lec_MD/lec13/Co2_ClimateChange.md +139 -0
- data/F24Lec_MD/lec13/ConstructingMAC.md +213 -0
- data/F24Lec_MD/lec13/EmissionsTracker.md +170 -0
- data/F24Lec_MD/lec13/KuznetsHypothesis.md +219 -0
- data/F24Lec_MD/lec13/RoslingPlots.md +217 -0
- data/F24Lec_MD/lec15/vibecession.md +485 -0
- data/F24Textbook_MD/00-intro/index.md +292 -0
- data/F24Textbook_MD/01-demand/01-demand.md +152 -0
- data/F24Textbook_MD/01-demand/02-example.md +131 -0
- data/F24Textbook_MD/01-demand/03-log-log.md +284 -0
- data/F24Textbook_MD/01-demand/04-elasticity.md +248 -0
- data/F24Textbook_MD/01-demand/index.md +15 -0
- data/F24Textbook_MD/02-supply/01-supply.md +203 -0
- data/F24Textbook_MD/02-supply/02-eep147-example.md +86 -0
- data/F24Textbook_MD/02-supply/03-sympy.md +138 -0
- data/F24Textbook_MD/02-supply/04-market-equilibria.md +204 -0
- data/F24Textbook_MD/02-supply/index.md +16 -0
- data/F24Textbook_MD/03-public/govt-intervention.md +73 -0
- data/F24Textbook_MD/03-public/index.md +10 -0
- data/F24Textbook_MD/03-public/surplus.md +351 -0
- data/F24Textbook_MD/03-public/taxes-subsidies.md +282 -0
- data/F24Textbook_MD/04-production/index.md +15 -0
- data/F24Textbook_MD/04-production/production.md +178 -0
- data/F24Textbook_MD/04-production/shifts.md +296 -0
- data/F24Textbook_MD/05-utility/budget-constraints.md +166 -0
- data/F24Textbook_MD/05-utility/index.md +15 -0
- data/F24Textbook_MD/05-utility/utility.md +136 -0
- data/F24Textbook_MD/06-inequality/historical-inequality.md +253 -0
- data/F24Textbook_MD/06-inequality/index.md +15 -0
- data/F24Textbook_MD/06-inequality/inequality.md +226 -0
- data/F24Textbook_MD/07-game-theory/bertrand.md +257 -0
- data/F24Textbook_MD/07-game-theory/cournot.md +333 -0
- data/F24Textbook_MD/07-game-theory/equilibria-oligopolies.md +96 -0
- data/F24Textbook_MD/07-game-theory/expected-utility.md +61 -0
- data/F24Textbook_MD/07-game-theory/index.md +19 -0
- data/F24Textbook_MD/07-game-theory/python-classes.md +340 -0
- data/F24Textbook_MD/08-development/index.md +35 -0
- data/F24Textbook_MD/09-macro/CentralBanks.md +101 -0
- data/F24Textbook_MD/09-macro/Indicators.md +77 -0
- data/F24Textbook_MD/09-macro/fiscal_policy.md +36 -0
- data/F24Textbook_MD/09-macro/index.md +14 -0
- data/F24Textbook_MD/09-macro/is_curve.md +76 -0
- data/F24Textbook_MD/09-macro/phillips_curve.md +70 -0
- data/F24Textbook_MD/10-finance/index.md +10 -0
- data/F24Textbook_MD/10-finance/options.md +178 -0
- data/F24Textbook_MD/10-finance/value-interest.md +60 -0
- data/F24Textbook_MD/11-econometrics/index.md +16 -0
- data/F24Textbook_MD/11-econometrics/multivariable.md +218 -0
- data/F24Textbook_MD/11-econometrics/reading-econ-papers.md +25 -0
- data/F24Textbook_MD/11-econometrics/single-variable.md +483 -0
- data/F24Textbook_MD/11-econometrics/statsmodels.md +58 -0
- data/F24Textbook_MD/12-environmental/KuznetsHypothesis-Copy1.md +187 -0
- data/F24Textbook_MD/12-environmental/KuznetsHypothesis.md +187 -0
- data/F24Textbook_MD/12-environmental/MAC.md +254 -0
- data/F24Textbook_MD/12-environmental/index.md +36 -0
- data/F24Textbook_MD/LICENSE.md +11 -0
- data/F24Textbook_MD/intro.md +26 -0
- data/F24Textbook_MD/references.md +25 -0
- data/F24Textbook_MD/summary.yaml +414 -0
- metadata +155 -0
@@ -0,0 +1,213 @@
|
|
1
|
+
---
|
2
|
+
title: "ConstructingMAC"
|
3
|
+
type: lecture-notebook
|
4
|
+
week: 13
|
5
|
+
source_path: "/Users/ericvandusen/Documents/Data88E-ForTraining/F24Lec_NBs/lec13/ConstructingMAC.ipynb"
|
6
|
+
---
|
7
|
+
|
8
|
+
<table style="width: 100%;">
|
9
|
+
<tr style="background-color: transparent;"><td>
|
10
|
+
<img src="https://data-88e.github.io/assets/images/blue_text.png" width="250px" style="margin-left: 0;" />
|
11
|
+
</td><td>
|
12
|
+
<p style="text-align: right; font-size: 10pt;"><strong>Economic Models</strong>, Fall 2024<br>
|
13
|
+
Peter Grinde-Hollevik<br>
|
14
|
+
Dr. Eric Van Dusen
|
15
|
+
</p></td></tr>
|
16
|
+
</table>
|
17
|
+
|
18
|
+
```python
|
19
|
+
from datascience import *
|
20
|
+
import matplotlib.pyplot as plt
|
21
|
+
%matplotlib inline
|
22
|
+
|
23
|
+
import numpy as np
|
24
|
+
import pandas as pd
|
25
|
+
from matplotlib import patches
|
26
|
+
```
|
27
|
+
|
28
|
+
# Constructing the Marginal Abatement Cost Curve for Methane Gas
|
29
|
+
|
30
|
+
## Learning objectives
|
31
|
+
|
32
|
+
* Understanding of how to construct the of The McKinsey Greenhouse Gas (GHG) Marginal Abatement Cost Curve (MAC).
|
33
|
+
* Understanding of how to compare different MAC curves across industries and regions.
|
34
|
+
|
35
|
+

|
36
|
+
|
37
|
+
**This Notebook: Methane Illustration of Global MAC curve**
|
38
|
+
|
39
|
+
Please refer to the "Marginal Abatement Cost Curves" chapter for a thorough introduction to abatement curves. This is an empirical application of what you have learned in lecture and through your readings.
|
40
|
+
|
41
|
+
The data behind in the 2009 McKinsey Carbon Dioxide abatement curve is difficult to reproduce, and is out of date technologically. For this empirical case study we are relying on a dataset published by the International Energy Association for methane emissions from the oil and gas sector. One important starting point is that Methane is more powerful than CO2 in trapping heat in the atmosphere, 80 times more potent in the first 20 years and 20 times more powerful when average over 100 years. Methane emissions from the energy sector contribute 1/3 of all human caused methane emissions.
|
42
|
+
|
43
|
+
**This dataset and documentation are from**:
|
44
|
+
|
45
|
+
- Methane Emissions from Oil and Gas Report from IEA (https://www.iea.org/reports/methane-emissions-from-oil-and-gas)
|
46
|
+
- IEA Methane Tracker (2021) (https://www.iea.org/articles/methane-tracker-database).
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
The chart on the left offers indications of where these methane emissions occur within the oil and gas industry. The chart on the right indicates where the IEA estimates fall in respect to other recent studies. This clearly illustrates the enormous potential of methane emission abatement in the world's oil and gas sector. With high abatement potential, it is important to understand the various abatement technologies and their costs.
|
51
|
+
|
52
|
+
We start by importing a dataset on methane abatement from the International Environmental Agency (IEA):
|
53
|
+
|
54
|
+
```python
|
55
|
+
abatement_table = Table.read_table("abatement_data.csv").where('Cost',are.between(-10.1,10)).where('Possible Savings', are.below(200)).drop('Emissions').relabel('Possible Savings', 'Abatement Potential').relabel('Cost','Abatement Cost')
|
56
|
+
abatement_table
|
57
|
+
```
|
58
|
+
|
59
|
+
##### The Second column is Region. To begin with, let's select the Asia Pacific region.
|
60
|
+
The first MAC is drawn for the Asia Pacific region. This is approximately 1/4 of all emissions. Later, our analysis for the Asia Pacific Region can compared to North America.
|
61
|
+
|
62
|
+
```python
|
63
|
+
selection = 'Asia Pacific'
|
64
|
+
abatement_table_ap = abatement_table.where('Region', selection)
|
65
|
+
abatement_table_ap
|
66
|
+
```
|
67
|
+
|
68
|
+
#### Plotting Functions
|
69
|
+
Building the MAC requires some data manipulations to build this specific visualization. The first is that the width of the columns will be the quantity of abatement. The height ( whether positive or negative) will be the cost.
|
70
|
+
|
71
|
+
For drawing the plot we need to actually find the middle point in each column so that we place each abatement technology at the right place on the MAC. The seconds part runs the function on our x and y axis.
|
72
|
+
|
73
|
+
```python
|
74
|
+
# Making columnn widths for the Asia Pacific _ap Region
|
75
|
+
def find_x_pos(widths):
|
76
|
+
cumulative_widths = [0]
|
77
|
+
cumulative_widths.extend(np.cumsum(widths))
|
78
|
+
half_widths = [i/2 for i in widths]
|
79
|
+
x_pos = []
|
80
|
+
for i in range(0, len(half_widths)):
|
81
|
+
x_pos.append(half_widths[i] + cumulative_widths[i])
|
82
|
+
return x_pos
|
83
|
+
|
84
|
+
#Prepare the data for plotting
|
85
|
+
width_group = abatement_table_ap.column('Abatement Potential')
|
86
|
+
height_group = abatement_table_ap.column('Abatement Cost')
|
87
|
+
new_x_group = find_x_pos(width_group)
|
88
|
+
```
|
89
|
+
|
90
|
+
### Policy Analysis Tool
|
91
|
+
Now lets add a tool in to see the effects of a tax. With the following function, we introduce level of taxation to measure the total abatement outcome later.
|
92
|
+
|
93
|
+
```python
|
94
|
+
def methane_tax(tax, table):
|
95
|
+
if tax < min(table.column('Abatement Cost')):
|
96
|
+
print("No Abatement")
|
97
|
+
else:
|
98
|
+
abatement = table.where('Abatement Cost', are.below_or_equal_to(tax))
|
99
|
+
total_abatement = sum(abatement.column('Abatement Potential'))
|
100
|
+
abatement_technologies = abatement.column('Abatement technology')
|
101
|
+
|
102
|
+
print('Total Abatement (kt CH4): ', np.round(total_abatement,2))
|
103
|
+
print("")
|
104
|
+
```
|
105
|
+
|
106
|
+
#### Plot the graph, with tax line
|
107
|
+
The next function takes the methane_tax function and does plots all the possible abatement opportunities.
|
108
|
+
|
109
|
+
Try to understand what each "plt" part does if you're interested!
|
110
|
+
|
111
|
+
```python
|
112
|
+
def group_plot(tax):
|
113
|
+
print(f"Methane Tax ($/MBtu): ${tax}")
|
114
|
+
methane_tax(tax, abatement_table_ap)
|
115
|
+
plt.figure(figsize=(16,10))
|
116
|
+
plt.bar(new_x_group, height_group,width=width_group,edgecolor = 'black')
|
117
|
+
plt.title(selection)
|
118
|
+
plt.xlabel('Abatement Potential KtCH4')
|
119
|
+
plt.ylabel('Abatement Cost $/MBtu')
|
120
|
+
plt.axhline(y=tax, color='r',linewidth = 2)
|
121
|
+
|
122
|
+
group_plot(4)
|
123
|
+
```
|
124
|
+
|
125
|
+
This is an applied MAC for Methane in Asia Pacific.
|
126
|
+
|
127
|
+
|
128
|
+
Let's make the plot even more instructive by creating a color mapping of the different abatement technologies.
|
129
|
+
The solution to this is giving each a different color from a Python dictionary.
|
130
|
+
|
131
|
+
```python
|
132
|
+
#Prepare data for plotting (second round)
|
133
|
+
width = abatement_table_ap.column('Abatement Potential')
|
134
|
+
height = abatement_table_ap.column('Abatement Cost')
|
135
|
+
new_x = find_x_pos(width)
|
136
|
+
|
137
|
+
#Let's give each type of technology a different color!
|
138
|
+
abatement_colors_dict = {}
|
139
|
+
count = 0
|
140
|
+
colors = ['#EC5F67', '#F29056', '#F9C863', '#99C794', '#5FB3B3', '#6699CC', '#C594C5','#85E827','#F165FD','#1F9F7F','#945CF8','#ff3a1d','#2a8506']
|
141
|
+
for i in set(abatement_table_ap['Abatement technology']):
|
142
|
+
abatement_colors_dict[i] = colors[count]
|
143
|
+
count += 1
|
144
|
+
|
145
|
+
colors_mapped = list(pd.Series(abatement_table_ap['Abatement technology']).map(abatement_colors_dict))
|
146
|
+
abatement_table_ap = abatement_table_ap.with_column('Color', colors_mapped)
|
147
|
+
```
|
148
|
+
|
149
|
+
```python
|
150
|
+
#The Methane curve plot - function!
|
151
|
+
def mckinsey_curve(tax, abatement_table):
|
152
|
+
print(f"Methane Tax: ${tax}")
|
153
|
+
methane_tax(tax, abatement_table_ap)
|
154
|
+
plt.figure(figsize=(18,12))
|
155
|
+
plt.bar(new_x, height, width=width, linewidth=0.1, color=abatement_table['Color'], edgecolor = "black")
|
156
|
+
plt.title('Methane Abatement Cost Curve (MAC)')
|
157
|
+
plt.xlabel('Abatement Potential KtCH4')
|
158
|
+
plt.ylabel('Abatement Cost $/MBtu')
|
159
|
+
plt.axhline(y=tax, color='r', linewidth = 2)
|
160
|
+
|
161
|
+
plt.figure(figsize=(5,1))
|
162
|
+
plt.bar(abatement_colors_dict.keys(), 1, color = abatement_colors_dict.values())
|
163
|
+
plt.xticks(rotation=60)
|
164
|
+
plt.title('Legend')
|
165
|
+
|
166
|
+
mckinsey_curve(3, abatement_table_ap)
|
167
|
+
```
|
168
|
+
|
169
|
+
#### Color MAC plot for Asia Pacific Region
|
170
|
+
*Nice Plot!* From here, we can differentiate the multiple methane abatement technologies on a cost basis, finding the most efficient ways of reducing methane emissions from gas production.
|
171
|
+
|
172
|
+
Looking at the Asia Region we can see that most of the opportunities on this graph have a negative cost- meaning that it makes economic sense to make the technological improvements.
|
173
|
+
|
174
|
+
We also observe the result of introducing a tax: With a tax of $3 per ton, we expect the total abatement to be almost 4300 tons within this industry.
|
175
|
+
|
176
|
+
### Now, repeating the process for North America:
|
177
|
+
|
178
|
+
```python
|
179
|
+
selection = 'North America'
|
180
|
+
abatement_table_us = abatement_table.where('Region', selection)
|
181
|
+
abatement_table_us
|
182
|
+
|
183
|
+
#Prepare data for plotting (North America. _us)
|
184
|
+
width = abatement_table_us.column('Abatement Potential')
|
185
|
+
height = abatement_table_us.column('Abatement Cost')
|
186
|
+
new_x = find_x_pos(width)
|
187
|
+
|
188
|
+
colors_mapped = list(pd.Series(abatement_table_us['Abatement technology']).map(abatement_colors_dict))
|
189
|
+
abatement_table_us = abatement_table_us.with_column('Color', colors_mapped)
|
190
|
+
|
191
|
+
mckinsey_curve(3, abatement_table_us)
|
192
|
+
```
|
193
|
+
|
194
|
+
### Finally, lets build the table for the Global emissions (all regions) :
|
195
|
+
|
196
|
+
```python
|
197
|
+
abatement_table = Table.read_table("abatement_data.csv").where('Cost',are.between(-10.1,10)).where('Possible Savings', are.below(200)).drop('Emissions').relabel('Possible Savings', 'Abatement Potential').relabel('Cost','Abatement Cost')
|
198
|
+
abatement_table
|
199
|
+
|
200
|
+
width = abatement_table.column('Abatement Potential')
|
201
|
+
height = abatement_table.column('Abatement Cost')
|
202
|
+
new_x = find_x_pos(width)
|
203
|
+
|
204
|
+
colors_mapped = list(pd.Series(abatement_table['Abatement technology']).map(abatement_colors_dict))
|
205
|
+
abatement_table = abatement_table.with_column('Color', colors_mapped)
|
206
|
+
|
207
|
+
mckinsey_curve(3, abatement_table)
|
208
|
+
```
|
209
|
+
|
210
|
+
### Challenge for the student:
|
211
|
+
|
212
|
+
You might have noticed how the author of this chapter (Peter) repeats certain lines of code. My challenge to you would be to find these lines and write one big function (or multiple small ones) that streamlines the whole process. Let me know at hollevik@berkeley.edu when you figure it out!
|
213
|
+
|
@@ -0,0 +1,170 @@
|
|
1
|
+
---
|
2
|
+
title: "EmissionsTracker"
|
3
|
+
type: lecture-notebook
|
4
|
+
week: 13
|
5
|
+
source_path: "/Users/ericvandusen/Documents/Data88E-ForTraining/F24Lec_NBs/lec13/EmissionsTracker.ipynb"
|
6
|
+
---
|
7
|
+
|
8
|
+
## Climate Action Tracker - Country Assessments
|
9
|
+
|
10
|
+
|
11
|
+
The Climate Action Tracker develops national greenhouse gas emission scenarios to assess countries' mitigation efforts.
|
12
|
+
These scenarios include both pledges, such as NDCs and net zero commitments, and emission trajectories under currently adopted policies and actions.
|
13
|
+
For more details please visit the methodology section on our website: https://climateactiontracker.org/methodology/estimating-national-emissions/
|
14
|
+
|
15
|
+
Here, we present the latest version of the scenarios developed for each country. Please note that the assessment date varies per country and that some updates from the past month may not yet be reflected in this table.
|
16
|
+
|
17
|
+
Values in the table below are in MtCO2e/year and AR4 GWPs.
|
18
|
+
|
19
|
+
Please reference as: 'Climate Action Tracker, Country Assessments | November 2024 - http://climateactiontracker.org'
|
20
|
+
|
21
|
+
Copyright © 2024 Climate Action Tracker by NewClimate Institute and Climate Analytics. All rights reserved. The content provided by this website is protected by copyright.
|
22
|
+
You are authorised to view, download, print and distribute the content from this website subject to the following condition: Any reproduction, in full or in part, must credit Climate Analytics and NewClimate Institute and must include a copyright notice.
|
23
|
+
|
24
|
+
```python
|
25
|
+
import pandas as pd
|
26
|
+
import openpyxl
|
27
|
+
import plotly.express as px
|
28
|
+
```
|
29
|
+
|
30
|
+
```python
|
31
|
+
url='https://climateactiontracker.org/documents/1289/CAT_14112024_CountryAssessmentData_DataExplorer.xlsx'
|
32
|
+
```
|
33
|
+
|
34
|
+
```python
|
35
|
+
file_path = 'CAT_14112024_CountryAssessmentData_DataExplorer.xlsx'
|
36
|
+
sheet_name = 'Assessment'
|
37
|
+
```
|
38
|
+
|
39
|
+
```python
|
40
|
+
# Reload the data with the first row as headers using openpyxl engine
|
41
|
+
emissions = pd.read_excel(url, sheet_name=sheet_name, skiprows=18, engine='openpyxl')
|
42
|
+
emissions
|
43
|
+
```
|
44
|
+
|
45
|
+
LULUCF stands for Land Use, Land-Use Change, and Forestry. In emissions tracking, it refers to the greenhouse gas (GHG) emissions and removals resulting from human activities in forests, croplands, grasslands, wetlands, and other land-use types.
|
46
|
+
|
47
|
+
LULUCF plays a dual role in emissions accounting:
|
48
|
+
|
49
|
+
Source of Emissions: When forests are cleared, burned, or degraded, or when land is converted to agricultural or other uses, it releases stored carbon into the atmosphere.
|
50
|
+
|
51
|
+
Carbon Sink: LULUCF activities can also act as a carbon sink by removing CO₂ from the atmosphere, for example, through reforestation, afforestation, or improved land management practices.
|
52
|
+
|
53
|
+
In climate agreements and national emissions inventories, LULUCF is often included separately due to its unique nature of both emitting and absorbing
|
54
|
+
|
55
|
+
```python
|
56
|
+
emissions_cleaned = emissions.dropna(subset=["Country"])
|
57
|
+
emissions_cleaned
|
58
|
+
# i want to replace the value in the column "Sector" with "Emissions-exLU" where the value is "Economy-wide, excluding LULUCF"
|
59
|
+
emissions_cleaned['Sector'] = emissions_cleaned['Sector'].replace("Economy-wide, excluding LULUCF", "Emissions-exLU")
|
60
|
+
#emissions_cleaned.loc[emissions_cleaned['Sector'] == "Economy-wide, excluding LULUCF", 'Sector'] = "Emissions-exLU"
|
61
|
+
|
62
|
+
emissions_cleaned
|
63
|
+
```
|
64
|
+
|
65
|
+
```python
|
66
|
+
# lets look at China
|
67
|
+
china = emissions_cleaned[emissions_cleaned['Country'] == 'CHN']
|
68
|
+
china
|
69
|
+
```
|
70
|
+
|
71
|
+
### Lets looks at China Historical Emissions
|
72
|
+
|
73
|
+
Scenario = "Historical" and sector = "Emissions-exLU"
|
74
|
+
|
75
|
+
```python
|
76
|
+
china_historical = china[(china['Scenario'] == 'Historical') & (china['Sector'] == 'Emissions-exLU')]
|
77
|
+
china_historical
|
78
|
+
```
|
79
|
+
|
80
|
+
### The data are in the wrong shape for analysis.
|
81
|
+
- The years are spread out as columns
|
82
|
+
- Let's `melt` the DataFrame so that years become rows under a 'Year' column
|
83
|
+
|
84
|
+
```python
|
85
|
+
china_historical_melted = pd.melt(
|
86
|
+
china_historical,
|
87
|
+
id_vars=['Version', 'Country', 'Scenario', 'Sector', 'Indicator', 'Unit'],
|
88
|
+
var_name='Year',
|
89
|
+
value_name='Emissions'
|
90
|
+
)
|
91
|
+
|
92
|
+
china_historical_melted['Year'] = pd.to_numeric(china_historical_melted['Year'], errors='coerce')
|
93
|
+
|
94
|
+
china_historical_melted.head()
|
95
|
+
```
|
96
|
+
|
97
|
+
```python
|
98
|
+
fig = px.line(china_historical_melted, x='Year', y='Emissions', title='China Emissions-exLU Historical')
|
99
|
+
fig.show()
|
100
|
+
```
|
101
|
+
|
102
|
+
## Now let's get the Forecast data
|
103
|
+
|
104
|
+
In this dataset these are called "current policy scenario,max" and "current policy scenario,min".
|
105
|
+
- We will use the same process 'melt' as above to get the data in the right shape for analysis.
|
106
|
+
|
107
|
+
```python
|
108
|
+
china_current_policy = china[china['Scenario'].str.contains('Current Policy')]
|
109
|
+
|
110
|
+
china_current_policy_melted = pd.melt(
|
111
|
+
china_current_policy_both,
|
112
|
+
id_vars=['Version', 'Country', 'Scenario', 'Sector', 'Indicator', 'Unit'],
|
113
|
+
var_name='Year',
|
114
|
+
value_name='Emissions'
|
115
|
+
)
|
116
|
+
|
117
|
+
china_current_policy_melted
|
118
|
+
```
|
119
|
+
|
120
|
+
Now we need to pivot the data so that we have the following columns:
|
121
|
+
- Year
|
122
|
+
- Max Emissions
|
123
|
+
- Min Emissions
|
124
|
+
|
125
|
+
```python
|
126
|
+
data_melted = china_current_policy_melted
|
127
|
+
china_current_policy_melted['Year'] = pd.to_numeric(china_current_policy_melted['Year'], errors='coerce')
|
128
|
+
|
129
|
+
china_forecast_pivot = china_current_policy_melted.pivot_table(
|
130
|
+
index=['Version', 'Country', 'Sector', 'Indicator', 'Unit', 'Year'],
|
131
|
+
columns='Scenario',
|
132
|
+
values='Emissions'
|
133
|
+
).reset_index()
|
134
|
+
|
135
|
+
# Rename the columns for clarity
|
136
|
+
china_forecast_pivot.columns.name = None
|
137
|
+
china_forecast_pivot.rename(columns={'Current Policy, Max': 'Max_Forecast', 'Current Policy, Min': 'Min_Forecast'}, inplace=True)
|
138
|
+
|
139
|
+
china_forecast_pivot
|
140
|
+
```
|
141
|
+
|
142
|
+
Let's plot the data to see the trends in the emissions
|
143
|
+
|
144
|
+
```python
|
145
|
+
fig = px.line(china_forecast_pivot, x='Year', y='Max_Forecast', title='China Emissions-exLU Current Policy')
|
146
|
+
fig.add_scatter(x=china_forecast_pivot['Year'], y=china_forecast_pivot['Min_Forecast'], mode='lines', name='Forecast Min')
|
147
|
+
fig.show()
|
148
|
+
```
|
149
|
+
|
150
|
+
Let's add historical data to the plot
|
151
|
+
|
152
|
+
```python
|
153
|
+
fig = px.line(china_historical_melted, x='Year', y='Emissions', title='China Emissions-exLU Historical')
|
154
|
+
fig.add_scatter(x=china_forecast_pivot['Year'], y=china_forecast_pivot['Max_Forecast'], mode='lines', name='Max Emissions')
|
155
|
+
fig.add_scatter(x=china_forecast_pivot['Year'], y=china_forecast_pivot['Min_Forecast'], mode='lines', name='Min Emissions')
|
156
|
+
fig.show()
|
157
|
+
```
|
158
|
+
|
159
|
+
```python
|
160
|
+
|
161
|
+
```
|
162
|
+
|
163
|
+
```python
|
164
|
+
|
165
|
+
```
|
166
|
+
|
167
|
+
```python
|
168
|
+
|
169
|
+
```
|
170
|
+
|
@@ -0,0 +1,219 @@
|
|
1
|
+
---
|
2
|
+
title: "KuznetsHypothesis"
|
3
|
+
type: lecture-notebook
|
4
|
+
week: 13
|
5
|
+
source_path: "/Users/ericvandusen/Documents/Data88E-ForTraining/F24Lec_NBs/lec13/KuznetsHypothesis.ipynb"
|
6
|
+
---
|
7
|
+
|
8
|
+
<table style="width: 100%;">
|
9
|
+
<tr style="background-color: transparent;"><td>
|
10
|
+
<img src="https://data-88e.github.io/assets/images/blue_text.png" width="250px" style="margin-left: 0;" />
|
11
|
+
</td><td>
|
12
|
+
<p style="text-align: right; font-size: 10pt;"><strong>Economic Models</strong>, Fall 2024<br>
|
13
|
+
Peter Grinde-Hollevik<br>
|
14
|
+
Dr. Eric Van Dusen
|
15
|
+
</p></td></tr>
|
16
|
+
</table>
|
17
|
+
|
18
|
+
```python
|
19
|
+
from datascience import *
|
20
|
+
import matplotlib.pyplot as plt
|
21
|
+
import numpy as np
|
22
|
+
import pandas as pd
|
23
|
+
from matplotlib import patches
|
24
|
+
%matplotlib inline
|
25
|
+
```
|
26
|
+
|
27
|
+
### What is the Environmental Kuznets Curve Hypothesis?
|
28
|
+
|
29
|
+
The Environmental Kuznets curve hypothesis that the economic development of a nation is associated with a downward-facing U-shape.
|
30
|
+
|
31
|
+
The Y-axis is in terms of the level of environmental degradation (e.g pollution, water quality, deforestation. The X-axis would be the GDP/capita.
|
32
|
+
|
33
|
+
The idea is that the environmental degradation worsens, until a certain level of income, and after which it gets better. In the US this could be seen in terms of air or water quality, where the skies or rivers were very polluted in the 1960s, until the Clean Air Act and Clean Water Act were passed and Air Quality and Water Quality improved.
|
34
|
+
|
35
|
+
Another motivation for the downward slope would be the idea that at some point a wealthier society demands environmental improvements.
|
36
|
+
|
37
|
+
However, could this hold for the potentially most important Pollutant $CO_2$, the main driver of anthropogenic climate change? Controversially, the impacts of global CO2 pollution are not experienced *locally*, but are experienced as *global* effects. So it is not clear whether the Environmental Kuznets hypothesis will hold.
|
38
|
+
|
39
|
+
Today, we'll look to build an $CO_2$ Kuznets curve for an *association* between the amount of $CO_2$ emitted per capita (t/CO2) and the growing GDP per capita (USD). This dataset is collected from Our World in Data, a great source of all sorts of data types!
|
40
|
+
|
41
|
+

|
42
|
+
|
43
|
+
### Building our own Environmental Kuznets Curve
|
44
|
+
|
45
|
+
We start by importing data on GDP per capita and Per Capita $CO_2$ emissions for every country in the world for as long as it has been recorded.
|
46
|
+
|
47
|
+
Source: Gapminder Foundation
|
48
|
+
|
49
|
+
```python
|
50
|
+
co2_table = Table.read_table('co2-emissions-vs-gdp.csv').drop('145446-annotations','Total population (Gapminder, HYDE & UN)','Code')
|
51
|
+
co2_table = co2_table.relabeled('Entity', 'Country')
|
52
|
+
co2_table
|
53
|
+
```
|
54
|
+
|
55
|
+
#### Low Income Countries
|
56
|
+
Let's start by selecting a set of Low Income Countries to graph the movement of $CO_2$ intensity
|
57
|
+
|
58
|
+
```python
|
59
|
+
#Low-Income Nations
|
60
|
+
LIH_array = make_array('Haiti', 'Afghanistan','Rwanda','Pakistan', 'Nicaragua')
|
61
|
+
LIH_table = co2_table.where('Country', are.contained_in(LIH_array))
|
62
|
+
LIH_table = LIH_table.where('GDP per capita', are.above_or_equal_to(0)).where('Per capita CO2 emissions', are.above_or_equal_to(0))
|
63
|
+
plt.figure(figsize = (8,6), dpi=250)
|
64
|
+
LIH_table.scatter('GDP per capita', 'Per capita CO2 emissions',group='Country');
|
65
|
+
```
|
66
|
+
|
67
|
+
Note that each dot represents a nation at a given level of emissions and GDP per capita
|
68
|
+
|
69
|
+
With these three countries we see a few different stories:
|
70
|
+
- In Afghanistan, Haiti and Rwanda we see little income growth and little $CO_2$ intensity growth with a slight upward trend
|
71
|
+
- In Nicaragua we see some jumping around, in fact Nicaragua GDP per capita has gone up and down, as has $CO_2$ per capita
|
72
|
+
- In Pakistan, a larger and more populous country we see strong linear upward growth in both GDP per capita and $CO_2$ per capita, with no signs of turning down
|
73
|
+
|
74
|
+
In these countries it is hard to tell the complete story without the exact time trend.
|
75
|
+
|
76
|
+
#### BRICS
|
77
|
+
Lets look at the BRICS countries, the rapidly growing upper middle income countries
|
78
|
+
|
79
|
+
```python
|
80
|
+
BRICS_array = make_array('Brazil','Russia','India','China','South Africa')
|
81
|
+
BRICS_table = co2_table.where('Country', are.contained_in(BRICS_array))
|
82
|
+
BRICS_table = BRICS_table.where('GDP per capita', are.above_or_equal_to(0)).where('Per capita CO2 emissions', are.above_or_equal_to(0))
|
83
|
+
BRICS_table.scatter('GDP per capita', 'Per capita CO2 emissions',group='Country')
|
84
|
+
```
|
85
|
+
|
86
|
+
The BRICS nations seem to have a variety of development pathways but all show the linear trend of increasing emissions as wealth grows.
|
87
|
+
- Russia has an interesting dip while GDP per capita decrease and then increase again
|
88
|
+
- South Africa has a recent period where growth in both GDP per capita and $CO_2$ per capita have stagnated
|
89
|
+
- China and India show linearly increasing trends, with China both wealthier and more $CO_2$ intensive
|
90
|
+
|
91
|
+
### Individual country graphs
|
92
|
+
Lets look at some individual countries, starting with the US
|
93
|
+
We can plot both total and logged quantities
|
94
|
+
|
95
|
+
```python
|
96
|
+
US_table = co2_table.where('Country', 'United States').where('Year', are.between(1800,2018))
|
97
|
+
US_table = US_table.with_column('LogGDP', np.log(US_table.column('GDP per capita'))).with_column('LogCO2',np.log(US_table.column('Per capita CO2 emissions')))
|
98
|
+
US_table.scatter('GDP per capita', 'Per capita CO2 emissions')
|
99
|
+
US_table.scatter('LogGDP', 'LogCO2')
|
100
|
+
```
|
101
|
+
|
102
|
+
**Looks like we have a curve!**
|
103
|
+
|
104
|
+
In the case of the US it does indeed look like the C02 per capita does indeed start to deline after about USD 40,000.
|
105
|
+
|
106
|
+
Somewhere around 2000-2004 the $CO_2$ emissions leveled off and then began to decline
|
107
|
+
|
108
|
+
### Let's look at China
|
109
|
+
In COP26 and 27 (this year), China has been a large part of the discussion (and emissions). Let's have a look at their curve!
|
110
|
+
|
111
|
+
```python
|
112
|
+
#China Example + LOG
|
113
|
+
NO_table = co2_table.where('Country', 'China').where('Year', are.between(1800,2018))
|
114
|
+
NO_table = NO_table.with_column('LogGDP', np.log(NO_table.column('GDP per capita'))).with_column('LogCO2',np.log(NO_table.column('Per capita CO2 emissions')))
|
115
|
+
NO_table.scatter('GDP per capita', 'Per capita CO2 emissions')
|
116
|
+
NO_table.scatter('LogGDP', 'LogCO2')
|
117
|
+
```
|
118
|
+
|
119
|
+
Indeed it appears that China has an inflection point and is starting to level off in the $CO_2$ intensity per capita.
|
120
|
+
|
121
|
+
What about India?
|
122
|
+
|
123
|
+
```python
|
124
|
+
#India Example + LOG
|
125
|
+
NO_table = co2_table.where('Country', 'India').where('Year', are.between(1800,2018))
|
126
|
+
NO_table = NO_table.with_column('LogGDP', np.log(NO_table.column('GDP per capita'))).with_column('LogCO2',np.log(NO_table.column('Per capita CO2 emissions')))
|
127
|
+
NO_table.scatter('GDP per capita', 'Per capita CO2 emissions')
|
128
|
+
NO_table.scatter('LogGDP', 'LogCO2')
|
129
|
+
```
|
130
|
+
|
131
|
+
As I'm Norwegian, I thought it might be cool to see how things are going back home as well:
|
132
|
+
|
133
|
+
```python
|
134
|
+
#Norway Example + LOG
|
135
|
+
NO_table = co2_table.where('Country', 'Norway').where('Year', are.between(1800,2018))
|
136
|
+
NO_table = NO_table.with_column('LogGDP', np.log(NO_table.column('GDP per capita'))).with_column('LogCO2',np.log(NO_table.column('Per capita CO2 emissions')))
|
137
|
+
NO_table.scatter('GDP per capita', 'Per capita CO2 emissions')
|
138
|
+
NO_table.scatter('LogGDP', 'LogCO2')
|
139
|
+
```
|
140
|
+
|
141
|
+
Turns out we're ahead of the US in $CO_2$ emissions per capita, but there's still a long way to go until our development resembles a full Kuznets curve.
|
142
|
+
|
143
|
+
However, it certainly looks like something! An almost vertical linear growth in terms of per capita $CO_2$ emissions in the early economic stages stagnated into a period of fluctuations. As of now, it looks like it’s heading in a downward trend.
|
144
|
+
|
145
|
+
Let's look at a set of other High Income Nations:
|
146
|
+
|
147
|
+
```python
|
148
|
+
HIN_array = make_array('United States', 'Netherlands', 'United Kingdom','Germany','Canada')
|
149
|
+
HIN_table = co2_table.where('Country', are.contained_in(HIN_array))
|
150
|
+
HIN_table = HIN_table.where('GDP per capita', are.above_or_equal_to(0)).where('Per capita CO2 emissions', are.above_or_equal_to(0))
|
151
|
+
HIN_table.scatter('GDP per capita', 'Per capita CO2 emissions',group='Country')
|
152
|
+
```
|
153
|
+
|
154
|
+
```python
|
155
|
+
HMLIN_array = make_array('United States', 'China', 'India','Germany')
|
156
|
+
HMLIN_table = co2_table.where('Country', are.contained_in(HMLIN_array))
|
157
|
+
HMLIN_table = HMLIN_table.where('GDP per capita', are.above_or_equal_to(0)).where('Per capita CO2 emissions', are.above_or_equal_to(0))
|
158
|
+
HMLIN_table.scatter('GDP per capita', 'Per capita CO2 emissions',group='Country')
|
159
|
+
```
|
160
|
+
|
161
|
+
As in the US and Norway, these nations have experienced a boom, stagnation, and now to some extent a downward trend. Let's finally plot all the previously observed nations together:
|
162
|
+
|
163
|
+
```python
|
164
|
+
ALL_array = np.append((np.append(LIH_array,BRICS_array)), HIN_array)
|
165
|
+
ALL_table = co2_table.where('Country', are.contained_in(ALL_array))
|
166
|
+
ALL_table = ALL_table.where('GDP per capita', are.above_or_equal_to(0)).where('Per capita CO2 emissions', are.above_or_equal_to(0))
|
167
|
+
ALL_table.scatter('GDP per capita', 'Per capita CO2 emissions',group='Country')
|
168
|
+
#What do we see? Can we spot the Environmental Kuznets Curve?
|
169
|
+
```
|
170
|
+
|
171
|
+
Here we see potential evidence for an Environmental Kuznets Curve.
|
172
|
+
|
173
|
+
It seems, at least to some extent, that as nations develop economically, the level of environmental degradation reaches a peak and then declines, mapping a downward-facing U-curve.
|
174
|
+
|
175
|
+
### [BONUS] Criticism of the Environmental Kuznets Curve Hypothesis
|
176
|
+
|
177
|
+
Some questions we ought to ask ourselves in the end are:
|
178
|
+
* Do all types of environmental degradation follow the curve? What if we plot Energy, Land, & Resource usage?
|
179
|
+
* What we plotted today shows the ratio between GDP and CO2 per capita, but what about the *absolute* numbers of emissions?
|
180
|
+
* What is the true long-term shape of the curve? Could it reshape itself to an "N" as an economy passes a certain threshold?
|
181
|
+
* What about its applicability on a global scale? Knowing that the HINs have a habit of exporting pollution to LINs, what will happen as LIN grow economically?
|
182
|
+
|
183
|
+
These are just some questions environmental economists have asked themselves throughout the years since the curve was hypothesized in 1955. Some, including Perman and Stern (2003) conclude that the level of environmental degradation has much more to do with a constant "battle" between scale and time than income alone. As nations scale up (BRICS, for instance) the growth results in higher emissions, while countries with lower growth (LIN & HIN) seem more influenced by the "time-effect", which results in lower emissions. Others, among Krueger & Grossman, argue that there is "no evidence that environmental quality deteriorates steadily with economic growth."
|
184
|
+
|
185
|
+
More on these theories can be found in the recommended readings below.
|
186
|
+
|
187
|
+
As data scientists motivated to help heal the plant with the tools of environmental economics, we can help to find these answers!
|
188
|
+
|
189
|
+
#### What's next?
|
190
|
+
|
191
|
+
If you are interested in this area, there are even more fascinating applications of Data Science to environmental topics such as: finding the social cost of carbon, the valuation of our environment, and the economics of emissions trading. Besides purely economical modeling, the field of environmental data science is rapidly growing as we collect more and more data on our planet and its resources. Applying the power of Satellite Imagery, Machine Learning, and Geographic Information Systems (GIS), one can follow both technology and policy-based paths, both ensured to have a positive impact in shaping a data-driven, sustainable future.
|
192
|
+
|
193
|
+
### If you liked this, check out these readings!
|
194
|
+
|
195
|
+
Levelized Cost of Carbon Abatement: An Improved Cost-Assessment Methodology for a Net-Zero Emissions World (also the main source of this Jupyter Notebook)
|
196
|
+
|
197
|
+
https://www.energypolicy.columbia.edu/sites/default/files/file-uploads/LCCA_CGEP-Report_101620.pdf
|
198
|
+
|
199
|
+
Dynamic vs. Static costs are described further in K.Gillingham & J.H Stock's The Cost of Reducing Greenhouse Gas Emissions (italic) from 2018. - A highly recommended reading out of scope for this class.
|
200
|
+
|
201
|
+
https://scholar.harvard.edu/files/stock/files/gillingham_stock_cost_080218_posted.pdf
|
202
|
+
|
203
|
+
Goldman Sachs Research: Carbonomics: The Future of Energy in the Age of Climate Change
|
204
|
+
|
205
|
+
https://www.goldmansachs.com/insights/pages/carbonomics.html
|
206
|
+
|
207
|
+
EPA article on the Economics of Climate Change:
|
208
|
+
https://www.epa.gov/environmental-economics/economics-climate-change
|
209
|
+
|
210
|
+
Draw your own curve program:
|
211
|
+
https://tamc.github.io/macc/
|
212
|
+
|
213
|
+
Abatement curve for crops:
|
214
|
+
https://github.com/aj-sykes92/ggmacc/blob/main/README_files/figure-gfm/full-macc-1.png
|
215
|
+
|
216
|
+
|
217
|
+
Aalborg University's software:
|
218
|
+
https://github.com/matpri/EPLANoptMAC
|
219
|
+
|