VISTA ANALYSE
Nyheter
Nyheter
Vista i Media
Tjenester
Samfunnsøkonomisk analyse
Statistikk og empirisk analyse
Evalueringer
Kurs og foredrag
Lokal- og regionalanalyse
Modeller og databaser
NOREG 2
Vista Analyses Ringvirkningsmodell
Strategi og prosessrådgivning
Kvalitetssikring, tvister og ekspertuttalelser
Utviklingssamarbeid
Bransjer
Kraft og energi
Miljø
Samferdsel
Velferd
Eiendom, bygg og anlegg
Fiskeri og havbruk
Service og handel
IKT og digitalisering
Klima og det grønne skiftet
Kultur og kreative næringer
Landbruk
Olje og gass
Lokal og regional utvikling
Reguleringer og konkurranseøkonomi
Skatter og offentlig økonomi
Publikasjoner
Medarbeidere
Orvika Rosnes
Daglig leder
Åsmund Sunde Valseth
Styreleder
Dag Morten Dalen
Partner
Michael Hoel
Partner
Rasmus Bøgh Holmen
Partner
Pernille Parmer
Partner
Ingeborg Rasmussen
Partner
Kristian Roksvaag
Partner
John Magne Skjelvik
Partner
Steinar Strøm
Partner
Sidsel Sverdrup
Partner
Hanne Toftdahl
Partner
Haakon Vennemo
Partner
Bård Solheim Andersen
Assosiert partner
Tor Homleid
Assosiert partner
Maria Amundsen
Eivind Bjørkås
Sarah Eidsmo
Leif Grandum
Andreas Stranden Hoel-Holt
Jonas Jønsberg Lie
Magnus Digre Nord
Haakon Riekeles
Herman Ringdal
Ina Sandaker
Andreas Skulstad
Veronica Strøm
Harald Svartsund
Martin Ørbeck
Vegard Østli
Siri Bråten Øye
Philip Swanson
Forskning
Blogg
Om oss
Vistas historie
Masteroppgave
Jobb i Vista Analyse?
Kvalitetssikring
Rolleforståelse
Miljøhandlingsplan
Etiske retningslinjer
Kontakt
Kart
Søk
Søk
Søk
no
no
en
power_settings_new
VISTA ANALYSE
Nyheter
Nyheter
Nyheter
Vista i Media
Tjenester
Tjenester
Samfunnsøkonomisk analyse
Statistikk og empirisk analyse
Evalueringer
Kurs og foredrag
Lokal- og regionalanalyse
Modeller og databaser
Modeller og databaser
NOREG 2
Vista Analyses Ringvirkningsmodell
Strategi og prosessrådgivning
Kvalitetssikring, tvister og ekspertuttalelser
Utviklingssamarbeid
Bransjer
Bransjer
Kraft og energi
Miljø
Samferdsel
Velferd
Eiendom, bygg og anlegg
Fiskeri og havbruk
Service og handel
IKT og digitalisering
Klima og det grønne skiftet
Kultur og kreative næringer
Landbruk
Olje og gass
Lokal og regional utvikling
Reguleringer og konkurranseøkonomi
Skatter og offentlig økonomi
Publikasjoner
Medarbeidere
Medarbeidere
Orvika Rosnes
Daglig leder
Åsmund Sunde Valseth
Styreleder
Dag Morten Dalen
Partner
Michael Hoel
Partner
Rasmus Bøgh Holmen
Partner
Pernille Parmer
Partner
Ingeborg Rasmussen
Partner
Kristian Roksvaag
Partner
John Magne Skjelvik
Partner
Steinar Strøm
Partner
Sidsel Sverdrup
Partner
Hanne Toftdahl
Partner
Haakon Vennemo
Partner
Bård Solheim Andersen
Assosiert partner
Tor Homleid
Assosiert partner
Maria Amundsen
Eivind Bjørkås
Sarah Eidsmo
Leif Grandum
Andreas Stranden Hoel-Holt
Jonas Jønsberg Lie
Magnus Digre Nord
Haakon Riekeles
Herman Ringdal
Ina Sandaker
Andreas Skulstad
Veronica Strøm
Harald Svartsund
Martin Ørbeck
Vegard Østli
Siri Bråten Øye
Philip Swanson
Forskning
Blogg
Om oss
Om oss
Vistas historie
Masteroppgave
Jobb i Vista Analyse?
Kvalitetssikring
Rolleforståelse
Miljøhandlingsplan
Etiske retningslinjer
Kontakt
Kart
Vista Analyse AS © 2025
Meltzers gate 4, 0257 Oslo
Org.nr.: 968 236 342 MVA
+47 455 14 396
post@vista-analyse.no
www.vista-analyse.no
Rapport 2022/24
Interregional Diffusion in the Analytic Climate Economy
Andreas Stranden Hoel-Holt
Interregional Diffusion in the Analytic Climate Economy
Kategori
Rapporter
Underkategori(er)
Modeller og databaser
Klima og det grønne skiftet
År
2022
Rapportnummer
24
Forfatter(e)
Andreas Stranden Hoel-Holt
https://vista-analyse.no/no/publikasjoner/interregional-diffusion-in-the-analytic-climate-economy/
Last ned
file_download
(3.8 MB)
Les i nettleser
find_in_page
Content of this pdf is
searchable
Rapport 2022/ 24 | Masteropp gave Interregional Diffusion in the Analytic Climate Economy Andreas Stranden Hoel -Holt Interregional Diffusion in the Analytic Climate Economy Vista Analyse | Rapport 2022/24 Dokumentdetaljer Tittel Interregional Diffusion in the Analytic Climate Economy Rapportnummer Rapport 202 2/24 Forfattere Andreas Stranden Hoel -Holt ISBN 978 -82 -8126 -582 -0 Prosjektleder Orvika Rosnes Dato for ferdigstilling Mai 2022 Tilgjengelighet Offentlig Nøkkelord Klima og det grønne skiftet, modeller og databaser Om Vista Analyse Vista Analyse AS er et samfunnsfaglig analyseselskap med hovedvekt på økonomisk utredning, evaluering, rådgivning og forskning. Vi utfører oppdrag med høy faglig kvalitet, uavhengighet og integritet. Våre sentrale temaområder er klima, energi, samferdsel, næringsutvikling, byutvikling og velfe rd. Vista Analyse er vinner av Evalueringsprisen 2018. Våre medarbeidere har meget høy akademisk kompetanse og bred erfaring innenfor konsulentvirksomhet. Ved be- hov benytter vi et velutviklet nettverk med selskaper og ressurspersoner nasjonalt og internasj onalt. Selskapet er i sin helhet eiet av medarbeiderne. Interregional Diffusion in the Analytic Climate Economy Andreas Stranden Hoel-Holt Thesis submitted for the degree of Master in Economic Theory and Econometrics 30 credits Department of Economics Faculty of Social Sciences UNIVERSITY OF OSLO Spring 2022 Interregional Di↵usion in the Analytic Climate Economy Andreas Stranden Hoel-Holt © 2022 Andreas Stranden Hoel-Holt Supervisor: Christian Traeger Interregional Di↵usion in the Analytic Climate Economy http://www.duo.uio.no/ Printed: Reprosentralen, University of Oslo Acknowledgments Writing this sentence means a lot to me. It symbolizes that I have almost completed my thesis, thus wrapping up one of the more stimulating periods of my life so far. In navigating through this process, I have too often felt like the character Clark Griswold in the classic movie Christmas Vacation, trying to identify the broken bulb after decorating the entire house with lights and reindeer, only for his wife to discover that a silly mistake caused the whole issue. That is exactly what it feels like to calibrate a model. First, I must thank my genius supervisor Christian Traeger for giving me the opportunity to work closely with him on current research. You have been like a mentor for me the last couple of years, and I have learned a lot from you. I greatly appreciate all your help and support. I am happy for all the new friends I have made while studying at the University of Oslo. You have proved (by contradiction) that there indeed is increasing results to scale in the production of knowledge. I would also like to thank the participants of the very first Master Forum meeting at Blindern for helping my formulate my research question. A special shout out goes to Tor Odin who has been a great moral support even though he had his first-born child while writing his own thesis, and to Oliver who lent me his Acemoglu book. I might keep it. I am grateful to the INTPART programme for the scholarship they have given me. The same goes for the good people at Vista Analyse for providing me with a scholarship, lunch, an o�ce space and support through long days (and nights). A special thanks to Orvika Rosnes for her tips and advice and to Insa for helpful guidance and explanations of IEA data. Like any good story, I am saving the best for last. My girlfriend, wife, partner and baby-mama Tina. Thank you for pushing me to go after my goals and dreams, even if it means changing careers in my 30s and living o↵of L˚anekassen. You inspire me to be my best and I know for a fact that I could not have completed this thesis without your help and support. Thank you. EDSM. i Abstract In this thesis, I calibrate a North-South multi-sector integrated assessment model with ex- plicit energy production and analyze the consequences of technology di↵usion between regions. Using data from public sources, I sort countries into two regions based on income and degree of electrification. Then I calibrate five separate energy sectors and electricity that goes into the production of three final good sectors for each region. I introduce a simple exogenous inter- regional di↵usion mechanism to the base model. Then I apply this model to analyze the e↵ects of inter-regional di↵usion on the welfare in each region, emissions and temperature increase, the composition of energy use within the economies. I find the welfare e↵ect of di↵usion to be between 40 billion and 370 billion US dollars for the richer region. These e↵ects are only indirect, through lower global temperature and lower climate-related damages. The low-income region has a welfare e↵ect between 190 billion and 1800 billion US dollars. The energy composition and emissions of the richer region are not changing in di↵usion, so the welfare e↵ects on the low-income region are strictly local and direct. These results depend crucially on the potential for inter-fuel substitution within the production electricity, represented by the elasticity of substitution. This thesis contributes to the literature on specifically analytic types of integrated assessment models. Analytical models are easily interpretable and permit a large state-space with fast solution mechanism, which enables quick computation of model results. By calibrating the present model, I look to narrow the gap between the simplicity and transparency of analytical models, and the accuracy and richness of more complex numerical models. I hope that this work lays a foundation for further explorations of the possibilities within numerical use of analytical models. Contents 1 Introduction 1 2 Background 4 2.1 Integrated assessment models ............................. 4 2.2 Numerical IAMs analyzing the energy transition in developing countries ..... 5 2.3 Technological di↵usion models ............................. 6 2.4 Analytical IAMs .................................... 7 3 The Model 9 3.1 The Economy ...................................... 9 3.2 The Climate System .................................. 12 3.3 Technological Di↵usion ................................. 12 3.4 Sketch of model solution ................................ 13 4 Calibration and Data 15 4.1 Calibration procedure ................................. 15 4.2 Data sources ...................................... 15 4.2.1 Region classification .............................. 16 4.2.2 Volume data .................................. 16 4.2.3 Energy prices .................................. 19 4.2.4 Emissions and Carbon Prices ......................... 20 4.3 On Elasticities of Substitution ............................. 21 5Results 24 5.1 Calibration results ................................... 24 5.2 Model results ...................................... 25 5.2.1 Baseline and optimal tax ........................... 25 5.2.2 Di↵usion .................................... 26 5.2.3 Sensitivity analysis ............................... 35 6 Conclusion 38 A Mathematical derivations 45 A.1 Final goods aggregation ................................ 45 A.2 Final consumption good production ......................... 46 A.3 Intermediate energy and electricity producers .................... 47 A.4 Refined energy production ............................... 48 ii B A more general di↵usion model 50 C Supplementary figures 52 D Supplementary tables 55 E Wrangling script 58 F Calibration script 91 iii List of Figures 5.1 Output, emissions and temperature. ......................... 25 5.2 Energy by source .................................... 26 5.3 Energy by sector in region L ............................. 27 5.4 Energy by sector in region H ............................. 28 5.5 Output, emissions and temperature – with growth in renewable energy. ..... 28 5.6 Energy by source (w/ growth) ............................. 29 5.7 Energy by sector in region L (w/ growth) ...................... 30 5.8 Energy by sector in region H (w/ growth) ...................... 31 5.9 Growth rates of renewable energy technology by region (low di↵usion). ...... 31 5.10 Growth rates of renewable energy technology by region (high di↵usion). ..... 32 5.11 Output, emissions and temperature. No vs. high di↵usion. ............. 32 5.12 Energy by source (high di↵.) ............................. 33 5.13 Energy by sector in region L (high di↵.) ....................... 34 5.14 Energy by sector in region L (low substitutability) ................. 34 5.15 Output, emissions and temperature. No vs. high di↵usion. Low substitutability. 35 5.16 Energy by sector in region L (low substitutability) ................. 36 5.17 Output, emissions and temperature. No vs. high di↵usion. Low substitutability. 37 C.1 Output, emissions and temperature. No vs. low di↵usion. ............. 53 C.2 Energy by source (w/ growth) ............................. 53 C.3 Energy by sector in region L (w/ growth) ...................... 54 iv List of Tables 4.1 Parameters to calibrate – one set for each region .................. 16 4.2 Macroeconomic data .................................. 17 4.3 Energy units input-output table ............................ 19 4.4 Energy units conversion factors ............................ 20 4.5 CO 2coe�cients ..................................... 21 5.1 Calibrated parameters in base year. .......................... 24 D.1 List of countries in each region ............................ 55 v Chapter 1 Introduction Energy is the link between climate change and our welfare. For much of human history, we used a modest amount of energy. This changed during and after the industrial revolution. Anthro- progenic emissions increased as we discovered how to e↵ectively use coal instead of charcoal for fuel. With the later additions of oil products and natural gas, fossil fuels gradually replaced pre-industrial energy sources in all sectors in the industrialized world. However, that large-scale burning of relatively cheap fossil fuels does not come without consequences. The Intergovernmental Panel on Climate Change (IPCC) has since the early nineties pub- lished reports on the state of climate change. They are currently in their sixth assessment cycle (AR6) and published their latest reports not long before I am writing this sentence. The IPCC (Masson-Delmotte et al., 2021 ) finds that human activities already have caused climate change in all areas on the planet. The average global temperature is estimated to already be more than 1 degree Celcius above pre-industrial levels, and it is only increasing as we continue to break yearly emission records. The IPCC warns that we might cause irreversible changes to our planet, which can adversely a↵ect millions, if not billions of people (and other living creatures). Thus, there are huge potential welfare costs from climate change. The most straight-forward way to emit less is to consume and produce fewer carbon-intensive goods and services. However, reducing consumption by a marginal unit has di↵erent consequences depending on your existing level of consumption. For a rich person, skipping a vacation abroad or trading in a large SUV with an internal combustion engine (ICE) for a similar but electric vehicle (EV) may not matter much. This is especially true if ICEs and EVs become more similar means of transportation and their substitutability increases. For people with very low consumption, however, reducing consumption could mean to go hungry or worse. Countries have recognized this potential injustice and have agreed to financial transfers from wealthy to poor countries to help with emission mitigation and climate change adaptation (Harvey, 2021 ). Developing countries without access to modern infrastructure do not have to follow path of industrialized nations. They can potentially skip some of the fossil-fuel dependence that characterized the modern energy history of the industrialized world. Such a path of technology adoption is sometimes called technology leapfrogging. The argument is that falling prices for renewable sources, abundant local potential for renewable energy supply and political preference for avoidance of local pollution and foreign fossil fuel imports all point to a future in which growth in important sectors will be supplied emission-free in developing countries (Bond et al., 2020 , Bond et al., 2021 ). As a contrasting scenario, developing countries may travel along a path leading to so-called carbon lock-in. This term refers to the self-perpetuating path-dependency of a fossil-fuel based energy system. Network externalities, sunk investments into infrastructure, 1 capital vintages, habits, institutions and so on, ‘locks in’ fossil fuels as the main energy source, similar to what have been seen in the industrialized world (Unruh, 2000 ). There are many other potential futures, of course, but these to constitute two interesting future paths on each end of the spectrum of possibilities for a country transitioning from using traditional energy sources to modern ones. It is not energy use per se that causes emission, but the carbon intensity of the energy use. Therefore, if developing countries could transition from traditional energy sources to modern renewables, they could enjoy higher consumption without paying the cost in terms of carbon taxes or climate-related damages 1. Modern renewable energy systems require a lot of investment, political will, technology and knowledge that does not come for free, even in richer countries. But richer countries can make the energy transition in developing countries smoother by sharing technological knowledge. On the other side of the coin is the political economy of developing countries. It may (Bond et al., 2020 ) or may not (Newell and Pizer, 2003 )beinthebestinterest of incumbent leaders to invest in renewable energy systems, to import foreign resources or to allocate resources e�ciently. All these economical, political and technological factors are part of a technology- di↵usion mechanism, where knowledge, policy and ideas flow between countries. In this thesis, I calibrate a North-South multi-sector integrated assessment model (IAM) with explicit energy production and analyze the consequences of technology di↵usion between regions. Researchers use IAMs to analyze the interaction between the economy and the climate system in order to inform climate policy. Such models are used to estimate or calculate various important figures, such as the social cost of carbon (SCC), likely future emission paths, the cost of climate change adaption, the benefit of mitigation and so on. They are called integrated because they use models of the economy, the climate system, energy and sometimes agriculture and land use in a combined framework to analyze the complex connections between these areas, and because they combine insights from several di↵erent fields (IAM Consortium, 2022 ). Using data from several di↵erent public sources, I sort countries into two regions based on income and degree of electrification. Then I calibrate five separate energy sectors plus electricity that goes into the production of three final good sectors for each region. My motivation for calibrating this model is to analyze and quantify the sector- and fuel- dependent e↵ects of di↵erent policy scenarios. To do this, I introduce an exogenous inter-regional di↵usion mechanism to the base model, in which one region can import technology from another and improve their own technology levels. Then I apply this model to analyze the e↵ects of inter-regional di↵usion on the welfare in each region, emissions and temperature increase, the composition of energy use within the economies. This thesis contributes to the literature on specifically analytic types of integrated assessment models. These models have closed-form solutions which usually limits the functional form choice and descriptive accuracy compared to more complex numerical models. Analytical models are easily interpretable and permit a large state-space with fast solution mechanism, which is espe- cially important when analyzing issues like uncertainty – which I don’t go into in this thesis. By calibrating the present model, I look to slightly narrow the gap between the simplicity and transparency of analytical models, and the accuracy and richness of more detailed models. I hope that this work lays a foundation for further explorations of the possibilities within numerical use of analytical models. The rest of the thesis proceeds as follows: In chapter 2, I present the background and review the relevant literature on integrated assessment models, technological transitions and di↵usion and on analytical IAMs. In chapter 3, I explain the model, the theoretical assumptions and the motivation behind the model structure. I also introduce the di↵usion model. In chapter 4, I go through the calibration process. First, I explain the calibration process and list the 1Given that consumption goods also are produced with renewable or low-emission sources. 2 parameters I will calibrate. Second, I present the numerous data sources I use for calibration, and the assumptions and interpolations I make in cases of missing or incomplete data. Finally, I discuss how I pick the important elasticity of substitution parameters. In chapter 5, I discuss the calibration results and simplifying assumption I make in the calibration process. Then I discuss the numerical results of three main cases: (i) business-as-usual vs. optimal tax implementation; (ii) the e↵ects of technological growth in the renewable sector and; (iii) the welfare e↵ects of high and low technological di↵usion. I end the chapter with a brief sensitivity analysis. I conclude in chapter 6. I have collected detailed mathematical derivations, supplementary tables and figures and the programming codes in the Appendix. I use Matlab for all programming purposes: wrangling and compiling raw data for further analysis, missing data interpolations, sorting countries into regions, calculating the calibrated parameters, solving the model and running simulations. 3 Chapter 2 Background In this chapter I will first give a brief history and description of di↵erent kinds of IAMs. Second, I will give a short literature review on IAMs that analyze the energy transition in developing countries and those that use technological di↵usion models. Finally, I will give background and a literature review on analytical IAMs and place my contribution in context. 2.1 Integrated assessment models Integrated assessment modeling grew out of the 1970’s energy modeling community, as described in a nice field history by William Nordhaus ( 2011 ). The most well-known IAM is perhaps the DICE model for which the same Nordhaus ( 1993 ) was awarded the Nobel Memorial Prize in Economic Sciences in 2018. IAMs have not become less relevant since then: The IPCC (IPCC, 2001 ) uses several di↵erent IAMs in their most recent report on the mitigation of climate change, such as WITCH ( 2006 ), AIM (Fujimori et al., 2017 ) and MESSAGE-GLOBIOM (Krey et al., 2020 ). Some countries use IAMs to inform their local carbon tax policy, e.g., the Interagency Working Group on the Social Cost of Carbon in the US ( 2021 ) uses DICE, PAGE (Hope, 2006 ) and FUND (Waldho↵et al., 2014 ). IAMs come in many shapes and forms. There is no single framework that is best suited in all cases and for all uses. Which model type, solution method or assumptions to use all depend on the problem on hand. The IPCC (IPCC, 2001 ) gives a comprehensive and readable overview of IAM taxonomies 1. I will give a brief summary of the most relevant general distinctions they use. First, models have di↵erent solution methods. Simulation models specify equations and parameters to represent likely future paths of the economy and corresponding emissions, and analyze the di↵erent outcomes given expert specification of these parameters. Optimization models selects some control variables optimally given the constraints of the system in order to maximize utility (for cost-benefit analyses) or minimize system costs (for cost-e↵ectiveness analyses). The model on which I base this thesis, ACE (Traeger, 2022a ), is a cost-benefit based optimization model. Such models uses a damage function to close the feedback loop between the economy and the climate system, where economic activities require energy that generates emissions which increase temperatures, which in turn harms the economy and human welfare. But I will also evaluate potential future paths similar to simulation models, where I specify 1See also Farmer et al. ( 2015 ), Bosetti ( 2021 )andN.Stern( 2022 )forcomprehensivereviewsofthehistory, taxonomy and common critiques of IAMs. For detailed and pointed critiques, see Pindyck ( 2013 ,2017 )and Pindyck ( 2019 ) 4 di↵erent levels of di↵usion and inter-fuel substitutability. The benefit of using an optimization model as the basis for this analysis is that I can calculate the welfare e↵ects as the di↵erence between an optimal base-line path and a optimized variation on that path. Second, dynamics are handled di↵erently within the optimization models category. Inter- temporal dynamic models find the optimal path to follow to maximize the present utility value, or minimize the total discounted system costs. Such models can assume either assume perfect foresight, or allow for uncertain futures in which case agents maximize expected present values (see e.g. Traeger ( 2018 )). In contrast, recursive-dynamic models optimize within one period, but do so sequentially. The state of the world changes over time but the agents do not take into account the consequences their actions have on future states of the world and there is no trade-o↵between future and present. There are hybrid models that assume varying degrees of imperfect foresight. I use a inter-temporal dynamic model in this thesis. A final main distinction is whether the model relies on a general equilibrium framework where all prices in the economy adjust to equate supply and demand in every market, or if the researcher analyses a single or a few markets in a partial equilibrium while keeping the e↵ects on other markets constant. I use a general equilibrium framework in this thesis. In addition to the more technical di↵erences mentioned previously, models also vary in their degree of detail and underlying assumptions. The first version of DICE ( 1993 ), for example, was a global model, but it was later extended to the regional RICE (Nordhaus and Yang, 1996 ) model, increasing the level of detail. The current version of DICE has a single-good economy produced in each region with capital, labor and two di↵erent energy types. REMIND (Baumstark et al., 2021 ), however, uses the same basic macro-economic variables, but has a detailed bottom- up specification of the energy sector with more than 50 di↵erent technologies. AIM also has a detailed energy sector, but also has several di↵erent industrial and agricultural end-use sectors. Another regional model with a single-good economy is WITCH (Bosetti et al., 2006 ), but that model allow for endogenous investments in technology which captures strategic game-theoretic e↵ects between regions or groups of regions. 2.2 Numerical IAMs analyzing the energy transition in de- veloping countries There is a rich literature analyzing energy transition in the developing world using IAMs. Lucas et al. ( 2015 ) use the models in the LIMITS pro ject 2to analyze African emission scenarios under various assumptions. Using the same LIMITS framework McCOLLUM et al. ( 2013 ) find that most supply-side capital investments should flow to developing countries in the two-degree sce- nario. In particular, investments should shift from upstream fossil fuels to downstream electricity generation. There exist several other LIMITS pro ject papers (e.g. Van Der Zwaan et al. ( 2013 )). These papers are thorough and very useful for detailed insights in the necessary future energy system mix in developing countries, how to obtain that mix, and the corresponding emission paths. They also show through detailed modelling that the energy transition in developing coun- tries indeed is feasible. In the same spirit, Leimbach et al. ( 2018 ) quantify the costs and benefit of climate policy in Sub-Saharan Africa, using REMIND. Their context is the “favorable condi- tions” for renewable energy on the continent and they include international fossil fuels markets and technology di↵usion. They find emission pathways Sub-Saharan Africa consistent with two degrees warming at a net zero cost, given equitable burden sharing by international transfers. Clarke et al. ( 2012 ) explore how di↵erent models in the Asian Modeling Exercise (AME) vary in their energy system assumptions. Many of the models use production functions that are 2LIMITS is inter-model study of policies consistent with a maximum warming of maximum 2 degrees Celsius. 5 calibrated to base-year shares. Some models in AME vary parameters over time, allowing them to represent predicted changes in technology, infrastructure and so on. The paper includes a comprehensive overview of the implied constraints on and costs of key technologies and if (and how) base-year shares are calibrated in the models. All these models are much more complex and rich than the present model. However, they are solved numerically and in that respect di↵er from the present thesis. 2.3 Technological di↵usion models Zhang et al. ( 2020 ) augment REMIND to include regional technological improvement and dif- fusion. They ask how multi-level learning a↵ect the regional mitigation costs and technology di↵usion. This paper is an extension from a earlier paper by Zhang et al. ( 2014 ) that looked at di↵erent regional investment costs, but did not include multi-scale learning. Four di↵erent approaches are investigated: full international spillover, no spillovers and two intermediate cases with varying degree of market e�ciencies. The crucial exogenous parameter in their model is the learning rate. Gu et al. ( 2021 ) develop a numerical multi-sectoral and regional IAM that models bottom-up low-carbon technology di↵usion between regions and (exogenous) R&D investments. They use this model to identify the e↵ects endogenous technology transfer can have on optimal regional carbon emissions. The use only Cobb-Douglas or Leontief production functions. Cai et al. ( 2015 ) combines a top-down dynamic computable general equilibrium model with a bottom-up model of energy production and consumption. The result is a hybrid IAM called GTEM-C 3. They want to keep the general equilibrium framework, while permitting more realistic technological development. To do this they use constant ratios of elasticities of substitution for homothetic (CRESH) functions for a set of disaggregated energy technologies and household energy preferences. A CRESH function allows for heterogeneous substitutability between input factors in the same production functions. I use the simpler but more constraining constant elasticity of substitution (CES) production function. An interesting extension to the model in this thesis is try to introduce CRESH production functions. - Gu et al. ( 2021 ) analyze the possible carbon mitigation caused by technology di↵usion be- tween countries. The base model, CIECIA (Wang et al., 2016 ), is a multi-sector, multi-country general equilibrium model with a damage function, endogenous technology and free trade in capital and commodities. Gu et al. ( 2021 ) add a bottom-up technological di↵usion block to CIECIA in which every sector in each country search for, select, learn and imitate technology from corresponding sectors in other countries. First, sectors find the feasible imitable technolo- gies and then select among those to find imitation targets. The higher the intellectual property protection, the narrowed the imitation range becomes. Each imitation target is represented their “attractiviness”, or the magnitutude of the technology gap and the economic gap plus the severe- ness of path dependency. The selection is governed by a probability distribution where higher probability of selection are given to countries with higher attractiveness. After having selected a supplier country, the imitating country gets accelerated energy-saving R%D in the process technology for the given sector. Progress in “processing” is modeled by a looping stochastic logarithmic shock mechanism that a↵ect the intermediate input coe�cients in the production functions. The technology is self-selected by the sector if the shocks have caused lower unit costs. Analytical models are suited for analyzing uncertainty. Another interesting extension is to model inter-regional di↵usion more in line with their approach an incorporate uncertainty in 3GTEM-C is built on top of the Global Trade and Environment Model , which is the Global Trade Analysis Pro ject’s (GTAP) IAM 6 the di↵usion model. This is beyond the scope of this thesis, however. Furthermore, Gu et al. ( 2021 ) find that technology transfer has significant mitigation e↵ects. They analyze four di↵erent intellectual property regimes. The ideal regime is where low-carbon technologies are freely shared to the public. Decreasing the technology transfer threshold, so that more technology becomes imitable, will significantly increase di↵usion and mitigation. While this e↵ect is strongest for technology transfers from developed to developing countries, the authors point out the importance of technology sharing between developed countries as well. Finally, Gu et al. ( 2021 ) interact di↵usion with various exogenous R%D investment shares and find that the combination gives the highest mitigation, particularly in developing countries. Even with no patent barriers, a relatively low knowledge stock creates a drag on low-carbon technology progression in developing countries. 2.4 Analytical IAMs The complexity of all the models mentioned in earlier in this chapter require numerical solutions. Solving such large and detailed models became feasible only after the ma jor improvements in computing power during the final decades of the previous century. Analytic and semi-analytic models, in contrast, permit closed-form model solutions. Thus, they allow transparent analyses of the crucial trade-o↵s and economic mechanisms inherent in the problem of climate change. While the qualitative closed-forms expressions are often quantified to inform policy, the necessary analytic tractability requires closed-from solution, thereby limiting functional form choise and descriptive accuracy. Analytic models are especially useful when handling uncertainty 4. They permit large state- spaces that break the “Bellman curse-of-dimensionality”, referring to the exponentially increasing computing power needed when adding states in numerically solved models (see e.g. Traeger (2018 ) for a state-of-the-art analytical model of closely related structure, with uncertainty). An important landmark in the field was when Golosov et al. ( 2014 ), building on the analytic macro-model of Brock and Mirman ( 1972 ), included a heterogeneous energy sector with emission feedback into production damages 5. This flexible but robust framework has supported several extensions, such as a closed-form general equilibrium version of RICE (Hassler and Krusell, 2012 ), the pricing of uncertain catastrophic events (Gerlagh and Liski, 2018b ), game-theoretic approaches to time-inconsistent preferences (Gerlagh and Liski, 2018a ; Iverson and Karp, 2021 ) and distortionary fiscal policy (Barrage, 2019 ). Traeger ( 2022a ) made further progress by generalizing the economy, including the energy sector, while explicitly modeling and improving climate dynamics and thus enabling a clearer analysis of the economics of climate change. In the appendix of the same paper, Traeger proposes a production structure in which several sectors produce final goods in Cobb-Douglas function of capital, labor and an CES function of intermediate energy. Traeger ( 2022b ) further develops the multi-sector specification. The present thesis relies on the analytic structure in Traeger ( 2022a ) and production functions in Traeger ( 2022b ) to solve the inter-temporal optimization problem characterizing regionally optimal carbon prices 6. My main contributions are (i) to calibrate the production function 4Several early analytic contributions indeed focus on tackling uncertainty in climate-economic models (Pizer, 1999 ;Schauer, 1995 ). Later papers make use of linear-quadratic functions to obtain relevant closed-form expres- sions (Hoel and Karp, 2002 ;KarpandTraeger, 2021 ;KarpandZhang, 2006 ,2012 ). These are stylized benefit-cost models without production or energy sectors. 5Van Der Ploeg and Withagen ( 2014 )developedasimilarbutslightlymoregeneralmodelaroundthesame time. Other generalizations are found in Rezai and Van der Ploeg ( 2016 )andvandenBijgaartetal.( 2016 ) 6Iassumethatregionstakesintoaccountonlytheirownfuturedamages,notthedamagestootherregions. 7 proposed in Traeger ( 2022b ) (ii) to find, gather and clean the data used in this calibration exercise and (iii) to analyze the e↵ects on welfare and energy composition from technological di↵usion in a two-region version of the model. To my knowledge, this is the first analytical integrated assessment model calibrated to this level of detail. 8 Chapter 3 The Model The model is based on the ACE-model by Traeger ( 2022a ) with the multi-sector production function specification in Traeger ( 2022b ). In this chapter, I will first present the economy with the accompanying nested production function. Second, I give a brief explanation of the climate system. Third, I introduce a simple but general exogenous technological di↵usion model for the energy sectors across regions. Finally, I briefly explain how to solve the model. 3.1 The Economy There are two social planners in this model, one for each region j2 J = {L, H }. Region L is low-income and region H is high-income. There is no trade between the regions. They are connected (i) through the carbon-stock in the atmosphere, into which the fossil fuel energy sectors in both regions emit CO 2and (ii) by the exogenous di↵usion of technical knowledge from region H to regions L. Each social planner cares only about her own region’s consumption, but they a↵ect the other region’s welfare indirectly through the future damages inflicted on each other by climate-change related damages. If the social planners had a way to credibly commit, they could agree to lower their own emissions to the benefit of the other social planner, and to the potential net benefit for both social planners 1. I assume, however, that there are no such commitment vehicles, and that both social planners therefore have an incentive to free-ride on the other’s mitigation. Region H, however will be endowed with a positive but small price on emissions, to reflect the current state of carbon pricing in the World. It is in this setting I analyze di↵erent technological di↵usion scenarios and their welfare e↵ects. The social planners maximize their discounted infinite stream of (their own) utility from the consumption of an aggregated good max 1X t=0 �tlog Ct, (3.1) with the discount factor �= 11+ �⇡ 0.87, where the pure rate of time preference �determines how much the social planner discounts future utility, and is I crucial parameter in integrated assessment models (see e.g. Drupp et al. ( 2018 ) for an expert survey and discussion). I sup- press regional indexing jfor brevity, but will include it wherever necessary to avoid confusion. 1Even if the social planners could credibly commit, it is not given that commitment is in the best interest of their populations. 9 The single good ACE-model has simple logarithmic utility, which implies a unitary intertem- poral elasticity of substitution. The present model, as explained in the appendix to Traeger (2022a ), weakens this assumption by disaggregating consumption using the constant elasticity of substitution (CES) composite Yt= At ⇣X l2Nc al,t (cl,t)s⌘1s, (3.2) where P lal,t = 1 and the substitutability index s 1 indicating that all final consumption goods cl,t are necessary in consumption. The final goods are transportation, industry and other, with l2 Nc= {tr, in, ot }respectively. I choose these sectors because they approximately consume a third each of the total World energy consumption (International Energy Agency, 2019 ), and because they have di↵erent dominating energy inputs with varying degrees of potential interfuel substitutability. The constant Atmakes sure Ctis measured in calibration-period money metric utility units. Each final good sector have Cobb-Douglas production functions of technology Al,t, capital, Kl,t, labor Nl,t and the intermediate energy input dl,t cl,t = Al,tK↵ll,tN1�↵l�⌫l l,t d⌫ll,t, (3.3) where ⌫lis sector dependent. The overall production function must be homogeneous in capital to get a closed-form solution (Traeger, 2022a ), which means ↵⌘ ↵lmust be sector-independent. The intermediate energy good dl,t represents the energy composite used in production of final good l. It can be interpreted as a generalized mean of various refined energy inputs ei,l,t combined according to the CES production function dl,t = ˜Al,t ⇣X i2Nd ˜al,i,t e˜sll,i,t ⌘1˜sl 8l2Nd, (3.4) where ˜ al,i,t are CES share coe�cients with P i˜al,i,t = 1 for each sector, and where ˜Al,t is a constant turning the function money-metric in calibration-period USD. The notation ei,l,t reads ‘refined energy input iin sector lin period t’. The refined energy sources available to sector lis a sector-specific subset of Nd= {c, o, g, b, el }, the elements of which corresponds to coal, oil products, natural gas, bioenergy and electricity, respectively. Note that the substitutability parameter ˜ slis sector-dependent 2. The model can therefore distinguish between the arguably harder-to-substitute inputs to the transportation sector, where oil products especially in heavy transport currently dominates electricity, and the more substitutable other-sector, where fuels for e.g. heating are easier to switch out. Electricity production, indexed with both i= and l= and where ˜ a0,0,t= 0, happens in a special in-between transformation sector that uses refined energy from the set Ne= {c, o, g, b, r }, where ris renewable energy: e0,t= ˜A0,t ⇣X i2Ne ˜a0,i,t e0,i,t ⌘ 1˜s0,t, (3.5) 2An earlier version of the thesis had time-dependent substitutability as well. This feature allows the degree of substitution to increase over time. This is particularly interesting in the transportation sector, where we are inthe middle of a technological development that makes non-emission vehicles, ships and airplanes more similar totheir combustion engine counterparts. Kaya et al. ( 2017 )pointoutthatmanyIAMsine↵ectforcesapreservation of the technology mix. The reason is the use of constant elasticity of substitution (CES) production functions.This, argues Kaya et al. ( 2017 ), does not match with empirical data on historical di↵usive transitions. They suggest several methods to alleviate this issue, one of which is to allow the constant elasticity of substituion varyover time. I removed this feature, however, to simplify the present analysis. In general, substitutability can alsova r y b e twe e n r e g i o n s a n d t h i s m o d e l p e r m i t s i t . B u t I h ave l e f t t h i s f e a t u r e o u t f o r t h e s a m e r e a s o n . 10 with the CES coe�cients and the constant ˜A0,thave the same roles as the production function in ( 3.4 ). Electricity has the same notation as other refined energy inputs, but di↵er in inputs and functional form. The refined energy products coal, oil products, natural gas, bioenergy and renewable energy are all produced in the Cobb-Douglas-Leontief-hybrid production function of technology, ¯Ai,t, capital, ¯K, labor, ¯N and emissions Ei,t: ei,t = ¯Ai,t ¯K¯↵ii,t min �¯Ni,t,¯ai,tEi,t 1�¯↵i 8i2Ne, (3.6) where I define Ei,t ⌘ ¯Ni,t¯ai,t and where ¯ ai,t is a calibrated parameter making the units of labor and emissions comparable. The motivation for using this functional form merits some explanation. Traeger ( 2022b ) introduces the general production function ei,t = gi,t(¯Ai,t,¯Ki,t,¯Ni,t,E i,t), in- creasing in all inputs. If there is no saturation mechanism, cost or other constraint on Ei,t it will be a free factor in the absence of carbon pricing, which implies an infinite demand in optimum. This is not particularly realistic, however. Even with low global average carbon prices, we are not currently emitting infinite amounts of CO 2, nor have we ever done so. This warrants some sort of saturation in emissions. Traeger ( 2022b ) have several suggestions to ensure finite optimal factor demand, among them the functional form in equation ( 3.6). This specification ensures that labor and emissions are perfect complements in production of refined energy. Then, to get infinite emissions, one would need infinite labor in the fossil fuel sectors. The perfect comple- mentarity introduces an implicit price on emissions, which helps the model in reproducing a more realistic ‘business-as-usual’ scenario. Finally, note that the capital share of output, in this case ¯ ↵⌘ ¯↵i, must yet again be constant across refined energy, for the same reasons as explained above. Finally, to ensure that total supply equals total demand in each of the energy sectors, let ei,t = X l2Nc el,i,t 8i2Ne[Nd. The aggregate capital stock, Kt, does not depreciate fully over the decadal timestep but is allowed to persist as a stock in the economy, as introduced to analytical IAMs by Traeger (2022a ). Capital’s equation of motion is Kt+1 = It 1+ gk,t �k+gk,t were It= Yt[1�D(T1,t)]�Ct, where �kis the depreciation factor and gk,t is an exogenous approximation of the capital growth rate. The social planner distributes the accumulated capital optimally in each period. A fraction of GDP is destroyed each year by climate change related damages D(T1,t)=1 �exp [ �⇠0exp( ⇠1T1,t)+ ⇠0],⇠ 02R, (3.7) where T1,tis the increase in atmospheric temperature in period t, compared to year 1900. ⇠0 and ⇠1are damage parameters calibrated to Howard and Sterner ( 2017 ). While country per- capita income levels show some geographical correlation, I assume for simplicity that increasing temperature damages both regions in the same way. 3.2 The Climate System The climate system in this model is taken from Traeger ( 2022a ). Fossil-based energy production emits CO 2into the atmosphere where it accumulates and causes increased radiative forcing (or greenhouse e↵ect). This in turn increases atmospheric temperatures which causes damages. 11 Let the global CO 2-emissions in each period be Et⌘ EL,t +EH,t ,where Ej,t = P i2IdEj,i,t , and where I have collected fossil-based energy sources in the set Id. These emissions flow into the atmosphere, from where they can flow between di↵erent reservoirs in the carbon stock vector M t+1 = �M t+e1(Et+Eexot ), (3.8) where Eexot are exogenous global non-energy related emissions. e1is the unit vector reflecting that emissions initially only go into the atmosphere, and the transition matrix � governs carbon flow between reservoirs. Increasing levels of carbon in the atmosphere causes a greenhouse e↵ect, also called radiative forcing Ft= ⌘log M1,t+Gt Mpre log 2 , where M1,tis the level of CO 2in the atmosphere, Gtare exogenous non-CO 2emissions, Mpre is the pre-industrial level of atmospheric CO 2and ⌘is a parameter that captures the radiative forcing intensity. There are three temperature layers in the model: atmosphere and the upper and deep oceans, corresponding to i=1 ,2,3. The 0 th layer is defined to be the long-term equilibrium temperature in the atmosphere, which is increasing in the strength of the greenhouse e↵ect T0,t⌘ s ⌘Ft, and where climate sensitivity parameter scaptures the response of temperature equilibrium to a doubling of atmospheric CO 2levels compared to pre-industrial times. For the other layers, the temperature equation of motion is a non-linear mean of own- and adjacent temperatures Ti,t+1 = 1 ⇠ilog ⇣ (1��i,i+1 ��i,i�1)exp[ ⇠iTi,t] +�i,i+1 exp[ ⇠iw�1i Ti�1,t]+ �i,i�1exp[ ⇠iwi+1 Ti+1 ,t] ⌘ (3.9) with parameters ⇠1= log 2s ⇡ 14and ⇠i+1 = wi⇠i= Ti�1eqTieq ⇠i. The weight matrix � captures heat exchange between layers. There are only three layers, so �3,4= 0. Using this specification, atmospheric temperature is a↵ected by the current temperature, the long-term equilibrium tem- perature and the upper ocean temperature. The current atmospheric temperature enters the damage function in equation ( 3.7 ), which closes the economy-climate feedback loop. 3.3 Technological Di↵usion Remember equation ( 3.6 ) which for renewable energy ( i= ren ) reads eren,t = ¯Aren,t ¯K¯↵ren,t ¯N1�¯↵ ren,t , noting that renewable energy has no emissions (in energy production) so that min �¯Ni,t,¯ai,tEi,t = ¯Ni,t, and where ¯Aren,t is technology in production of renewable energy. Since the production func- tion is Cobb-Douglas, technological change is Hicks-neutral and will not be factor-augmenting. Growth in the absolute technology level will mean that more output can be produced for the same level of capital and labor. Furthermore, I let the technology levels for the other energy 12 sources be constant. This keeps the model as simple as possible while capturing that fast relative growth in renewable energy versus other sources (International Energy Agency, 2021b ). For a more general version of the model, see the Appendix. Define the growth rate of technology in renewable energy production as gt⌘ ¯Aren,t +1 � ¯Aren,t ¯Aren,t . (3.10) Then, let each region j2{ L, H }have the growth rate gj,t, capturing that the growth rates of renewable power technology can be di↵erent in di↵erent regions. Inspired by Acemoglu ( 2009 ), I propose the following model of technological di↵usion between the two-regions. Let region H be the world leader. Then, let gL,t = ✓LˆAL,t +�L and (3.11) gH,t = ✓H ˆAH,t +�H (3.12) where ˆAj,t ⌘ ¯AH,t �¯Aj,t ¯Aj,t 2[0,1) is the rate of di↵erence in technology levels in renewable energy production between the regions, expressed as a rate. The technology absorption rate or di↵usion parameter ✓j2[0,1] captures the varying degrees with which regions are able to import various technologies given their policies, institutions and other economic and social factors. This rate is exogenous in the current model, but it is possible to endogenize it as a function of e.g. human capital (see Acemoglu ( 2009 )). The absorption rate captures the delay or imperfectness with which technology becomes available across the world. For ✓j= 0, there is no di↵usion. For ✓j= 1 the region catch up to the World frontier without delay. For example, if the level of technology in region H is five times region L,✓L=0 .01 and �L= 0, then gL,t =0 .05. There is no di↵usion e↵ect for region H,since ˆAH,t = 0. The local innovation parameter �jdetermines the locally sourced growth rate in technology. It captures how fast a region uses it existing knowledge Ajto improve technology, remembering that technology here means relative to fossil fuels. 3.4 Sketch of model solution Traeger ( 2022a ) solves a version of the present model with a general production function. I will only give an heuristic explanation of his solution method and point the interested reader to his working paper for details. His closed-form solution relies on homogeneity of capital in the production functions using capital. Therefore, I will show that this requirement holds for this multi-sector model but that it restricts the parameter space of the model. To solve the model, Traeger ( 2022a ) makes use of the Bellman equation. Here, the control variables in each period are chosen by the social planner such that she (i) maximizes the sum of present-period utility and the discounted value of all future utility streams, and (ii) that the value of this maximization is equal in all periods. First, Traeger ( 2022a ) transforms all endogenous state variables such that their equations of motions become linear in the transformed states. This step is important, because it makes an a�ne solution to the Bellman equation possible. The first order conditions will then provide optimal controls that do not depend on the states but only on coe�cients of parameters and shadow values. Thus, when the optimal controls are inserted back into the Bellman equation, it is possible to collect terms so that the states are each a linear function of these coe�cients. Second, to make the Bellman equation hold in each period the state-coe�cients must all equal 0. The coe�cients are therefore manipulated so that this requirement holds, which will also provide the shadow values along the optimal path as function 13 of parameters only. Finally, one can solve for the optimal control paths also as functions of parameters only. It is the shadow value on the carbon stock that will, when transformed from utils to consumption units, inform the value of the social cost of carbon. The production function in this model has (for each region j) Yt= F(Al,t,K l,t,N l,t,dl,t)= At ⇣X l2Nc al,t (cl,t)s⌘1s= At ⇣X l2Nc al,t ⇣ Al,tK↵ll,tN1�↵l�⌫l l,t d⌫ll,t ⌘s⌘1s Then, multiply capital by F(Al,t,�K l,t,N l,t,dl,t)= Al,t (�K l,t)↵lN1�↵l�⌫l l,t d⌫ll,t If ¯↵i⌘ ¯↵then F(Al,t,�K l,t,N l,t,dl,t)= �¯↵At ⇣X l2Nc al,t ⇣ Al,tK↵ll,tN1�↵l�⌫l l,t d⌫ll,t ⌘s⌘1s = �¯↵F(Al,t,K l,t,N l,t,dl,t), which shows that the production function is homogeneous in capital if all sectors have the same ↵. One can use the same method to show that the production of the refined energy goods also are homogeneous in capital. 14 Chapter 4 Calibration and Data In chapter 3, the social planners allocated the resources in an optimal utility-maximizing way. To match this theoretical construct into a construct that permits the use of real data, I transform the social planner’s problems into the corresponding decentralized cost-minimization problem for representative firms. By doing so, I can derive their respective compensated demand equa- tions, which, when inverted, provides the equations for the calibration targets. For a detailed mathematical derivation of these equations, see Appendix A. This chapter proceeds as follows: First, I briefly explain the practical calibration process. Second, I list the parameters to be calibrated. Third, I present and discuss the di↵erent data I use. And finally, I discuss the most important but also most elusive production function parameters: the elasticities of substitution. The calibration results are in the next chapter. 4.1 Calibration procedure A significant part of this thesis is the calibration process. My first step in this process is to find and collect relevant data. Second, I clean and compile the data and read it into arrays and tables in Matlab. See Appendix E for the wrangling script. Third, I perform interpolations in cases where there is missing data. Fourth, I aggregate the data into the two regions I will use. Fifth, I use the regional arrays as inputs to the calibration equations in order to calculate the numerical values of the parameters. See Appendix Ffor the calibration script which is appended with the di↵usion model. I omit the graph-producing code. I calibrate a total of 44 parameters, see table 4.1 for an overview. These parameters are then fed into a numerical optimizer in Matlab (provided by my supervisor) along with an initial guess of the optimal solution controls, as informed by the data. The optimizer produces a result that should, if the calibration is done correctly, replicate the structure of the data as they were read into the calibration script initially. If the model do not reproduce the data, I search for bugs, typos, calculus-errors or similar until the calibration improves. See chapter 5.1 for a discussion of the final calibration results. 4.2 Data sources There is no single source that can provide up-to-date data covering all the needs in the calibration process. Therefore, I must collect data from several di↵erent sources, then pre-process and combine them to a usable form. All the data sources I use are based on country-level data, 15 Table 4.1: Parameters to calibrate – one set for each region Parameter Domain Explanation Equation ↵l⌘ ↵l 2Nc Capital share in final good sectors ( A.5 ) ⌫l l2Nc Energy share in final good sector l (A.4 ) ¯↵l⌘ ¯↵i 2Ne Capital share in energy production ( A.12 ) al,t l2Nc CES-shares in final good aggregation ( A.2 ) ˜al,i,t l2Nc,i 2Nd CES-shares in intermediate energy good ( A.7 ) ˜a0,i,t i2Ne CES-shares in electricity production ( A.8 ) At TFP in aggregation sector ( A.2 ) Al,t l2Nc TFP in final goods sector ( A.6 ) ˜Al,t l2Nc TFP intermediate energy sector ( A.7 ) ˜A0,t TFP in electricity sector ( A.8 ) ¯Ai,t i2Ne TFP in refined energy sector ( A.13 ) ¯ai,t i2Id Leontief parameter in energy production ( A.11 ) which means that my two-region model can be easily extended. The model is already calibrated to the RICE-regions and can, with some adjustments and additional data, be used as a country- level model. However, not all countries provide detailed enough data, so the calibration process rely on regional interpolations where necessary. The following section has the following structure: First, I set the income cut-o↵that defines the two regions. Second, I present the volume data sources. Third, I present price data sources and the conversions and assumptions I make. Finally, I calculate emission factors and the regional emission prices. 4.2.1 Region classification Countries are sorted into two regions: high income and low income, with corresponding region indices j= H and j= L. I would like to sort countries to the degree to which they use electricity, and use GDP per capita as a proxy. I sort the list of countries by PPP GDP per capita, and set the cut-o↵such that China with a GDP per capita in 2019 of 14 031 PPP USD is included in the group of high-income countries. This is contrary the common definition of developing’ and developed’ countries, where the cut-o↵normally is set higher. Excluding China, however, which has a very high degree of electrification (International Energy Agency, 2019 ) seems unnatural. India, a large country with a low degree of electrification, is then included in the low-income group, as are many African countries and poorer countries in South America and Asia. See table D.1 for a complete list of countries. 4.2.2 Volume data The base-year for calibration is 2019 and all gathered data corresponds to that year unless otherwise specified. I use the Penn World Tables (Feenstra et al., 2015 ) for data on country- level real GDP, capital stock and employment for 183 countries 1. All values are denoted in current purchasing power parities (PPP) in millions of 2017 US dollars, which enable cross- country comparisons in a given year (OECD and Eurostat, 2012 ). There are missing capital 1The Penn World Tables have only sparse data for average hours worked per year but good data for number of persons employed. I will therefore use the latter measurement of labor throughout. 16 and employment data for some smaller countries in the Penn World Tables. For these countries I use the regional average ratios of capital/GDP and employment/GDP for interpolation. The interpolating regions are based on the 12 RICE regions (Nordhaus and Yang, 1996 ). I find the average yearly growth rate of GDP between 2010 and 2019 by regressing log GDP on year for each region. I use this growth rate as total factor productivity (TFP) growth in the model, which I assume is falling over time. The socio-economic data is collected in table 4.2 . Table 4.2: Macroeconomic data Variable Unit Region L Region H No. Countries . 89 94 GDP Trillion PPP 2017USD 27,6 97,3 Capital stock Trillion PPP 2017USD 110 452 Employed Million 1553 1764 Emissions GtCO 2 6,7 27.5 Share of output Transport 0,07 0,05 Share of output Industry 0,44 0,42 Share of output Other 0,49 0,53 Share of labor Transport 0,06 0,06 Share of labor Industry 0,20 0,25 Share of labor Other 0,74 0,68 Share of capital Transport 0,06 0,06 Share of capital Industry 0,16 0,15 Share of capital Other 0,77 0,79 TFP growth rates . 3,1% 2,2% The Penn World tables do not have data per economic sector, only country-level GDP. GDP is a value-added concept, and is meant to measure the value added by all the economic activities within a country in a given period. The value added is defined as output minus the value of inter- mediate goods used in production, and GDP thus avoids double-counting economic activities. In my model, however, the three sectors are kept separate and do not provide inputs for each other except indirectly through the possibility of capital accumulation. The production of final good cl,t should therefore be interpreted as sector output less the value of the energy consumption good. But since the energy sectors do not use any intermediate goods, it holds that output and value added are equivalent measures in my model. However, I cannot use data for value added by economic sector to calibrate my model, nor only use output data. The first reason is that this will reduce the relative importance of sectors that in reality may use few intermediate goods but provide many services for other sectors in the economy. The second reason is that total output will exceed total GDP, which will double count production and therefore total emissions. My solution is to find output shares of total output by sectors using UN (United Nations Statistics Division, 2022 ) and WIOD data (Timmer et al., 2015 ). Then, I use these output shares to find sector shares of GDP in each region based on macro data from the Penn World Tables. UN and WIOD data cover in total 102 countries, and I use regional average interpolation for missing sec- tor share data. Some poorer countries’ shares do not sum to unity. The transport and industry shares are, however, of the same magnitude as in countries with better data, whereas the ‘other’ sector show significantly lower shares, resulting in a less-than-unity sum of shares. Therefore, I take the ‘other’ share to be the di↵erence between total economy output, transport and industry. This transformation does not matter for countries with good data, and a good second-best fix 17 for countries with inconsistent data. I have 2019 data for most countries, and less recent data for a few countries, with the oldest being from 2014. The sector shares are fairly stable over time, which means that older data shouldn’t be too far o↵the correct 2019 shares. To find labor per sector, I use a similar procedure as for output. I find country-level employ- ment shares using ILOSTAT data (International Labour Organization, 2022 ) and apply those share to total employment from the Penn World Tables to get labor per sector. ILOSTAT data covers 175 of the countries in the Penn World Tables. I use average regional interpolation for missing data. There are very few countries with su�ciently detailed capital stock data. The OECD ( 2022 ) has capital data per economic sector, which I use to find the shares of total capital stock going to transport, industry and other, and to calibrate capital’s share of output, ↵. Then, I apply these shares to the total capital stock from the Penn World Tables to find the value of capital per final goods sector. I use RICE regions for interpolation of other missing data categories, but this dataset only covers 29 OECD countries. Therefore, I use the OECD average capital shares for all countries with missing data which is obviously unrealistic. Remember, however, that ↵ must be independent of sector to keep analytic tractability. As an implication, the sector capital values are not really needed directly in the calibration. I use them only to check ex-post if the model reproduces the state of the World from the data. It is even more di�cult to find capital data for the energy refinement sectors than for the broader economic sectors. To my knowledge, there is no data for capital in bioenergy or renewable energy production. Investment data for renewables are abundant, but it is beyond the scope of this thesis to use the perpetual inventory method needed to convert investment flows to capital stocks. These capital data goes into the calibration of capital’s share in the production of the refined energy goods, ¯ ↵. Similar to ↵, also ¯ ↵ has to coincide across fuels to preserve tractability. Because of the mentioned lack of data, I use only fossil fuel data to calibrate ¯ ↵, and then extrapolate this parameter to bioenergy and renewables. This is perhaps not drastically unrealistic for advanced biofuel production in developed countries. Bioenergy in the poorest countries, however, often consist of agricultural waste, firewood and charcoal, which is probably much less capital intensive than fossil fuel and renewable production would be in those same countries. Furthermore, there are very few countries with detailed capital stock data in energy production, even when only considering fossil fuels. For the high-income region, I use the weighted average of US and Russian ¯ ↵. I get US capital data from US Bureau of Labor Statistics ( 2022 ). I could not find o�cial Russian data, and based the calculation on manually collected asset data from the largest Russian oil, gas, and coal companies using publicly available information (Investopedia, 2022 ). Because of the uncertainty in using this method, I give the Russian ¯ ↵only a 20% weight. For the low-income region, I use the Chinese ¯ ↵based on data from of Statistic of China ( 2021 ). Since China is not included in the low-income group, this will be an out-of-sample extrapolation. In conclusion, there are several sources of uncertainty surrounding the calibration of ¯ ↵. I use International Energy Agency ( 2019 ) data for energy volume balances. They provide an input-output table of energy flows between fuel sources and sector for 155 countries, and regional data for countries without individual entries. Production, imports, exports and supply changes make up the total energy supply in a country, which by definition has to equal total consumption. I divide total consumption into five groups: transport sector, industry sector, other sector, electricity sector and energy own use and losses. The latter group is the energy used in energy production itself plus losses from refinement and transport. I add this group to the other four sectors according to the relative fuel intensity of each sector. Coal, oil, natural gas and bioenergy are aggregated as such in the IEA data. I add nuclear energy, wind and solar to get an aggregated “renewable energy” input. I add electricity and heat to a single category as 18 Table 4.3: Energy units input-output table 12 Sector (region) Regions Coal Oil Natural Gas Bioenergy Renewable Electricity Transport (L) 64 2 068 19 648 792 1 168 282 323 799 147 864 Industry (L) 64 9 058 048 3 540 280 5 913 090 4 598 762 2 824 6 428 874 Other (L) 64 1 411 864 5 011 278 5 412 452 24 495 134 54 981 9 307 931 Electricity (L) 64 20 116 432 2 802 371 9 977 632 1 270 319 6 925 783 16 477 436 Transport (H) 78 1 342 78 848 891 5 278 595 4 022 266 1 519 620 Industry (H) 78 39 411 437 9 778 205 27 649 690 6 218 485 39 028 39 404 152 Other (H) 78 5 108 055 13 326 519 31 223 891 8 380 346 2 244 821 45 814 532 Electricity (H) 78 82 150 361 4 613 042 42 752 393 7 236 553 49 695 890 91 387 683 3 1International Energy Agency ( 2019 ). 2Units are tera joules (TJ).2Electricity in electricity production is an output. well. The processed results are in table 4.3 . There are fewer individual countries covered in the IEA data than in Penn World Tables, but the data still matches when aggregated into regions since the IEA as regionally aggregated data as well. 4.2.3 Energy prices Each energy source in this model is homogeneous and therefore will have a single price. There are of course many di↵erent refinement methods for oil (and coal and gas) which results in many di↵erent consumer products. Each of these products has di↵erent prices according to quality, transportation costs, regulation, market conditions and other factors. I use each variant’s share of total supply as weights wherever there are several prices in the data. I assume that both regions purchase fuels at the global weighted average prices, and later adjust these nominal prices with di↵erent regional purchasing power parity (PPP) price levels to match units with the Penn World Tables macro data. To create these regional price levels, I weigh the PPP price levels listed in the Penn World Tables for each country according to their GDP (in PPP) relative to the total GDP for that region. This adjustment corrects for the di↵erence in purchasing power between the high-income and low-income regions. I use the regional share of total demand as weights whenever there are regional or country-level prices instead of World prices in the data. Ideally, each region in the model would have local nominal prices but local price data is di�cult to find or very costly. It is not obvious that local prices, e.g. prices of Australian coal, only apply for that country or region since fuels are often traded on a global or super-regional market. Furthermore, I sort countries into regions based on GDP which does not necessarily group countries together based on geography or according to which regional fuel market they mostly trade in. Coal and natural gas prices are from bp ( 2021 ) and I get monthly oil product prices from the International Energy Agency ( n.d. ), converted to a yearly average. Renewable energy prices are more di�cult to find or conceptualize. To properly compare di↵erent energy sources in electricity production, the lifetime costs and benefits for each type should be included. This is the rationale for using the so-called levelized costs of electricity (LCOE) measure, which gives the present value for all costs including investments, operation, maintenance and fuel costs. It is the long-term break-even cost for an electricity plant. I use IRENA ( 2020 ) data to get world average LCOE for each type of renewable energy source. Then I find the single calibration renewable price by weighing each LCOE by share of total renewable production. An undesirable side-e↵ect of using 19 the LCOE only for renewables is that it might skew the relative prices in electricity production in favor of fossil fuels since the LCOE includes all costs, not only marginal fuel costs. Bioenergy prices are another source of uncertainty. I use the price of wood pellets in the US (Anna Simet, 2021 ) as a catch-all price. In developing countries, however, bioenergy is not necessarily commercial-grade but collected and used directly from local sources. This means that it is di�cult to find price data. One could use the price of labor, but it is not clear how many energy units get collected per work hour. Because of this, I assume for simplicity that bioenergy prices in the low-income region is half the high-income region price (in addition to the PPP adjustment between the regions). I convert the idiosyncratic price units to USD per GJ according to the conversion factors in table 4.4 . Table 4.4: Energy units conversion factors 1 Unit GJ 1 tonne of coal equivalent 29.3 1 barrel of oil products (basket 2) 5.34 1 million British thermal units (Btu) 1.06 1 000 gallons of ethanol 84.4 1 t wood pellets 18 1 MWh 3600 1https://www.justinto ols.com/unit-conversion/energy.php2bp ( 2021 ) 4.2.4 Emissions and Carbon Prices The energy use of each fuel eiis measured in Tera joules. I use the factors in table 4.5 to convert energy to CO 2emissions, Ei. Note that bioenergy has a non-zero conversion factor. The reason is that burning of non-renewable waste is included in this category in the IEA data. Waste incineration is a relatively small part of the total energy use in this category (about 5%), and only a share of that is non-renewable, but it is at least as carbon intensive as oil (U.S. Environmental Protection Agency, 2022 ). Therefore, I assume that biofuels have 1/20 the carbon intensity of oil to capture the non-zero emissions in this category. According to the IEA ( 2020 ), the total energy-related CO 2emissions were 33 .2 Gigatons in 2019. The energy volume data and emission factors I use gives a few percentage points too low emissions compared with the IEA estimates. The discrepancy probably comes from imprecise emissions factors. I increase all emission factors reported in table 4.5 correspondingly in order to match observed energy-related emissions exactly. This will preserves the within-fossil CO 2 intensities, but may cause a small bias in favor of renewable energy. The price of emissions vary between countries and regions. According to the World Bank (2021 ), 56 carbon pricing initiatives are implemented globally in 2019, covering about 14.5 % of global emissions. I weigh the price of each initiative with its covered share of global emissions. Based on this, I find the weighted average CO2 price of covered emissions as 2.75 USD per tonne of CO 2e (in 2017 USD). Only 14.5 % of total emissions are covered, so the average price for all emissions would be about 0.40 USD/tCO 2e. No countries in region Lhave pricing initiatives, so pEL= 0. Region H’s share of total emissions is about 80.7 %, which implies pEH ⇡ 2.75/0.807 ⇡ 0.50 USD/tCO 2e. I correct for PPP price levels in the calibration calculations. 20 Table 4.5: CO 2coe�cients Source tCO 2/TJ 1 Coal 91 Oil products 69 2 Natural gas 50 Biofuels 3.5 3 Renewables 0 1Source: EIA ( 2022 ), con- verted to units of TJ.2Simple average of diesel,gasoline, jet fuel, keroseneand heating oil.3ncludes non-renewablewaste incineration, whichcauses a positive coe�cient. For regions with a positive carbon tax, the price of emissions, pEi,t, should already be included in the end-use energy prices pei,t. The prices I find in the date are gross emission prices, though. Therefore, I add emissions prices to the observed price of energy. I calibrate dl,t according to pdl,tdl,t = pe0,tel,0,t+P i2Nd(pei,t +pEi,t)dl,t. I measure the intermediate energy good, dl,t, in USD which means I can normalize its prize, pdl,t, to 1. 4.3 On Elasticities of Substitution The CES production functions in the model, and therefore their corresponding calibration equa- tions, depend on the di↵erent elasticities of substitution between factor inputs, where 2�t⌘ 11�˜st. In production theory, the elasticity of substitution is heuristically defined as the ease with which a pair of input factors can be substituted for one another. The usual intuition is that �tmeasures the curvature of a given isoquant of the production function. This parameter is unambiguously defined for a two-factor production function. Blackorby and Russell ( 1981 ,1989 ) show that the proper generalization from two factors to nfactors is the Morishima elasticity of substitution, MES i,j = ✏j,i �✏i,i,where ✏i,i is factor i’s own price elasticity and ✏j,i the cross-price elasticity between the goods iand j. This elasticity is generally asymmetric, which means that MES i,j is not necessarily equal to MES j,i. However, as shown by Blackorby and Russell ( 1981 ,1989 ), the constant elasticity of substitution (CES) production function is equivalent to having symmetric MES. In the first ever meta-analysis on interfuel substitution estimates, converts the various elastic- ity concept into so-called shadow elasticity of substitution (SES), which is a symmetric cost-share weighted average of two asymmetric MES. The converted estimates can then be used directly in interfuel CES production functions. It is not clear, however, how to translate SES estimates between pairs of inputs to a n-good CES production function, since there is no obvious way to weigh each pair’s contribution to the overall elasticity of substitution. The estimates found in D. I. Stern ( 2012 ) are often greater than 1 which imply large potential for interfuel substi- tutability. However, as D. I. Stern ( 2012 ) points out, the estimates in the literature vary a lot depending on several decisions and contexts in the underlying studies: econometric estimation 2With the risk of using confusing notation, �tmeans elasticity of substitution here even if �denotes temperature di↵usion in a previous chapter. 21 methods, assumptions about technology, the amount of underlying data, and so on. Some es- timates in Stern’s ( 2012 ) meta-regression are significantly di↵erent from neither zero nor one, meaning that neither the Leontief, the Cobb-Douglas nor the gross substitutes case can be re- jected. Furthermore, the estimates are based on the local political context, market regulatory systems and factor availability. Local studies can thus not be easily extrapolated to other regions, which will be necessary in the aggregated regional model I use. These issues cause some concern for how precise the elasticities ‘picked from the literature’ will be. In analyses of climate change the time horizon is very long. Therefore, integrated assessment models should use long-run estimates of sustainability. Unfortunately, such estimates are scarce and most estimates in Stern’s ( 2012 ) meta-analysis are short-run. This poses an important and and di�cult question of how to extrapolate from short-run elasticities to those of longer time horizons. Because of these uncertainties, I will do significant sensitivity tests with respect to the di↵erent elasticities to identify how much the key results are a↵ected by di↵erent assumptions. As a baseline, I pick the elasticity of substitutions as follows, and I assume equal substitutabilities across both regions for simplicity: Transport: 0.2 . This is based on the limited substitution in transport found by Serletis et al. ( 2010a ). Bye et al. ( 2021 ) use a elasticity of 0.5 in the light-duty vehicle production function between ICE and EVs in their macroeconomic analysis climate regulations of the transportation sector. However, transportation in my model includes also aviation and shipping. There is currently impossible to do long-haul shipping, international flights or heavy-duty road freight transport using electricity, no matter the relative price change. This implies lower elasticity compared to the personal vehicle market. There are technological developments in short-haul good transport, ferries, and electric vehicles that could increase this parameter over time. Industry: 1 . Serletis et al. ( 2010a ) find limited substitutability in the industrial sector, except for some fuels in the UK. D. I. Stern ( 2012 ) and Papageorgiou et al. ( 2017 ), however, both find greater than unity substitution between most pairs of fuels. I pick an intermediate value of 1. An elasticity larger than 1 would imply that neither input is essential in production. This assumption currently seems unrealistic. There are some subindustries with very-hard-to-abate products which is currently impossible to produce without any fossil fuel input, such as cement and steel production (International Energy Agency, 2021a ). However, technological development, such as green steel (Vetter, 2021 ), could change this in the future. Other: 1.2 . Serletis et al. ( 2010b ) and Jadidzadeh and Serletis ( 2016 ) find elasticities in the US and Canadian residential and commercial sectors around 1, while Serletis et al. ( 2010a ) mostly find figures below 1. Wong et al. ( 2019 ), however, find elasticities mostly above unity. The energy use in the other sector is mainly heating, cooling, cooking, lighting and running machines and appliances in the commercial, residential and agricultural sectors. There already exists electrical alternatives to direct fossil use in these sectors, such as electric stoves instead of gas stoves, heat pumps instead of oil or gas heating, light bulbs instead of kerosene lamps. Electricity production: 1.8 . Kumar et al. ( 2015 ), Serletis et al. ( 2010a ,2010b ) and Pelli ( 2012 ) all find less-than-one estimates. There are several reasons: most plants can only run one fuel, local availability, intermittency, and complementary since fossil electricity is often used to produce solar panels and windmills (in the beginning). Papageorgiou et al. ( 2017 ), however find it at 1.8 using a more macroeconomic approach. Technically, there should be perfect substitutability between energy sources in the production of electricity, since all the inputs are identical. But there are definely idiosyncratic factors such as market regulations, resource availability, transmission constraints that hinders the full substitutability of factors. Moreover, di↵erent fuel sources have di↵erent technical and physical constraints. Renewable energy has variable production based on weather conditions and seasons, causing potential intermittency 22 issues in lack of su�cient storage capacity. And coal plants are expensive and time-consuming to start up and shut down, so they are best used as a peak-load input. Therefore, I pick an non-infinite elasticity, but larger than 1 to reflect that no sources should alone be necessary in production. Empirical estimates must necessarily be based on historical data, which pins down the func- tional form of the production functions today. But these functions may very well change in the future. For example, Xie and Hawkes ( 2015 ) find that the elasticity of substitution between oil and electricity in the Chinese transport sector has increased steadily between the 1980s and 2010. Bye et al. ( 2021 ) calibrate their model to a low present-day elasticity, but argue for a large expected increase in the substitutability between EVs and ICEs in Norway in the coming decades. Wong et al. ( 2019 ) find that the interfuel substitution in several Chinese sector becomes easier as the country steps up the energy ladder. I omit this feature from the present analysis. 23 Chapter 5 Results In this chapter I will first briefly present some of the calibrated parameters and discuss how I adjusted parameters that caused calibration issues. Then I will present graphical and numerical results from di↵erent model runs. 5.1 Calibration results The ⌫l’s in table 5.1 are calibrated as described in equation ( A.4 ). The Penn World Table has only data for capital, labor and GDP, not value of energy or resource rents. Thus, the directly calibrated ↵’s probably include some of energy’s value share. Therefore I correct these by subtracting the mean ⌫in the economy to get the results in table 5.1 . I could not find reliable capital data for refined energy production. The initial calculation gave ¯ ↵’s that were very high and close to 1. I could not get the model calibrated correctly when using the data-based values for ¯ ↵. Therefore, I adjusted them until the model better reproduced the calibration period data. The fit improved as the values approached zero, potentially signaling that the calibration process and model do not handle capital in refined energy correctly. Table 5.1: Calibrated parameters in base year. Explanation j= Lj = H ↵ Capital share in final goods production 0.209 0.336 ⌫tr Energy share in transport 0.454 0.334 ⌫in Energy share in industry 0.045 0.030 ⌫ot Energy share in other sector 0.066 0.025 ¯↵ Capital share in refined energy production 1 0.010 0.005 1Assumption. I also had to use another solution to calibrate ¯ athan equation ( A.11 ). This Leontief parameter is supposed to convert between labor in energy and emissions to match emissions data. However, it would convert low energy use to high emissions and could not reproduce emissions. Therefore, I replace ¯ aby the vector of emissions factors in table 4.5 . This will per definition convert energy units to CO 2and solves the calibration issue. Finally, I also had issues with the calibration of At. Both wages and output in all three final goods sectors were o↵by a fixed factor. I fixed it by multiplying Atby this factor. It was likely a bug causing this issue, but after these corrections 24 Output Emissions Temperature increase Figure 5.1: Output, emissions and temperature. the optimized model was able to reproduce the data and the solved tra jectories seems reasonable and robust. Further bug-testing was outside the scope of the thesis. 5.2 Model results In this section I will first discuss the di↵erence between the business-as-usual scenario and the optimal-tax scenario. This part will be brief, since it is not my main interest in this thesis. Second, I will present the results of low and high di↵usion. Finally, I will do a sensitivity analysis. 5.2.1 Baseline and optimal tax This section shows the di↵erence between the business-as-usual baseline scenario and the optimal- tax scenario. In the former, the economy is assumed to be structured similarly to the calibration period. In the latter, each of the social planners implements an optimal carbon tax. Both have no growth in energy producing sectors and no inter-regional di↵usion. The left panel in figure 5.1 shows that outputs in both regions are increasing exponentially over time. This is a factor of the positive but decreasing TFP growth rates in both economies (see table 4.2 ). Region H abates relatively much compared to region L as is seen in the middle panel. One explanation is that the optimal carbon tax is equal to the social cost of carbon within each economy 1. Still, even as a regional tax, the optimal tax causes the temperature increases to be moderate compared to the business-as-usual case, as seen in the right panel in figure 5.1 . Coal has the largest response to the optimal carbon tax in this model. Figure 5.2 shows that region L cuts coal-use almost in half, while it goes from being the most to the least used fuel in region H. The other fossil fuels fall in both regions, with oil falling the least. Waste-burning is a part of bioenergy here, which ceteris paribus should decrease its optimal usage after tax. However, there is a slight increase in both regions. One reason could be that it substitutes for more emission-intensive fuels. Renewables increases in both regions, but electricity production falls. The increase in renewable energy is not su�cient to replace the decline of fossil fuels. The di↵erence in magnitudes between the regions could be attributed to the di↵erent SCCs. 1This is not a general result, but a function of how much each region internalizes the cost caused on others by themselves. I have assumed that they only care about future generations within their regions, and not in otherregions. 25 Region L Region H Figure 5.2: Energy by source. Dotted lines are baseline and solid lines for the case with optimal tax. Note the di↵erence in scales. Region H has a high SCC and therefore abates more. Also, the emissions by the poorer and lower populated region L are relatively small. Therefore, they will not cause much temperature increase and thus little damages which implies a low SCC. Figures 5.3 and 5.4 show the energy use by sector in region L and H,respectively. These figures make the di↵erence in magnitudes of abatement even clearer. All sectors decrease the use of fossil fuels. The largest abatement e↵ect is in the electricity sectors. 5.2.2 Di↵usion Here I present three di↵erent comparisons. First, I compare the baseline scenario from the previous chapter to the present case with growth in renewable energy technology. Second and third, I change the baseline to be the renewable growth-case and compare it to a low- and high-di↵usion scenario, respectively. Technological growth and no di↵usion: The baseline scenario is identical to the previous chapter: no carbon tax, and no growth expect for total TFP growth. I set the inherent growth rates for renewable technology in region H as gH,t =2020 = �H,t =2020 =0 .009 in the first period, and in region L as the constant �L,t =0 .001 . These parameters are then aligned with the average growth rates of wind and solar PV as percentage of the electricity supply found in the analysis of renewable energy growth rates and S-shaped transitions by Cherp et al. ( 2021 ). I let gH,t decline by 2% each year after the year 2030 to capture that some developed countries could be past the inflection point on an S-shaped transition curve (Cherp et al., 2021 ). This means that gH,t =2050 =0 .006 and gH,t =2100 =0 .002. Developing countries in region L are currently further left on the S-curve. I assume that all technological growth in excess of �L,t are imported from region H. This mechanism is captured by the di↵usion parameter ✓L. In this first scenario Iset ✓L= and compare the scenario with technological growth to the no-growth baseline from the previous section. Figures 5.7 and 5.8 reveal that growth in renewable energy technology increases electricity production, as is to be expected. Furthermore, as seen most clearly in the lower right panel of 26 Region L: Energy use by sector Transport Industry Other Electricity Figure 5.3: Energy by sector in region L. Dotted lines are baseline and solid lines for the case with optimal tax. Note the di↵erence in scales. 27 Transport Industry Other Electricity Figure 5.4: Energy by sector in region H. Dotted lines are baseline and solid lines for the case with optimal tax. Note the di↵erence in scales. Output Emissions Temperature increase Figure 5.5: Output, emissions and temperature – with growth in renewable energy. 28 Region L Region H Figure 5.6: Energy by source with growth in renewable energy. Dotted lines are baseline and solid lines for the case with growth. Note the di↵erence in scales. figure 5.3 , the increase in renewable energy causes a transition away from the other inputs to electricity production. It is not clear whether the relatively large decrease of coal use in electricity production is due to its high emission intensity or its high initial share in production. Another interesting find is that oil use in transport is actually increasing. This is likely due to the inter-fuel complementarity in the transportation sector. The production functions are not nested between fuels, and all inputs enter on the same level. Therefore, electricity and oil are complements for an elasticity of substitution < 1. An interesting extension could be to introduce time-changing elasticity in the transportation sector to analyze how this relationship can change over time. However, total oil use decreases in both regions, as seen in figure 5.6 . Output in both regions increases and emissions decreases, causing a reduction in temperature increase. To get the the welfare in utils for both regions, I utilize the ACE numerical optimization script in Matlab. I calculate the sum of discounted welfare in each period of the planning horizon, which is 200 year. This gives me the approximate net present value of the scenario. Then I take the di↵erent of this net present value in utils and convert it to consumption equivalents in USD. I calculate the welfare e↵ect of the assumed growth in renewable technology to be ⇡ 10 trillion USD for region H and ⇡ 0.9 trillion USD for region L, compared to the no-growth baseline. Low and high di↵usion: The new baseline is the previous case with growth in renewables, but without di↵usion. Now I analyse two cases and compare them to the local-growth-only baseline. The results are qualitatively similar, so I only present figures for the high case here since they give clearer visual e↵ects, and put figures for the low case in the Appendix for completeness. Iset ✓L=0 .0001 in the low case, and ✓L=0 .002 in the high case. The rate of di↵erence in renewable technology levels between H and L,¯AL,t ,is ⇡ 3.5 in 2020 for the low case. This means that gL,t =0 .0001 ⇤3.5+0 .001 = 0 ,00135 in the first period. Figures 5.9 and 5.10 reveal some interesting dynamics. Firstly, growth in region H is initially 29 Transport Industry Other Electricity Figure 5.7: Energy by sector in region L. Dotted lines are baseline and solid lines for the case with growth. Note the di↵erence in scales. 30 Transport Industry Other Electricity Figure 5.8: Energy by sector in region H. Dotted lines are baseline and solid lines for the case with growth. Note the di↵erence in scales. Growth rate in renewable energy Figure 5.9: Growth rates of renewable energy technology by region (low di↵usion). 31 Growth rate in renewable energy Figure 5.10: Growth rates of renewable energy technology by region (high di↵usion). Output Emissions Temperature increase Figure 5.11: Output, emissions and temperature. No vs. high di↵usion. 32 Region L Region H Figure 5.12: Energy by source with growth in renewable energy. Dotted lines are with no di↵usion and solid lines for high di↵usion. Note the di↵erence in scales. high, whereby it declines gradually at 2% a year in both scenarios. Secondly, for the high-di↵usion case, growth in region L becomes higher than in region H and stays so for the remainder of the time horizon. This is partly an e↵ect of the constant �L,t =0 .001, which introduces a minor inconsistency into the analysis. Without that, the growth rates should both converge to zero. More importantly, the higher growth rate captures the catching-up e↵ect, where technologically lagging regions experiences faster growth that developed regions, because they can quickly gain technological progress by using existing innovations instead. The right panel of figure 5.12 shows that there are no e↵ects on energy production in region H, with the solid lines covering the dashed lines. Region H’s emissions and output also stay identical as evident from figure 5.11 . However, there is a positive welfare e↵ect in region H which I calculate to be about 40 billion USD for the low case and around 370 billion USD in the high case. This comes from the indirect e↵ect on region H welfare through lower emissions from region L. This in turn gives a lower increase in temperature which increases welfare in region H, as is seen the last panel in figure 5.11 . The di↵usion e↵ect increases electricity use in region Land amplifies the qualitative e↵ects from introducing growth alone (see figures 5.12 and 5.13 ). The welfare e↵ect to region L is about 190 billion USD in the low case and 1800 billion USD in the high case. There are significant gains to be made for both regions by increasing di↵usion. I find the welfare e↵ect of di↵usion to be between 40 billion and 370 billion USD dollars for the richer region. These e↵ects are only indirect, through lower global temperature and lower climate- related damages. The low-income region has a welfare e↵ect between 190 billion and 1800 billion USD. The energy composition and emissions of the richer region are not decreasing in di↵usion, so the welfare e↵ects on the low-income region is strictly local and direct. Next is to do a sensitivity analysis of these results with respect to the elasticities of substitution. 33 Transport Industry Other Electricity Figure 5.13: Energy by sector in region L. Dotted lines are with no di↵usion and solid lines for high di↵usion. Note the di↵erence in scales. Transport Industry Other Electricity Figure 5.14: Energy by sector in region L, with low substitutability in the electricity sector. Dotted lines are with no di↵usion and solid lines for high di↵usion. Note the di↵erence in scales. 34 Output Emissions Temperature increase Figure 5.15: Output, emissions and temperature. No vs. high di↵usion. Low substitutability. 5.2.3 Sensitivity analysis In this sensitivity analysis I use the high-di↵usion case as the baseline and then vary the elastici- ties of substitution. In the first scenario I decrease the elasticity of substitution in the electricity sector from 1.8 to just below unity. The results are striking, but maybe expected. For a below- unity substitutability, the inputs in the electricity sector are gross complements. Thus, increasing the use of one factor will increase the use of all other factors to keep output constant. The e↵ects of this is apparent in the bottom right panel of figure 5.14 . The implied increase in in fossil fuels increase region L’s emissions, thus resulting in a negative welfare e↵ect of di↵usion for region H. The net benefit is still positive, but I expect it to decrease in lower inter-fuel substitutability. This e↵ect also relies on the functional forms imposed by the model. Numerical models often use nested pairs of CES production functions to have a more flexible hierarchy of inputs, and to allow varying degrees of substitutability between inputs. The present production function has all inputs in one level which preserves notational tractability and readability but that comes at the cost of a more flexible production function. The second sensitivity analysis I make is to increase the elasticity of substitution in transport from 0.2 to 0.5, capturing the potential for a fast global transition to electric or hydrogen fuel cell based transportation 2The results can be seen in figures 5.16 and 5.17 . The energy mix is not very sensitive to the transportation elasticity. There is a slight decrease in oil use in the transportation sector compared to the base case, but not enough to change welfare e↵ects much. The CES production reproduces value shares given the calibrated share. Since oil has a very large current share (around 95% globally), I do not expect to see large changes in oil until the elasticity of substitution increases above unity. 2Green hydrogen is made by electrolysis, a electricity-intensive production process. Thus hydrogen and elec- tricity are equivalent energy carriers in my model. 35 Transport Industry Other Electricity Figure 5.16: Energy by sector in region L, with low substitutability in the electricity sector. Dotted lines are with no di↵usion and solid lines for high di↵usion. Note the di↵erence in scales. 36 Output Emissions Temperature increase Figure 5.17: Output, emissions and temperature. No vs. high di↵usion. Low substitutability. 37 Chapter 6 Conclusion In this thesis I have attempted to find the e↵ects on the energy composition and welfare of technological di↵usion between regions. To quantify these e↵ects, I calibrated a state-of-the- art analytical integrated assessment model from scratch and introduced a simple technological di↵usion mechanism in renewable energy to the base model. I found that there are significant welfare gains to be made for both regions by increasing technological di↵usion. I estimate the welfare e↵ects of di↵usion to be between 40 billion and 370 billion US dollars for the richer regionm depending on the degree of di↵usion. These e↵ects are indirect to the region, and comes only through lower global temperature and lower climate- related damages. The low-income region has a welfare e↵ect between 190 billion and 1800 billion USD. The energy composition and emissions of the richer region are not decreasing in di↵usion, so the welfare e↵ects on the low-income region is strictly local and direct. These results depend crucially, however, on the inter-fuel elasticity of substitution in the electricity-producing sector in the receiving economy. If renewable energy is a gross complement to fossil fuels in electricity production, emission increases and the welfare e↵ect for the richer region turns negative. This thesis has made a contribution to the literature on analytical integrated assessment models and I have narrowed the gap between analytic and numerical models. There are sev- eral interesting extensions to make in future research. First, one could make the technological di↵usion model more realistic either by using other functional forms, such as logistic growth functions, or by endogenizing technology investment. Second, implementing dynamic elastici- ties of substitution has the potential to capture future transitions in transportation, electricity production and industry. 38 Bibliography Acemoglu, D. (2009). Introduction to Modern Economic Growth . Princeton University Press. Anna Simet. (2021). A Resilient Year . Biomassmagazine.com. Retrieved May 11, 2022, from http://biomassmagazine.com/articles/17970/a- resilient- year Barrage, L. (2019). Optimal Dynamic Carbon Taxes in a Climate–Economy Model with Dis- tortionary Fiscal Policy. The Review of Economic Studies , rdz055. https://doi.org/10. 1093/restud/rdz055 Baumstark, L., Bauer, N., Benke, F., Bertram, C., Bi, S., Gong, C. C., Dietrich, J. P., Dirnaich- ner, A., Giannousakis, A., Hilaire, J., Klein, D., Koch, J., Leimbach, M., Levesque, A., Madeddu, S., Malik, A., Merfort, A., Merfort, L., Odenweller, A., . . . Luderer, G. (2021). REMIND2.1: Transformation and innovation dynamics of the energy-economic system within climate and sustainability limits. Geoscientific Model Development ,14 (10), 6571– 6603. https://doi.org/10.5194/gmd- 14- 6571- 2021 Blackorby, C., & Russell, R. R. (1981). The Morishima Elasticity of Substitution; Symmetry, Constancy, Separability, and its Relationship to the Hicks and Allen Elasticities. The Review of Economic Studies ,48 (1), 147. https://doi.org/10.2307/2297127 Blackorby, C., & Russell, R. R. (1989). Will the Real Elasticity of Substitution Please Stand Up? (A Comparison of the Allen/Uzawa and Morishima Elasticities). The American Economic Review ,79 (4), 882–888. Bond, K., Arunabha Ghosh, Edward Vaughan, & Harry Benham. (2021). Reach for the sun: The emerging market electricity leapfrog . Carbon Tracker. London. Bond, K., Edward Vaughan, & Harry Benham. (2020). Nothing to lose but your chains: The emerging market transport leapfrog . Carbon Tracker. London. Bosetti, V. (2021). Integrated Assessment Models for Climate Change. In Oxford Research Ency- clopedia of Economics and Finance . Oxford University Press. https://doi.org/10.1093/ acrefore/9780190625979.013.572 Bosetti, V., Carraro, C., Galeotti, M., Massetti, E., & Tavoni, M. (2006). WITCH - A World Induced Technical Change Hybrid Model. SSRN Electronic Journal .https://doi.org/10. 2139/ssrn.948382 bp. (2021). Statistical Review of World Energy . bp. Retrieved May 2, 2022, from https://www. bp.com/en/global/corporate/energy- economics/statistical- review- of- world- energy.html Brock, W. A., & Mirman, L. J. (1972). Optimal economic growth and uncertainty: The discounted case. Journal of Economic Theory ,4(3), 479–513. https : / / doi . org / 10 . 1016 / 0022 - 0531(72)90135- 4 Bye, B., Kaushal, K. R., Rosnes, O., Turner, K., & Yonezawa, H. (2021). The road to a low emission society: Costs of interacting climate regulations, 42. Cai, Y., Newth, D., Finnigan, J., & Gunasekera, D. (2015). A hybrid energy-economy model for global integrated assessment of climate change, carbon mitigation and energy transfor- mation. Applied Energy ,148 , 381–395. https://doi.org/10.1016/j.apenergy.2015.03.106 39 Cherp, A., Vinichenko, V., Tosun, J., Gordon, J. A., & Jewell, J. (2021). National growth dynam- ics of wind and solar power compared to the growth required for global climate targets. Nature Energy ,6(7), 742–754. https://doi.org/10.1038/s41560- 021- 00863- 0 Clarke, L., Krey, V., Weyant, J., & Chaturvedi, V. (2012). Regional energy system variation in global models: Results from the Asian Modeling Exercise scenarios. Energy Economics , 34 , S293–S305. https://doi.org/10.1016/j.eneco.2012.07.018 Drupp, M. A., Freeman, M. C., Groom, B., & Nesje, F. (2018). Discounting Disentangled. Amer- ican Economic Journal: Economic Policy ,10 (4), 109–134. https://doi.org/10.1257/pol. 20160240 EIA - U.S. Energy Information Administration. (2022). Carbon Dioxide Emissions Coe�cients . Retrieved May 2, 2022, from https://www.eia.gov/environment/emissions/co2 vol mass. php Farmer, J. D., Hepburn, C., Mealy, P., & Teytelboym, A. (2015). A Third Wave in the Economics of Climate Change. Environmental and Resource Economics ,62 (2), 329–357. https : //doi.org/10.1007/s10640- 015- 9965- 2 Feenstra, R. C., Inklaar, R., & Timmer, M. P. (2015). The Next Generation of the Penn World Table. American Economic Review ,105 (10). www.ggdc.net/pwt Fujimori, S., Masui, T., & Matsuoka, Y. (2017). AIM/CGE V2.0 Model Formula. In S. Fuji- mori, M. Kainuma, & T. Masui (Eds.), Post-2020 Climate Action: Global and Asian Perspectives (pp. 201–303). Springer. https://doi.org/10.1007/978- 981- 10- 3869- 3 12 Gerlagh, R., & Liski, M. (2018a). Consistent climate policies. Journal of the European Economic Association ,16 (1), 1–44. https://doi.org/10.1093/jeea/jvx010 Gerlagh, R., & Liski, M. (2018b). Carbon Prices for The Next Hundred Years. The Economic Journal ,128 (609), 728–757. https://doi.org/10.1111/eco j.12436 Golosov, M., Hassler, J., Krusell, P., & Tsyvinski, A. (2014). Optimal Taxes on Fossil Fuel in General Equilibrium. Econometrica ,82 (1), 41–88. Gu, G., Wang, Z., & Wu, L. (2021). Carbon emission reductions under global low-carbon tech- nology transfer and its policy mix with R&D improvement. Energy ,216 , 119300. https: //doi.org/10.1016/j.energy.2020.119300 Harvey, F. (2021). What are the key points of the Glasgow climate pact? [newspaper]. The Guardian: Environment . Retrieved May 20, 2022, from https://www.theguardian.com/ environment/2021/nov/14/what- are- the- key- points- of- the- glasgow- climate- pact- cop26 Hassler, J., & Krusell, P. (2012). ECONOMICS AND CLIMATE CHANGE: INTEGRATED ASSESSMENT IN A MULTI-REGION WORLD. Journal of the European Economic Association ,10 (5), 974–1000. https://doi.org/10.1111/j.1542- 4774.2012.01082.x Hoel, M., & Karp, L. (2002). Taxes versus quotas for a stock pollutant. Resource and Energy Economics , 18. Hope, C. (2006). The Marginal Impact of CO2 from PAGE2002: An Integrated Assessment Model Incorporating the IPCC’s Five Reasons for Concern. The Integrated Assessment Journal ,6(1), 19–56. https://www3.nd.edu/ ⇠nmark/Climate/Hope 2006.pdf Howard, P. H., & Sterner, T. (2017). Few and Not So Far Between: A Meta-analysis of Climate Damage Estimates. Environmental and Resource Economics ,68 (1), 197–225. https : / / doi.org/10.1007/s10640- 017- 0166- z IAM Consortium. (2022). IAMC wiki - IAMC-Documentation . Retrieved May 21, 2022, from https://www.iamcdocumentation.eu/index.php/IAMC wiki Interagency Working Group on Social Cost of Greenhouse Gases. (2021). Technical Support Document: Social Cost of Carbon, Methane, https://www.whitehouse.gov/wp- content/ uploads/2021/02/TechnicalSupportDocument SocialCostofCarbonMethaneNitrousOxide. pdf 40 International Energy Agency. (n.d.). Prices – Key World Energy Statistics 2020 – Analysis . IEA. Retrieved May 11, 2022, from https://www.iea.org/reports/key- world- energy- statistics- 2020/prices International Energy Agency. (2019). Data and statistics . IEA. Retrieved May 9, 2022, from https://www.iea.org International Energy Agency. (2020, June 16). Global Energy Review 2019: The latest trends in energy and emissions in 2019 .OECD. https://doi.org/10.1787/90c8c125- en International Energy Agency. (2021a). Net Zero by 2050 - A Roadmap for the Global Energy Sector . International Energy Agency. (2021b). Renewables 2021 - Analysis and forecast to 2026, 175. International Labour Organization. (2022). ILOSTAT . Data. Retrieved March 30, 2022, from https://ilostat.ilo.org/data/ Investopedia. (2022). Markets Today . Investopedia. Retrieved May 9, 2022, from https : / / www . investopedia.com/markets/ IPCC. (2001). Working Group III: Mitigation - 7.6.4 Integrated Assessment Models .IPCC- Intergovernmental Panel on Climate Change. Retrieved February 15, 2022, from https: //archive.ipcc.ch/ipccreports/tar/wg3/index.php?idp=311 IRENA. (2020). Renewable Power Generation Costs 2020, 180. https://www.irena.org/- /media/ Files / IRENA / Agency / Publication / 2021 / Jun / IRENA Power Generation Costs 2020 . pdf Iverson, T., & Karp, L. (2021). Carbon Taxes and Climate Commitment with Non-constant Time Preference. The Review of Economic Studies ,88 (2), 764–799. https://doi.org/10.1093/ restud/rdaa048 Jadidzadeh, A., & Serletis, A. (2016). Sectoral Interfuel Substitution in Canada: An Application of NQ Flexible Functional Forms. The Energy Journal ,37 (2). https://doi.org/10.5547/ 01956574.37.2.a jad Karp, L., & Traeger, C. P. (2021). Smart Cap. SSRN Electronic Journal .https : / / doi . org / 10 . 2139/ssrn.3798938 Karp, L., & Zhang, J. (2006). Regulation with anticipated learning about environmental damages. Journal of Environmental Economics and Management ,51 (3), 259–279. https://doi.org/ 10.1016/j.jeem.2005.09.006 Karp, L., & Zhang, J. (2012). Taxes versus quantities for a stock pollutant with endogenous abatement costs and asymmetric information. Economic Theory ,49 (2), 371–409. https: //doi.org/10.1007/s00199- 010- 0561- y Kaya, A., Csala, D., & Sgouridis, S. (2017). Constant elasticity of substitution functions for energy modeling in general equilibrium integrated assessment models: A critical review and recommendations. Climatic Change ,145 (1-2), 27–40. https : / / doi . org / 10 . 1007 / s10584- 017- 2077- y Klump, R., McAdam, P., & Willmann, A. (2011). The normalized CES production function: Theory and empirics (No. 1294). European Central Bank. Krey, V., Havlik, P., Kishimoto, P., Fricko, O., Zilliacus, J., Gidden, M., Strubegger, M., Kar- tasasmita, G., Ermolieva, T., Forsell, N., Guo, F., Gusti, M., Huppmann, D., Johnson, N., Kikstra, J., Kindermann, G., Kolp, P., Lovat, F., McCollum, D., . . . Riahi, K. (2020). MESSAGEix-GLOBIOM Documentation - 2020 release. https : / / doi . org / 10 . 22022 / IACC/03- 2021.17115 Kumar, S., Fujii, H., & Managi, S. (2015). Substitute or complement? Assessing renewable and nonrenewable energy in OECD countries. Applied Economics ,47 (14), 1438–1459. https: //doi.org/10.1080/00036846.2014.997922 41 Leimbach, M., Roming, N., Schultes, A., & Schwerho↵, G. (2018). Long-Term Development Perspectives of Sub-Saharan Africa under Climate Policies. Ecological Economics ,144 , 148–159. https://doi.org/10.1016/j.ecolecon.2017.07.033 Lucas, P. L., Nielsen, J., Calvin, K., L. McCollum, D., Marangoni, G., Strefler, J., van der Zwaan, B. C., & van Vuuren, D. P. (2015). Future energy system challenges for Africa: Insights from Integrated Assessment Models. Energy Policy ,86 , 705–717. https : / / doi . org / 10 . 1016/j.enpol.2015.08.017 Masson-Delmotte, V., Zhai, P., Pirani, A., Connors, S. L., P´ean, C., Berger, S., Caud, N., Chen, Y., Goldfarb, L., Gomis, M. I., Huang, M., Leitzell, K., Lonnoy, E., Matthews, J. B. R., Maycock, T. K., Waterfield, T., Yelek¸ci, ¨O., Yu, R., & Zhou, B. (Eds.). (2021). Summary for policymakers. In Climate Change 2021: The Physical Science Basis. Contribution of Working Group I to the Sixth Assessment Report of the Intergovernmental Panel on Climate Change . Cambridge University Press. McCOLLUM, D., Nagai, Y., Riahi, K., Marangoni, G., Calvin, K., Pietzcker, R., Van Vliet, J., & Van Der Zwaan, B. (2013). ENERGY INVESTMENTS UNDER CLIMATE POLICY: A COMPARISON OF GLOBAL MODELS. Climate Change Economics ,04 (04), 1340010. https://doi.org/10.1142/S2010007813400101 Newell, R. G., & Pizer, W. A. (2003). Regulating stock externalities under uncertainty. Journal of Environmental Economics and Management ,45 (2), 416–432. https : / / doi . org / 10 . 1016/S0095- 0696(02)00016- 5 Nordhaus, W. D. (1993). Optimal Greenhouse-Gas Reductions and Tax Policy in the ”DICE” Model. The American Economic Review ,83 (2), 313–317. Nordhaus, W. D. (2011). Integrated Economic and Climate Modeling (No. 1839). Retrieved February 17, 2022, from https://papers.ssrn.com/sol3/papers.cfm?abstract id=1970295 Nordhaus, W. D., & Yang, Z. (1996). A Regional Dynamic General-Equilibrium Model of Alter- native Climate-Change Strategies. The American Economic Review ,Vo l . 8 6 , 741–765. OECD. (2022). OECD Data . Retrieved May 19, 2022, from http://data.oecd.org OECD & Eurostat. (2012). Eurostat-OECD Methodological Manual on Purchasing Power Pari- ties (2012 Edition) .https://www.oecd- ilibrary.org/content/publication/9789264189232- en of Statistic of China, N. B. (2021). China Statistical Yearbook 2020 . Retrieved May 9, 2022, from http://www.stats.gov.cn/tjsj/ndsj/2020/indexeh.htm Papageorgiou, C., Saam, M., & Schulte, P. (2017). Substitution between Clean and Dirty Energy Inputs: A Macroeconomic Perspective. The Review of Economics and Statistics ,99 (2), 281–290. https://doi.org/10.1162/REST a00592 Pelli, M. (2012). The Elasticity of Substitution between Clean and Dirty Inputs in the Production of Electricity, 40. Pindyck, R. S. (2013). Climate Change Policy: What Do the Models Tell Us? Journal of Economic Literature ,51 (3), 860–872. https://doi.org/10.1257/jel.51.3.860 Pindyck, R. S. (2017). The Use and Misuse of Models for Climate Policy. Review of Environmental Economics and Policy ,11 (1), 100–114. https://doi.org/10.1093/reep/rew012 Pindyck, R. S. (2019). The social cost of carbon revisited. Journal of Environmental Economics and Management ,94 , 140–160. https://doi.org/10.1016/j.jeem.2019.02.003 Pizer, W. A. (1999). The optimal choice of climate change policy in the presence of uncertainty, 33. Rezai, A., & Van der Ploeg, F. (2016). Intergenerational Inequality Aversion, Growth, and the Role of Damages: Occam’s Rule for the Global Carbon Tax. Journal of the Association of Environmental and Resource Economists ,3(2), 493–522. https : / / doi . org / 10 . 1086 / 686294 42 Rutherford, T. F. (2002). Lecture Notes on Constant Elasticity Functions. Schauer, M. J. (1995). Estimation of the greenhouse gas externality with uncertainty. Environ- mental & Resource Economics ,5(1), 71–82. https://doi.org/10.1007/BF00691910 Serletis, A., Timilsina, G. R., & Vasetsky, O. (2010a). International Evidence on Sectoral Interfuel Substitution. The Energy Journal ,31 (4), 1–29. Serletis, A., Timilsina, G. R., & Vasetsky, O. (2010b). Interfuel substitution in the United States. Energy Economics ,32 (3), 737–745. https://doi.org/10.1016/j.eneco.2010.01.013 Stern, D. I. (2012). Interfuel Substitution: A Meta-Analysis. Journal of Economic Surveys ,26 (2), 307–331. https://doi.org/10.1111/j.1467- 6419.2010.00646.x Stern, N. (2022). A Time for Action on Climate Change and A Time for Change in Economics. The Economic Journal , ueac005. https://doi.org/10.1093/ej/ueac005 the World Bank. (2021). Carbon Pricing Dashboard . Retrieved May 12, 2022, from https : / / carbonpricingdashboard.worldbank.org/map data Timmer, M. P., Dietzenbacher, E., Los, B., Stehrer, R., & de Vries, G. J. (2015). An Illus- trated User Guide to the World Input-Output Database: The Case of Global Automo- tive Production: User Guide to World Input-Output Database. Review of International Economics ,23 (3), 575–605. https://doi.org/10.1111/roie.12178 Traeger, C. (2018). ACE – Analytic Climate Economy (with Temperature and Uncertainty) (SSRN Scholarly Paper No. ID 3307622). Social Science Research Network. Rochester, NY. https://doi.org/10.2139/ssrn.3307622 Traeger, C. (2022a). ACE – Analytic Climate Economy. American Economic Journal: Economic Policy (Forthcoming)) .https://doi.org/10.2139/ssrn.3832722 Traeger, C. (2022b). IAMs and CO2 Emissions – An Analytic Discussion (working paper), 90. United Nations Statistics Division. (2022). UNSD .https://unstats.un.org/home/ Unruh, G. C. (2000). Understanding carbon lock-in. Energy Policy ,28 (12), 817–830. https : //doi.org/10.1016/S0301- 4215(00)00070- 7 U.S. BUREAU OF LABOR STATISTICS. (2022). Productivity Data By Sector, Industry, and State . Productivity Data By Sector, Industry, and State. Retrieved March 30, 2022, from https://www.bls.gov/lpc/tables by sector and industry.htm U.S. Environmental Protection Agency. (2022). Emission Factors for Greenhouse Gas Inventories. https://www.epa.gov/climateleadership/ghg- emission- factors- hub van den Bijgaart, I., Gerlagh, R., & Liski, M. (2016). A simple formula for the social cost of carbon. Journal of Environmental Economics and Management ,77 , 75–94. https : //doi.org/10.1016/j.jeem.2016.01.005 Van Der Ploeg, F., & Withagen, C. (2014). GROWTH, RENEWABLES, AND THE OPTIMAL CARBON TAX: GROWTH, RENEWABLES, CARBON TAX. International Economic Review ,55 (1), 283–311. https://doi.org/10.1111/iere.12049 Van Der Zwaan, B. C. C., R¨osler, H., Kober, T., Aboumahboub, T., Calvin, K. V., Gernaat, D. E. H. J., Marangoni, G., & McCOLLUM, D. (2013). A CROSS-MODEL COMPAR- ISON OF GLOBAL LONG-TERM TECHNOLOGY DIFFUSION UNDER A 2 °C CLI- MATE CHANGE CONTROL TARGET. Climate Change Economics ,04 (04), 1340013. https://doi.org/10.1142/S2010007813400137 Vetter, D. (2021). How Sweden Delivered The World’s First Fossil Fuel-Free Steel . Forbes. Re- trieved May 19, 2022, from https://www.forbes.com/sites/davidrvetter/2021/08/19/ how- sweden- delivered- the- worlds- first- fossil- fuel- free- steel/ Waldho↵, S., Antho↵, D., Rose, S., & Tol, R. S. J. (2014). The Marginal Damage Costs of Dif- ferent Greenhouse Gases: An Application of FUND. Economics ,8(1), 20140031. https: //doi.org/10.5018/economics- ejournal.ja.2014- 31 43 Wang, Z., Gu, G., Wu, J., & Liu, C. (2016). CIECIA: A new climate change integrated assessment model and its assessments of global carbon abatement schemes. Science China Earth Sciences ,59 (1), 185–206. https://doi.org/10.1007/s11430- 015- 5141- 3 Wong, D., Mugera, A., & White, B. (2019). The Interfuel Substitutability in China’s Energy Transition: A National and Sectoral Level Analyses Using Normalized Quadratic Func- tion. SSRN Electronic Journal .https://doi.org/10.2139/ssrn.3360786 Xie, C., & Hawkes, A. D. (2015). Estimation of inter-fuel substitution possibilities in China’s transport industry using ridge regression. Energy ,88 , 260–267. https://doi.org/10.1016/ j.energy.2015.05.034 Zhang, S., Bauer, N., Luderer, G., & Kriegler, E. (2014). Role of technologies in energy-related CO2 mitigation in China within a climate-protection world: A scenarios analysis using REMIND. Applied Energy ,115 , 445–455. https://doi.org/10.1016/j.apenergy.2013.10. 039 Zhang, S., Bauer, N., Yin, G., & Xie, X. (2020). Technology learning and di↵usion at the global and local scales: A modeling exercise in the REMIND model. Technological Forecasting and Social Change ,151 , 119765. https://doi.org/10.1016/j.techfore.2019.119765 44 Appendix A Mathematical derivations In this Appendix I solve the cost minimization problems for the representative firms at each nesting level to obtain their compensated factor demand functions, whose inversions inform the calibration equation I will use 1. The equations are identical for both regions, so I omit regional indexing. I initially planned to let the elasticities of substitutions in the model be time-dependent, but it turned out to be outside the scope of the thesis as mentioned in the main text. As a result of this path dependency, however, I calculate the inverted compensated demand functions instead of using the more practical and straight-forward calibrated share form equations in Rutherford (2002 ). The calibrated share form would have permitted a direct interpretation of the CES- parameters as the value shares of the inputs in the calibration year, instead of the more abstract parameters below that depend on the elasticity of substitution 2. But it is not clear that it is possible to use this form when substitutability itself is changing over time. In the following, I approximately follow the approach laid out in the appendix to Traeger ( 2022b ). A.1 Final goods aggregation The representative firm has the following problem: min cl,t,8l2Nc X l2Nc pl,tcl,t s.t. At ⇣X l2Nc al,tcsl,t ⌘1s= Yt and X l al,t =1 . The Lagrangian to this problem is L= X l2Nc pl,tcl,t + " Yt�At ⇣X l2Nc al,tcsl,t ⌘1s # where �is the shadow value and where I have omitted the second constraint which holds trivially. The constraints hold for given right-hand-sides, but I omit special notation. The first order 1Iinvokethesecondfundamentaltheoremofwelfareeconomics,whichstatesthatanyPareto-optimalallocation could be realized as a decentralized equilibrium. This model is nicely behaved with the normal convexity and hasalogarithmicutilityfunction,withinteriorsolutionstothemaximizationproblem. Therearenoexternalitieswithin each social planner’s domain (although the global problem does not have a Pareto optimal decentralized solution). 2See e.g. Klump et al. ( 2011 )forathoroughexplanation. 45 condition for final good lis pl,t = �A t ⇣X l2Nc al,tcsl,t ⌘1s�1altcs�1l,t , which solved for cl,t gives cl,t = " �A tal,t pl,t ⇣X l al,tcsl,t ⌘1s�1# 11�s , (A.1) still a function of the shadow price. Multiply both sides by pl,t, sum over all goods and divide by output to get the average final goods unit costs UC t⌘ P lpl,tcl,t Yt = 1 Yt�A t ⇣X l al,tcsl,t ⌘⇣ X l al,tcsl,t ⌘1s�1= �, which shows that the average unit costs equal the shadow price. Since the production functions exhibit constant returns to scale, the marginal cost will equal units costs. And since the repre- sentative firm is a price-taker, marginal costs equal marginal prices. Thus, �= pt.Iinsertthis into ( A.1 ) and solve for al,t to get al,t = A1/st pl,t pt ✓cl,t Yt ◆1�s . All goods are measured in calibration-period USD, so I set the final good prices to unity. I do the same for pt. Furthermore, I want the aggregate good to be measured in USD and not in ‘utils’. Therefore, I make the following transformation and get the final calibration expression a⇤l,t = ✓cl,t Yt ◆1�s with At= ⇣X l2Nc a⇤l,t ⌘1s and al,t = a⇤l,t P l2Nca⇤l,t. (A.2) A.2 Final consumption good production The representative firm production good lhas the following problem: min Kl,t,Nl,t,dl,t pKtKl,t +pNtNl,t +pdl,tdl,t s.t. Al,tK↵ll,tN1�↵l�⌫i l,t d⌫il,t = cl,t. Note that the prices of capital and labor are sector-invariant, which is a result of e�cient alloca- tion of these resources. Setting up the Lagrangian and solving the first order equations provides the first order conditions below. Furthermore, since there is constant returns to scale and the firms are price takers, �= pl,t. Inserting for this gives the compensated demand functions Kl,t = pl,t ↵l pKtcl,t,N l,t = pl,t1�↵l�⌫l pNt cl,t,d l,t = pl,t ⌫l pdl,t cl,t. (A.3) The parameter ⌫lis sector specific, and I calibrate it according to ⌫i= pdl,tdl,t pl,tcl,t . (A.4) 46 As explained in chapter 3, ↵lmust be sector-independent. Therefore, I use Kt= P lKl,t and Yt to calibrate it: ↵l⌘ ↵= pKtKt ptYt = Kt Yt, (A.5) where I have set the prices to unity since I measure capital and output both in calibration-period consumption units. Finally, I calibrate Al,t to match total sector output Al,t = cl,t K↵l,tN1�↵�⌫i l,t d⌫ll,t , which is a function of the endogenous control variables Kl,t,Nl,t and dl,t. Since these are measured in calibration-period USD, I set the prices in ( A.3 ) to 1 and insert equation ( A.3 )to get Al,t = cl,t c1�⌫l l,t ↵↵⇣1�↵�⌫i pNt ⌘1�↵�⌫ld⌫ll,t = ↵�↵✓ pNt 1�↵�⌫i ◆1�↵�⌫l✓cl,t dl,t ◆⌫l = ↵�↵⌫�⌫l l ✓ pNt 1�↵�⌫i ◆1�↵�⌫l . (A.6) A.3 Intermediate energy and electricity producers The firms producing the intermediate energy goods solve the following problem: min el,i,t ,i2Nd X i2Nd pei,tel,i,t s.t. ˜Al,t ⇣X i2Nd ˜al,i,t el,i,t ˜sl⌘1˜sl= dl,t, and the electricity producing firm solves min e0,i,t ,i2Ne X i2Ne pei,te0,i,t s.t. ˜A0,t ⇣X i2Ne ˜a0,i,t e0,i,t ˜sl⌘1˜sl= e0,t. Using the same methods as above, I get compensated demand solved for the CES parameters in the intermediate energy producing sectors as ˜a⇤l,i,t = ˜A 1˜sll,t pei,t pdl,t ✓el,i,t dl,t ◆1�˜sl 8l2Nc with ˜Al,t = X i2Nd ˜a⇤l,i,t ! 1˜sl and ˜ al,i,t = ˜a⇤l,i,t P i2Nd˜a⇤l,i,t . (A.7) For the electricity sector, I get ˜a⇤0,i,t = ˜A1/˜sl 0,t pei,t pe0,t ✓e0,i,t e0,t ◆1�˜s0,t with ˜A0,t= X i2Ne ˜a⇤0,i,t ! 1˜s0,t and ˜ a0,i,t = ˜a⇤0,i,t P i2Ne˜a⇤0,i,t . (A.8) 47 A.4 Refined energy production The producers of refined energy face the following cost-minimization problem: min ¯Ki,t,¯Ni,t,Ei,t pKt ¯Ki,t +pNt ¯Ni,t +pEi,tEi,t s.t. ¯Ai,t ¯K ¯↵ii,t min {¯Ni,t,¯ai,tEi,t}1�¯↵i= ei,t. The optimal factor demand for a Leontief production function has the factors in equal propor- tions. Using this, I rewrite the problem to min ¯Ki,t,¯Ni,t,Ei,t pKt ¯Ki,t +pNt ¯Ni,t +pEi,tEi,t s.t. ¯Ai,t ¯K ¯↵ii,t ¯N1�¯↵i i,t = ei,t and ¯ ai,tEi,t = ¯Ni,t. The Lagrangian is L= pKt ¯Ki,t +pNt ¯Ni,t +pEi,tEi,t +��ei,t � ¯Ai,t ¯K ¯↵ii,t ¯N1�¯↵i i,t �+µ�¯Ni,t � ¯ai,tEi,t�, which has the first order conditions (i) pKt = �¯↵i¯Ai,t ¯K ¯↵i�1 i,t ¯N1�¯↵i i,t ) pKt ¯Ki,t = �¯↵iei,t (ii) pNt = �(1 � ¯↵i)ei,t¯Ni,t �µ) (pNt+µ)¯Ni,t = �(1 � ¯↵i)ei,t (iii) pEi,t =¯ aµ. I insert (iii) into (ii) to eliminate µ and assume that price equals marginal and average costs which eliminates �to get ¯Ki,t =¯ ↵ipei,t pKtei,t (A.9) ¯Ni,t = (1 � ¯↵i)pei,tei,t pNt+ pEi,t¯ai,t and (A.10) Ei,t = ¯Ni,t ¯ai,t = 1 ¯ai,t (1 � ¯↵i)pei,tei,t pNt+ pEi,t¯ai,t = (1 � ¯↵i)pei,t ¯ai,tpNt+pEi,t ei,t, where I used equation ( A.10 ) to eliminate the endogenous ¯Ni,t, and which solved for ¯ ai,t gives the calibration equations ¯ai,t = ¯Ni,t Ei,t =(1 � ¯↵i)pei,t pNt ei,t Ei,t � pEi,t pNt 8i2Id. (A.11) Remember that capital’s share ¯ ↵imust be equal across the producers at this level in the nested production function. I therefore calibrate ¯ ↵ ⌘ ¯↵iusing equation ( A.9 ), ¯Kt⌘ P i2Ne¯Ki,t and petet⌘ P i2Nepei,tei,t to get the ‘mean’ capital share of the refined energy sector ¯↵= ¯K,t petet, (A.12) where I used the normalization pKt = 1. 48 Next is to calibrate the ¯Ai,t’s to match output. Rewriting the production function, and using the sector-independent ¯ ↵, I get ¯Ai,t = ei,t ¯K¯↵i,t ¯N1�¯↵ i,t . I use equations ( A.9 ) and ( A.10 ) to eliminate the endogenous ¯Ki,t and ¯Ni,t ¯Ai,t = ei,t ✓ pNt+ pEi,t¯ai,t ◆1�¯↵ pKt¯↵ �¯↵p ei,tei,t�¯↵�(1 � ¯↵)pei,tei,t�1�¯↵ = pei,t�1 pNt+ pEi,t ¯ai,t !1�¯↵ , (A.13) where I used the normalization pKt = 1 and �⌘ �¯↵¯↵(1 � ¯↵)1�¯↵��1. 49 Appendix B A more general di↵usion model Recall equation ( 3.4 ) dl,t = ˜Al,t ⇣X i2Nd ˜al,i,t e˜sl,tl,i,t ⌘ 1˜sl,t which for each region gives the production of the intermediate energy input in sector las a function of electricity el,0,tand other refined energy inputs. Let Bl,i,t be the exogenous factor augmenting technology for energy input iin sector lin a given region. Then dl,t = ˜Al,t ⇣X i2Nd ˜al,i,t (Bl,i,t el,i,t )˜sl,t⌘ 1˜sl,t (B.1) makes factor-augmenting technological growth in the energy sector explicit. Let gl,i,t ⌘ �Al,i,t Al,i,t (B.2) be the growth rate of technology for input iin sector lat time t,with Al,i, 0> 0. Collect all the entries Al,i,t for region jin the l⇥ imatrix Aj,t, and let gj,t be a l⇥ imatrix with the corresponding technology growth rates from ( B.2 ) for region jin period t. The world technology frontier is represented by Atwith growth rates gt. The technological di↵usion equation 1of motion for each region jis Aj,t+1 = ✓j⇤(At�Aj,t)+( 1+�j)⇤Aj,t, (B.3) where ⇤is the element-wise matrix multiplication operator and 1is a matrix of ones. The time- constant and exogenous di↵usion parameters has elements ✓j,l,i 2[0,1]and �j,l,i 2[0,gl,i]2.The technology absorption rate ✓jcaptures the varying degrees with which regions are able to import various technologies given their policies, institutions and other economic and social factors. This rate is exogenous in the current model, but it is possible to endogenize it as a function of e.g. human capital (see Acemoglu ( 2009 )). The absorption rate captures the delay or imperfectness 1The following is based on the continuous time single-good model in Acemoglu ( 2009 ), chapter 18.2.1. 2The original single-good law of motion in Acemoglu ( 2009 )has ✓j2(0,1). I think that there is a typo here. Having ✓j>1impliesthataregioncouldabsorbmorethanthedi↵erencebetweentheworldfrontieranditsown technology level, which is hard to argue. That is why I have closed the interval at an upper boundary of 1. 50 with which technology becomes available across the world. For ✓j= 0, there is no di↵usion. For ✓j= 1all sectors catch up to the World frontier without delay. If the country is the World leader in any technology, Al,i = Aj,l,i , and there is no di↵usion. The local innovation parameter �jdetermines the locally sourced growth rate in technology. It captures how fast a region uses it existing knowledge Ajto improve technology. At the boundaries of the permitted interval, a region can either have no local innovation or innovate at the World frontier growth rate. Equation ( B.3 ) can be rearranged to get the technology growth rates directly for each sector land energy input i gj,t = ✓j˜Aj,t +�j (B.4) where ˜Aj,t ⌘ At�Aj,t Aj,t 2 [0,1) is the rate of di↵erence in technology levels between the World frontier and region j. For a positive di↵usion rate, a region with a high local innovation rate can have a higher technological growth rate than regions on the World frontier. This captures the catching-up e↵ect. The discrete-time model used in this thesis allow discontinuous paths of development, which encapsulates the potential for leap-frogging, where a region does not necessarily visit all the same ‘stops’ along the technological growth path of the World frontier. 51 Appendix C Supplementary figures 52 Output Emissions Temperature increase Figure C.1: Output, emissions and temperature. No vs. low di↵usion. Region L Region H Figure C.2: Energy by source with growth in renewable energy. Dotted lines are with no di↵usion and solid lines for low di↵usion. Note the di↵erence in scales. 53 Transport Industry Other Electricity Figure C.3: Energy by sector in region L. Dotted lines are with no di↵usion and solid lines for low di↵usion. Note the di↵erence in scales. 54 Appendix D Supplementary tables Table D.1: List of countries in each region 1 Region L Region H 1 Albania Anguilla 2 Algeria Antigua and Barbuda 3 Angola Argentina 4 Bangladesh Armenia 5 Barbados Aruba 6 Belize Australia 7 Benin Austria 8 Bhutan Azerbaijan 9 Bolivia (Plurinational State of ) Bahamas 10 Bosnia and Herzegovina Bahrain 11 Burkina Faso Belarus 12 Burundi Belgium 13 Cabo Verde Bermuda 14 Cambodia Botswana 15 Cameroon Brazil 16 Central African Republic British Virgin Islands 17 Chad Brunei Darussalam 18 Colombia Bulgaria 19 Comoros Canada 20 Congo Cayman Islands 21 Cˆote d’Ivoire Chile 22 D.R. of the Congo China 23 Djibouti China, Hong Kong SAR 24 Dominica China, Macao SAR 25 Ecuador Costa Rica 26 Egypt Croatia 27 El Salvador Cura¸cao 28 Eswatini Cyprus 29 Ethiopia Czech Republic 30 Fiji Denmark 55 31 Gambia Dominican Republic 32 Ghana Equatorial Guinea 33 Guatemala Estonia 34 Guinea Finland 35 Guinea-Bissau France 36 Guyana Gabon 37 Haiti Georgia 38 Honduras Germany 39 India Greece 40 Indonesia Grenada 41 Iran (Islamic Republic of ) Hungary 42 Iraq Iceland 43 Jamaica Ireland 44 Jordan Israel 45 Kenya Italy 46 Kyrgyzstan Japan 47 Lao People’s DR Kazakhstan 48 Lesotho Kuwait 49 Liberia Latvia 50 Madagascar Lebanon 51 Malawi Lithuania 52 Mali Luxembourg 53 Mauritania Malaysia 54 Mongolia Maldives 55 Morocco Malta 56 Mozambique Mauritius 57 Myanmar Mexico 58 Namibia Montenegro 59 Nepal Montserrat 60 Nicaragua Netherlands 61 Niger New Zealand 62 Nigeria North Macedonia 63 Pakistan Norway 64 Paraguay Oman 65 Peru Panama 66 Philippines Poland 67 Republic of Moldova Portugal 68 Rwanda Qatar 69 Sao Tome and Principe Republic of Korea 70 Senegal Romania 71 Sierra Leone Russian Federation 72 South Africa Saint Kitts and Nevis 73 Sri Lanka Saint Lucia 74 St. Vincent and the Grenadines Saudi Arabia 75 State of Palestine Serbia 76 Sudan Seychelles 77 Syrian Arab Republic Singapore 78 Ta jikistan Sint Maarten (Dutch part) 79 Togo Slovakia 56 80 Tu n i s i a Slovenia 81 U.R. of Tanzania: Mainland Spain 82 Uganda Suriname 83 Ukraine Sweden 84 Uzbekistan Switzerland 85 Venezuela (Bolivarian Republic of ) Taiwan 86 Viet Nam Thailand 87 Ye m e n Trinidad and Tobago 88 Zambia Tu r k e y 89 Zimbabwe Turkmenistan 90 Turks and Caicos Islands 91 United Arab Emirates 92 United Kingdom 93 United States 94 Uruguay 57 Appendix E Wrangling script 58 Table of Contents Data Wrangling for ACE % .................................................................................................................. 1 Initial setup ........................................................................................................................................ 1 PART 1: READ IN RAW DATA AND BASIC CLEANING: %% .............................................................. 1 RICE REGIONS ................................................................................................................................. 2 PWT 2019 (Aggregate macro GDP, capital, labor, growth rates etc. Country level.) ........................................ 2 MAKING A TABLE WITH MODEL COUNTRY NAMES, 3-LETTER CODES, RICECODES AND RICE REGIONS. ......................................................................................................................................... 5 UN Data. (FOR SECTOR DATA) ......................................................................................................... 5 WORLD INPUT-OUTPUT DATABASE (FOR MISSING COUNTRIES IN UN) .......................................... 9 ILOSTAT LABOR DATA .................................................................................................................. 12 IEA VOLUME BALANCES ............................................................................................................... 16 PWT TRANSPORT CAPITAL DETAIL DATA .................................................................................... 23 OECD CAPITAL DETAILS DATA () .................................................................................................. 24 US BLS DETAILED CAPITAL DATA FOR FUEL CAPITAL USE ......................................................... 26 CHINA CAPITAL DETAILS .............................................................................................................. 27 PART 2: COMBINING PRE-PROCESSED DATA INTO USABLE SPREADSHEETS FOR CALIBRATION %% ......................................................................................................................... 28 MERGING FOR FINAL GOOD SECTORS CALIBRATION ................................................................... 28 MERGING AND PREPARING INTERMEDIATE AND REFINED ENERGY SECTORS ............................. 31 MERGING INTO ONE BIG SHEET .................................................................................................... 32 Functions %% ................................................................................................................................... 32 Data Wrangling for ACE % %%%%%%%%%%%%%%%%%%%%%%%%%%%%% Initial setup clear all clc % Wrangle these: wrangle.RICE = 1; % List of RICE codes and region names wrangle.PWT = 1; % Time series of country-level macro data wrangle.UN = 1; % Sector output data (2019 mostly, some 2018) wrangle.WIOD = 1; % Sector output data missing from UN (2014) wrangle.ILOSTAT = 1; % Sector labor data wrangle.IEA = 1; % Sector energy volumes wrangle.OECD = 1; % Sector capital data wrangle.USBLS = 1; % Fine sector capital data (for fuels) wrangle.sectors = 1; % Dataset merging for export wrangle.energy = 1; % Energy data merging for export PART 1: READ IN RAW DATA AND BASIC CLEANING: %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1 59 RICE REGIONS if wrangle.RICE == 1 % This is a cleaned list to match the available PWT data. % There are more countries in RICE, but these are the ones for which we have PWT data raw.RICE_regions = readtable( "raw_data\our_regions_clean.csv" ); RICE_regions = renamevars(raw.RICE_regions, [ "country_name" "country_code" ], [ "country" "countrycode" ]); RICE_regions.short_name = []; % Converting variables to categories (more functionality, less % memory required) RICE_regions = categorizer(RICE_regions, width(RICE_regions)); % Merging RICE list with ISO list. Keeping RICE names. RICE_regions = outerjoin(RICE_regions,isoCountryList, "LeftKeys" ,"countrycode" ,"RightKeys" ,"alpha_3" ); % Keeping only RICE countries (because of PWT data limitations) RICE_regions(isundefined(RICE_regions.country),:) = []; RICE_regions(:,[5 6 7 9 12 13 14 15]) = []; % % Saving wranglingFile.RICE_regions = RICE_regions; save( "calibData.mat" , "RICE_regions" , "-append" ); %save("rawData.mat", "raw"); else load( "calibData.mat" , "RICE_regions" ); %load("rawData.mat", "raw"); end % END RICE REGIONS Error using readtable Unable to find or open 'raw_data\our_regions_clean.csv'. Check the path and filename or file permissions. Error in wranglingScript (line 31) raw.RICE_regions = readtable("raw_data\our_regions_clean.csv"); PWT 2019 (Aggregate macro GDP, capital, la- bor, growth rates etc. Country level.) if wrangle.PWT == 1 raw.PWT = readtable( "raw_data\pwt100.xlsx" , "Sheet" , "Data" ); 2 60 PWT = categorizer(raw.PWT, 2); % Adding developed/developing regional codes % NOTE: PWT data is in millions of people. I just want people. % NOTE: PWT data is in millions of USD. I want just USD. PWT.cgdpo = 1000000.*PWT.cgdpo; PWT.cn = 1000000.*PWT.cn; PWT.emp = 1000000.*PWT.emp; PWT.pop = 1000000.*PWT.pop; PWT.gdpPerCap = PWT.cgdpo ./ PWT.pop; % USD per capita PWT.thesisCode = ~(PWT.gdpPerCap < 14031 | isnan(PWT.gdpPerCap)); % GdpPerEmp lower than China is defined as developing. % Getting labsh as extensive variable PWT.labshExt = PWT.labsh .* PWT.cgdpo; % Converting the logical to categorical for future use % Note: The normal way was buggy, so had to use workaround. PWT = convertvars(PWT, "thesisCode" , 'categorical' ); % Logical to double PWT.thesisCode = renamecats(PWT.thesisCode, [ "true" "false" ], [ "2" "1" ]); % JOINING PWT WITH RICE REGIONS (easy, both has three letter abbr. code) PWT = join(PWT, RICE_regions, Keys= "countrycode" ); PWT(:, "country_RICE_regions" ) = []; % Saving dynamic PWT data for growth rate calculations PWT2019 = PWT(PWT.year == 2019,:); countries2019 = unique(PWT2019.countrycode); pwtDynamic = PWT(PWT.year > 2009,:); PWT = PWT(PWT.year == 2019,:); thesis1 = unique(PWT(PWT.thesisCode == "1" , "countrycode" )); idl = pwtDynamic.year == 2019 & pwtDynamic.thesisCode == "1" ; lowCountries = pwtDynamic.countrycode(idl); idl = pwtDynamic.year == 2019 & pwtDynamic.thesisCode == "2" ; highCountries = pwtDynamic.countrycode(idl); for k = 1:numel(lowCountries) id = pwtDynamic.year ~= 2019 & pwtDynamic.countrycode == lowCountries(k); pwtDynamic.thesisCode(id) = "1" ; end for k = 1:numel(highCountries) id = pwtDynamic.year ~= 2019 & pwtDynamic.countrycode == highCountries(k); 3 61 pwtDynamic.thesisCode(id) = "2" ; end PWTsanity1 = PWT; G = findgroups(PWT.thesisCode); UWplPPP = splitapply(@mean, PWT.pl_gdpo, G); % Sum of GDP per thesis region G = findgroups(PWT.thesisCode); sumGDP = splitapply(@sum, PWT.cgdpo, G); % Sum of GDP sumGDPWorld = sum(PWT.cgdpo); PWT.GDPweight = ones(183,1); PWT.GDPweightWorld = ones(183,1); %Low income PWT{PWT.thesisCode == "1" , "GDPweight" } = PWT.cgdpo(PWT.thesisCode == "1" ) / sumGDP(1); %High income PWT{PWT.thesisCode == "2" , "GDPweight" } = PWT.cgdpo(PWT.thesisCode == "2" ) / sumGDP(2); %World PWT{:, "GDPweightWorld" } = PWT.cgdpo / sumGDPWorld; % Sanity check, each group should sum to 1 G = findgroups(PWT.thesisCode); sumWeights = splitapply(@sum, PWT.GDPweight, G); %Passed PWT.weighedPL = PWT.GDPweight .* PWT.pl_gdpo; PWT.weighedPLWorld = PWT.GDPweightWorld .* PWT.pl_gdpo; % Finding the weighted average PPP adjusted price levels. G = findgroups(PWT.thesisCode); wPriceLevel = splitapply(@sum, PWT.weighedPL, G); wPriceLevelWorld = sum(PWT.weighedPLWorld); wPriceLevel = [wPriceLevelWorld; wPriceLevel]; % Removing year variable for easy merging with non-2019 data later PWT(:, "year" ) = []; save( "calibData.mat" , "PWT" , "-append" ); % A full-data 2019 version for calibration code save( "calibData.mat" , "pwtDynamic" , "-append" ); % A full-data 2010-2019 for growth rates save( "calibData.mat" , "wPriceLevel" , "-append" ); %save("rawData.mat", "raw", "-append"); else load( "calibData.mat" , "PWT" , "pwtDynamic" , "wPriceLevel" ); 4 62 %load("rawData.mat", "raw"); end % END PWT MAKING A TABLE WITH MODEL COUNTRY NAMES, 3-LETTER CODES, RICECODES AND RICE REGIONS. Subsetting FROM PWT only the country list and codes countriesPWTRICE = unique([PWT(:, "countrycode" ), PWT(:, "country_PWT" ), PWT(:, "rice_code" ), PWT(:, "rice_region" ), PWT(:, "country_code" ), PWT(:, "thesisCode" ),PWT(:, "region" )]); countriesPWTRICE = renamevars(countriesPWTRICE, [ "country_PWT" ], [ "country" ]); % IEA data lacks fine level data for some African, Asian and American countries. % Must add these regions manually to country list and assign regions tabOthAf ={ "OAF" , "Other Africa" , "9" , "Africa" , "99999" , "1" , "Africa" }; tabOthAm ={ "OAM" , "Other non-OECD Americas" , "10" , "LatAm" , "88888" , "1" , "Americas" }; tabOthAs ={ "OAS" , "Other non-OECD Asia" , "12" , "OthAs" , "77777" , "1" , "Asia" }; countriesPWTRICE = [countriesPWTRICE; tabOthAf; tabOthAm; tabOthAs]; % END SPECIAL COUNTRYCODES TABLE UN Data. (FOR SECTOR DATA) if wrangle.UN == 1 % First, I must read in the two tables and separately combine the sectors % whithin each system because ofdifferent naming and grouping of sectors. % (See: % https://ilostat.ilo.org/resources/concepts-and-definitions/ classification-economic-activities/) % Second, I must join the two tables to get all the countries in one table. % Third, I must update the country list to match the PWT list. % Fourth, I must decide on which sectors to put in which aggregate. What to % do with electricity and mining? They should go "below" my three sectors, % which is an argument of using the output method. But then, however, many % other things go "below" mu three sectors as well (such as vehicle % manufacturing, which messes up the energy intermediate interpretation). 5 63 % Fifth, I must find the proper sectoral shares. % Sixth, I must split the table in three -- one for each sector. These % tables become the foundation on which to add further calibration % variables. % These are the variables I need from the UN data unVars = [ "country" "year" "sector" "accountingType" "currency" "series" "isic" "value" ]; % READING IN AND COMBINING TABLES raw.UN_ISIC4 = readtable( "raw_data\UN output gva current prices ISIC4.txt" ); isic = ones(height(raw.UN_ISIC4),1); raw.UN_ISIC4.isic = 4.*isic; % Assigning ISIC version number for later identification raw.UN_ISIC3 = readtable( "raw_data\UN_output_sectors.txt" ); isic = ones(height(raw.UN_ISIC3),1); raw.UN_ISIC3.isic = 3.*isic; raw.UN = [raw.UN_ISIC4;raw.UN_ISIC3]; % Vertical append unData = renamevars(raw.UN, [ "CountryOrArea" "Year" "SubItem" "Item" "Currency" "Series" "isic" "Value" ], unVars); unData = unData(:, unVars); unData = categorizer(unData,5); % Keeping value added (GDP) and output. NOTE: A MISTAKE TO KEEP VA. % BUG. % unData = unData(unData.accountingType == "Equals: VALUE ADDED, GROSS, at basic prices" | ... % unData.accountingType == "Output, at basic prices",:); unData = unData(unData.accountingType == "Output, at basic prices" ,:); unData(:, "accountingType" ) = []; % Listing all sectors to see which are redundant sectorsAndIsicTab = unData(:,[ "sector" "isic" ]); [~, sectorsAndIsic] = findgroups(sectorsAndIsicTab); % Removing pre-aggregated sectors and subsectors that could cause issues in summation unData((unData.sector == "Agriculture, hunting and related service activities (01)" | ... unData.sector == "Agriculture, hunting, forestry; fishing (A+B)" | ... unData.sector == "Crop and animal production, hunting and related service activities (01)" | ... unData.sector == "Education; health and social work; other community, social and personal services (M+N+O)" | ... unData.sector == "Financial intermediation; real estate, renting and business activities (J+K)" | ... unData.sector == "Fishing and aquaculture (03)" | ... unData.sector == "Forestry and logging (02)" | ... unData.sector == "Forestry, logging and related service activities (02)" | ... 6 64 unData.sector == "Manufacturing, mining and quarrying and other industrial activities (B+C+D+E)" | ... unData.sector == "Other service activities (R+S+T)" | ... unData.sector == "Professional, scientific, technical, administrative and support service activities (M+N)" | ... unData.sector == "Public administration and defence, education, human health and social work activities (O+P+Q)" | ... unData.sector == "Wholesale and retail trade, transportation and storage, accommodation and food service activities (G+H+I)" | ... unData.sector == "Wholesale retail trade, repair of motor vehicles, motorcycles, etc.; hotels and restaurants (G+H)" ), ... :) = []; % Finding the remanding list of sectors, for merging sectorsAndIsicTab = unData(:,[ "sector" "isic" ]); [~, sectorsAndIsic] = findgroups(sectorsAndIsicTab); % Defining model sectors (see sectorsAndIsic for list of all sectors) electricitySector = [{ 'Electricity, gas and water supply (E)' } { 'Electricity, gas, steam and air conditioning supply (D)' }]; miningSector = [{ 'Mining and quarrying (B)' } { 'Mining and quarrying (C)' }]; transportSector = [{ 'Transportation and storage (H)' } { 'Transport, storage and communications (I)' }]; industrySector = [{ 'Construction (F)' } { 'Manufacturing (C)' } { 'Manufacturing (D)' }]; otherSector = [{ 'Accommodation and food service activities (I)' } { 'Administrative and support service activities (N)' } { 'Agriculture, forestry and fishing (A)' } { 'Arts, entertainment and recreation (R)' } { 'Education (P)' } { 'Financial and insurance activities (K)' } { 'Fishing (B)' } { 'Human health and social work activities (Q)' } { 'Information and communication (J)' } { 'Other service activities (S)' } { 'Private households with employed persons (P)' } { 'Private households with employed persons (T)' } { 'Professional, scientific and technical activities (M)' } { 'Public administration and defence; compulsory social security (O)' } { 'Public administration and defense; compulsory social security (L)' } { 'Real estate activities (L)' } { 'Water supply; sewerage, waste management and remediation activities (E)' } { 'Wholesale and retail trade; repair of motor vehicles and motorcycles (G)' }]; industrySector = [industrySector;electricitySector;miningSector]; % Merging detailed sectors into model sectors unData.sector = mergecats(unData.sector, transportSector, "Transport (and storage)" ); 7 65 unData.sector = mergecats(unData.sector, industrySector, "Industry (manufacturing and construction)" ); unData.sector = mergecats(unData.sector, otherSector, "Other" ); %unData.sector = mergecats(unData.sector, electricitySector, "Electricity"); %unData.sector = mergecats(unData.sector, miningSector, "Mining"); % Fixing name differences between UN and PWT. There are 147 countries in the UN data and % 183 in PWT. Sorting out spelling differences. countriesUN = unique(unData.country); countriesPWT = unique(countriesPWTRICE.country); inUNnotinPWT = setdiff(countriesUN, countriesPWT); inPWTnotinUN = setdiff(countriesPWT,countriesUN); unData.country = renamecats(unData.country, ... [ "China, Hong Kong Special Administrative Region" ... "China, Macao Special Administrative Region" ... "Czechia" ... "Tanzania - Mainland" ... "Saint Vincent and the Grenadines" ], ... [string(countriesPWT(countriesPWT == "China, Hong Kong SAR" )) ... string(countriesPWT(countriesPWT == "China, Macao SAR" )) ... string(countriesPWT(countriesPWT == "Czech Republic" )) ... string(countriesPWT(countriesPWT == "U.R. of Tanzania: Mainland" )) ... string(countriesPWT(countriesPWT == "St. Vincent and the Grenadines" ))]); countriesUNcheck = unique(unData.country); % Merging some sub-countries into mother country to better mix with % other datasets unData.country = mergecats(unData.country, [ "Denmark" "Greenland" ], "Denmark" ); % Collecting sectors unData = varfun(@sum, unData, ... GroupingVariables=[ "country" "year" "sector" ], ... InputVariables= "value" ); % Merging territories into mother country unData.country = mergecats(unData.country, [ "Denmark" "Greenland" ], "Denmark" ); % ADDING COUNTRY CODES TO UN DATA % Note: The joining key is the 3-letter country code because of spelling differences in full country names. % JOINING UNDATA TO THE COUNTRYLISTS AND 3-LETTER CODE FROM RICE AND PWT % Joining tables unData = outerjoin(unData,countriesPWTRICE); % XXX ONLY 130 COUNTRIES. NEED TO FIX NAMING BEFORE THIS. unCountriesAfterJoin = unique(unData.country_unData); %now 193 countries % If the country is not in UN data, I copy the name from PWT data. 8 66 notInUnData = isundefined(unData.country_unData); countriesNotInUnData = unData(notInUnData, ["country_countriesPWTRICE" "countrycode" ]); unData.country_unData(notInUnData) = unData.country_countriesPWTRICE(notInUnData); % Assigning year and sector gategory to missing data vars (PWT % countries not in UN) isUndefined = isundefined(unData.year); unData.year(isUndefined) = "9999" ; % Just a missing data marker isUndefined = isundefined(unData.sector); unData.sector(isUndefined) = "Missing Data" ; % For now I am just dropping the 10 small countries with UN data and no PWT % % data. (XXX Figure out if some can be used) %unData(isundefined(unData.country_countryLists),:) = []; % Keeping only needed vars unData = unData(:, ["country_unData" "year" "sector" "sum_value" "countrycode" "rice_code" "rice_region" ]); % END OF ADDING COUNTRY CODES TO UN DATA %unData = unData(unData.year == "2019", :); % 130 countries for 2019, 144 for 2018, 148 for 2017 %unData = unData((unData.sector == "Total Economy" | unData.sector == "Missing Data"),:); save( "wrangling.mat" , "unData" , "-append" ); %save("rawData.mat", "raw", "-append"); else load( "wrangling.mat" , "unData" ); %load("rawData.mat", "raw"); end % END UN DATA WRANGLING WORLD INPUT-OUTPUT DATABASE (FOR MISSING COUNTRIES IN UN) WIOD is a smaller but more detailed database. It has data for 4 of the large regions missing in UN data: China, Indonesia, Russia, Taiwan. Only smaller countries are missing in UN, to whom I extrapolate shares when done. if wrangle.WIOD == 1 % Reading in raw data (XXX automate somehow?) raw.WIOD_CHN = readtable( "raw_data\WIOD\CHN_NIOT_nov16.xlsx" , Sheet= "National IO-tables" , VariableNamesRange= "A2" , DataRange= "A3" ); %raw.WIOD_CZE = readtable("raw_data\WIOD\CZE_NIOT_nov16.xlsx", Sheet="National IO-tables", VariableNamesRange="A2", DataRange="A3"); raw.WIOD_IDN = readtable( "raw_data\WIOD\IDN_NIOT_nov16.xlsx" , Sheet= "National IO-tables" , VariableNamesRange= "A2" , DataRange= "A3" ); raw.WIOD_RUS = readtable( "raw_data\WIOD\RUS_NIOT_nov16.xlsx" , Sheet= "National IO-tables" , VariableNamesRange= "A2" , DataRange= "A3" ); 9 67 raw.WIOD_TWN = readtable( "raw_data\WIOD\TWN_NIOT_nov16.xlsx" , Sheet= "National IO-tables" , VariableNamesRange= "A2" , DataRange= "A3" ); % Manually adding countrycodes (XXX could automate from regexp on filename) raw.WIOD_CHN.countrycode(:) = "CHN" ; %raw_WIOD_CZE.countrycode(:) = "CZE"; Found CZE data in UN under %different name raw.WIOD_IDN.countrycode(:) = "IDN" ; raw.WIOD_RUS.countrycode(:) = "RUS" ; raw.WIOD_TWN.countrycode(:) = "TWN" ; % Vertical concat. of each country into one big table for all five % countries wiodData = [raw.WIOD_CHN;raw.WIOD_IDN;raw.WIOD_RUS;raw.WIOD_TWN]; % Add raw.WIOD_CZE if needed later wiodVars = [ "countrycode" "year" "code" "sector" "origin" "value" ]; wiodData = renamevars(wiodData, [ "countrycode" "Var1" "Var2" "Var3" "Var4" "TotalOutput" ], wiodVars); wiodData(wiodData.year ~= 2014,:) = []; wiodData = wiodData(:,wiodVars); wiodData(wiodData.origin ~= "Domestic" ,:) = []; wiodData = categorizer(wiodData, 5); electricitySector = { 'Electricity, gas, steam and air conditioning supply' }; miningSector = { 'Mining and quarrying' }; transportSector = [{ 'Land transport and transport via pipelines' } { 'Water transport' } { 'Air transport' } { 'Warehousing and support activities for transportation' } { 'Postal and courier activities' }]; industrySector = [{ 'Construction' } { 'Manufacture of food products, beverages and tobacco products' } { 'Manufacture of textiles, wearing apparel and leather products' } { 'Manufacture of wood and of products of wood and cork, except furniture; manufacture of articles of straw and plaiting materials' } { 'Manufacture of paper and paper products' } { 'Printing and reproduction of recorded media' } { 'Manufacture of coke and refined petroleum products' } { 'Manufacture of chemicals and chemical products' } { 'Manufacture of basic pharmaceutical products and pharmaceutical preparations' } { 'Manufacture of rubber and plastic products' } { 'Manufacture of other non-metallic mineral products' } { 'Manufacture of basic metals' } { 'Manufacture of fabricated metal products, except machinery and equipment' } { 'Manufacture of computer, electronic and optical products' } { 'Manufacture of electrical equipment' } { 'Manufacture of machinery and equipment n.e.c.' } 10 68 { 'Manufacture of motor vehicles, trailers and semi-trailers' } { 'Manufacture of other transport equipment' } { 'Manufacture of furniture; other manufacturing' } { 'Repair and installation of machinery and equipment' } electricitySector miningSector ]; otherSector = [{ 'Crop and animal production, hunting and related service activities' } { 'Forestry and logging' } { 'Fishing and aquaculture' } { 'Water collection, treatment and supply' } { 'Sewerage; waste collection, treatment and disposal activities; materials recovery; remediation activities and other waste management services' } { 'Wholesale and retail trade and repair of motor vehicles and motorcycles' } { 'Wholesale trade, except of motor vehicles and motorcycles' } { 'Retail trade, except of motor vehicles and motorcycles' } { 'Accommodation and food service activities' } { 'Publishing activities' } { 'Motion picture, video and television programme production, sound recording and music publishing activities; programming and broadcasting activities' } { 'Telecommunications' } { 'Computer programming, consultancy and related activities; information service activities' } { 'Financial service activities, except insurance and pension funding' } { 'Insurance, reinsurance and pension funding, except compulsory social security' } { 'Activities auxiliary to financial services and insurance activities' } { 'Real estate activities' } { 'Legal and accounting activities; activities of head offices; management consultancy activities' } { 'Architectural and engineering activities; technical testing and analysis' } { 'Scientific research and development' } { 'Advertising and market research' } { 'Other professional, scientific and technical activities; veterinary activities' } { 'Administrative and support service activities' } { 'Public administration and defence; compulsory social security' } { 'Education' } { 'Human health and social work activities' } { 'Other service activities' } { 'Activities of households as employers; undifferentiated goods- and services-producing activities of households for own use' } { 'Activities of extraterritorial organizations and bodies' } ]; % NOTE: Can get electricity and so on as separate sectors. Here they are % merged into other. 11 69 wiodData.sector = mergecats(wiodData.sector, transportSector, "Transport (and storage)" ); wiodData.sector = mergecats(wiodData.sector, industrySector, "Industry (manufacturing and construction)" ); wiodData.sector = mergecats(wiodData.sector, otherSector, "Other" ); % Collecting sectors wiodData = varfun(@sum, wiodData, ... GroupingVariables=[ "countrycode" "year" "sector" ], ... InputVariables= "value" ); % Creating Total Economy sector wiodDataTotal = varfun(@sum, wiodData, ... GroupingVariables=[ "countrycode" "year" ], ... InputVariables= "sum_value" ); wiodDataTotal = renamevars(wiodDataTotal, [ "GroupCount" "sum_sum_value" ], [ "sector" "sum_value" ]); wiodDataTotal = convertvars(wiodDataTotal,wiodDataTotal.Properties.VariableNames{ "sector" }, 'categorical' ); wiodDataTotal.sector = renamecats(wiodDataTotal.sector, "3" , "Total Economy" ); % Merging Total Economy category and data into main wiod table wiodData(:, "GroupCount" ) = []; wiodData = [wiodData; wiodDataTotal]; wiodData = sortrows(wiodData, "countrycode" ); save( "wrangling.mat" , "wiodData" , "-append" ); %save("rawData.mat", "raw", "-append"); else load( "wrangling.mat" , "wiodData" ); %load("rawData.mat", "raw"); end % END WIOD WRANGLING ILOSTAT LABOR DATA if wrangle.ILOSTAT == 1 % Basic read-ins and preprocessing raw.ILOSTAT = readtable( "raw_data\ilostat labor data sector shares (189C with SECTOR SHARES).csv" ); ilostatVars = [ "country" , "sector" , "secLabSh" ]; ilostatData = renamevars(raw.ILOSTAT, [ "ReferenceArea" "EconomicActivity" "Value" ], ilostatVars); ilostatData = ilostatData(:,ilostatVars); ilostatData = categorizer(ilostatData, 2); electricitySector = { 'Detailed: Utilities ~ISIC rev.4 D; E' }; % Note: Utilities contain more than just electricity production miningSector = { 'Detailed: Mining and quarrying ~ISIC rev.4 B' }; 12 70 transportSector = [{ 'Detailed: Transport; storage and communication ~ISIC rev.4 H; J' }]; industrySector = [{ 'Detailed: Manufacturing ~ISIC rev.4 C' } { 'Detailed: Construction ~ISIC rev.4 F' } electricitySector miningSector]; otherSector = [{ 'Detailed: Agriculture; forestry and fishing ~ISIC rev.4 A' } { 'Detailed: Wholesale and retail trade; repair of motor vehicles and motorcycles ~ISIC rev.4 G' } { 'Detailed: Accommodation and food service activities ~ISIC rev.4 I' } { 'Detailed: Financial and insurance activities ~ISIC rev.4 K' } { 'Detailed: Real estate; business and administrative activities ~ISIC rev.4 L; M; N' } { 'Detailed: Public administration and defence; compulsory social security ~ISIC rev.4 O' } { 'Detailed: Education ~ISIC rev.4 P' } { 'Detailed: Human health and social work activities ~ISIC rev.4 Q' } { 'Detailed: Other services ~ISIC rev.4 R; S; T; U' } ]; ilostatData.sector = mergecats(ilostatData.sector, transportSector, "Transport (and storage)" ); ilostatData.sector = mergecats(ilostatData.sector, industrySector, "Industry (manufacturing and construction)" ); ilostatData.sector = mergecats(ilostatData.sector, otherSector, "Other" ); ilostatData = ilostatData( ... (ilostatData.sector == "Transport (and storage)" | ... ilostatData.sector == "Industry (manufacturing and construction)" | ... ilostatData.sector == "Electricity" | ... ilostatData.sector == "Mining" | ... ilostatData.sector == "Other" ),:); % Collecting sectors ilostatData = varfun(@sum, ilostatData, ... GroupingVariables=[ "country" "sector" ], ... InputVariables= "secLabSh" ); % Cleaning ilostatData = renamevars(ilostatData, "sum_secLabSh" , "secLabSh" ); ilostatData = ilostatData(:,[ "country" "sector" "secLabSh" ]); % Unstacking to get a variable per sector (a wider table, one country per row) ilostatData = unstack(ilostatData, "secLabSh" ,"sector" ,... "VariableNamingRule" ,"preserve" ); ilostatData = renamevars(ilostatData, ... [ "Transport (and storage)" "Industry (manufacturing and construction)" "Other" ], ... [ "transportLabSh" "industryLabSh" "otherLabSh" ]); 13 71 % Removing ILOSTAT regions dropIlostat = { 'ASEAN' 'Africa' 'Africa: High income' 'Africa: Low income' 'Africa: Lower-middle income' 'Africa: Upper-middle income' 'Americas' 'Americas: High income' 'Americas: Low income' 'Americas: Lower-middle income' 'Americas: Upper-middle income' 'Arab League' 'Arab States' 'Arab States: High income' 'Arab States: Low income' 'Arab States: Lower-middle income' 'Arab States: Upper-middle income' 'Asia and the Pacific' 'Asia and the Pacific: High income' 'Asia and the Pacific: Low income' 'Asia and the Pacific: Lower-middle income' 'Asia and the Pacific: Upper-middle income' 'BRICS' 'Caribbean' 'CARICOM' 'Central Africa' 'Central America' 'Central Asia' 'Central and Western Asia' 'Central and Western Asia: High income' 'Central and Western Asia: Low income' 'Central and Western Asia: Lower-middle income' 'Central and Western Asia: Upper-middle income' 'Eastern Africa' 'Eastern Asia' 'Eastern Asia: High income' 'Eastern Asia: Low income' 'Eastern Asia: Lower-middle income' 'Eastern Asia: Upper-middle income' 'Eastern Europe' 'Eastern Europe: High income' 'Eastern Europe: Lower-middle income' 'Eastern Europe: Upper-middle income' 'Europe and Central Asia' 'Europe and Central Asia: High income' 'Europe and Central Asia: Low income' 'Europe and Central Asia: Lower-middle income' 'Europe and Central Asia: Upper-middle income' 'European Union 27' 'European Union 28' 'G20' 'G7' 'Latin America and the Caribbean' 14 72 'Latin America and the Caribbean: High income' 'Latin America and the Caribbean: Low income' 'Latin America and the Caribbean: Lower-middle income' 'Latin America and the Caribbean: Upper-middle income' 'MENA' 'Northern Africa' 'Northern Africa: Lower-middle income' 'Northern Africa: Upper-middle income' 'Northern America' 'Northern America: High income' 'Northern Europe' 'Northern, Southern and Western Europe' 'Northern, Southern and Western Europe: High income' 'Northern, Southern and Western Europe: Upper-middle income' 'Pacific Islands' 'South-Eastern Asia' 'South-Eastern Asia and the Pacific' 'South-Eastern Asia and the Pacific: High income' 'South-Eastern Asia and the Pacific: Lower-middle income' 'South-Eastern Asia and the Pacific: Upper-middle income' 'Southern Africa' 'South America' 'Southern Asia' 'Southern Asia: Low income' 'Southern Asia: Lower-middle income' 'Southern Asia: Upper-middle income' 'Southern Europe' 'Sub-Saharan Africa' 'Sub-Saharan Africa: High income' 'Sub-Saharan Africa: Low income' 'Sub-Saharan Africa: Lower-middle income' 'Sub-Saharan Africa: Upper-middle income' 'Western Africa' 'Western Asia' 'Western Europe' 'World' 'World excluding BRICS' 'World: High income' 'World: Low income' 'World: Lower-middle income' 'World: Upper-middle income' }; ilostatData(ismember(ilostatData.country, dropIlostat),:) = []; % Sorting out naming differences. countriesILO = unique(ilostatData.country); countriesPWT = unique(countriesPWTRICE.country); inILOnotPWT = setdiff(countriesILO, countriesPWT); inPWTnotinILO = setdiff(countriesPWT,countriesILO); ilostatData.country = renamecats(ilostatData.country, ... [ "Bolivia" ... "Cape Verde" ... "Congo, Democratic Republic of the" ... "Czechia" ... 15 73 "Hong Kong, China" ... "Iran, Islamic Republic of" ... "Korea, Republic of" ... "Lao People's Democratic Republic" ... "Macau, China" ... "Moldova, Republic of" ... "Occupied Palestinian Territory" ... "Saint Vincent and the Grenadines" ... "Taiwan, China" ... "Tanzania, United Republic of" ... "Venezuela, Bolivarian Republic of" ], ... [string(countriesPWT(countriesPWT == "Bolivia (Plurinational State of)" )), ... string(countriesPWT(countriesPWT == "Cabo Verde" )), ... string(countriesPWT(countriesPWT == "D.R. of the Congo" )), ... string(countriesPWT(countriesPWT == "Czech Republic" )), ... string(countriesPWT(countriesPWT == "China, Hong Kong SAR" )), ... string(countriesPWT(countriesPWT == "Iran (Islamic Republic of)" )), ... string(countriesPWT(countriesPWT == "Republic of Korea" )), ... string(countriesPWT(countriesPWT == "Lao People's DR" )), ... string(countriesPWT(countriesPWT == "China, Macao SAR" )), ... string(countriesPWT(countriesPWT == "Republic of Moldova" )), ... string(countriesPWT(countriesPWT == "State of Palestine" )), ... string(countriesPWT(countriesPWT == "St. Vincent and the Grenadines" )), ... string(countriesPWT(countriesPWT == "Taiwan" )), ... string(countriesPWT(countriesPWT == "U.R. of Tanzania: Mainland" )), ... string(countriesPWT(countriesPWT == "Venezuela (Bolivarian Republic of)" ))]); countriesILOcheck = unique(ilostatData.country); save( "wrangling.mat" , "ilostatData" , "-append" ); %save("rawData.mat", "raw", "-append"); else load( "wrangling.mat" , "ilostatData" ); %load("rawData.mat", "raw"); end % END ILOSTAT WRANGLING IEA VOLUME BALANCES if wrangle.IEA == 1 raw_IEA = readtable( "raw_data\IEA energy volumes.xlsx" , Sheet= "Data" , VariableNamesRange= "A4" , DataRange= "A6" ); raw_IEA_Other = readtable( "raw_data\WBAL_Extract-Sharing_V2.xlsx" , Sheet= "Data_Add" , VariableNamesRange= "A4" , DataRange= "A5" ); % Cleaning to merge the two datasets. ieaDataOther = renamevars(raw_IEA_Other, "Var2" , "PRODUCT" ); ieaDataOther = movevars(ieaDataOther, 'Coal' , 'Before' , 'Coal_1' ); ieaDataOther = movevars(ieaDataOther, 'Coal_1' , 'Before' , 'Coal_2' ); 16 74 ieaDataOther = movevars(ieaDataOther, 'Coal_2' , 'After' , 'Total_2' ); ieaDataRawMerged = [raw_IEA;ieaDataOther]; % We have 2015, 2018, 2019 data. Keeping only 2019 data. ieaData = removevars(ieaDataRawMerged,3:24); % Taking absolute values of everything % Negative values were transformation. Not needed. %ieaData = abs(ieaData) % Combining fuels to our aggregated fuels ieaData.oil = ieaData.CrudeOil_2 + ieaData.OilProducts_2; % Crude oil and oil products ieaData.renewables = ieaData.Nuclear_2 + ieaData.Hydro_2 + ieaData.Solar_Wind_Etc__2; ieaData.elAndHeat = ieaData.Electricity_2 + ieaData.Heat_2; ieaVars = [ "sector" "country" "natGas" "bio" "total" "coal" ]; ieaData = renamevars(ieaData, [ "Var1" "PRODUCT" "NaturalGas_2" "BiofuelsAndWaste_2" "Total_2" "Coal_2" ], ieaVars); ieaData = ieaData(:, ["country" "sector" "coal" "oil" "natGas" "bio" "renewables" "elAndHeat" ]); ieaData = categorizer(ieaData, 2); % % Removing IEA regions % ieaData((ieaData.country == "Africa" | ... % ieaData.country == 'Memo: European Union-27' | ... % ieaData.country == 'Memo: European Union-28' | ... % ieaData.country == 'Memo: FSU 15' | ... % ieaData.country == 'Memo: IEA Total' | ... % ieaData.country == 'Memo: Non-OECD Total' | ... % ieaData.country == 'Memo: OECD Total' | ... % ieaData.country == 'Non-OECD Americas' | ... % ieaData.country == 'Non-OECD Asia (excluding China)' | ... % ieaData.country == 'Non-OECD Europe and Eurasia' | ... % ieaData.country == 'OECD Americas' | ... % ieaData.country == 'OECD Asia Oceania' | ... % ieaData.country == 'OECD Europe' | ... % ieaData.country == 'World'), :) = []; ieaDataSanity = ieaData; % Sorting out naming differences. countriesIEA = unique(ieaData.country); countriesPWT = unique(countriesPWTRICE.country); inIEAnotPWT = setdiff(countriesIEA, countriesPWT); inPWTnotinIEA = setdiff(countriesPWT,countriesIEA); ieaData.country = renamecats(ieaData.country, ... [ "Bolivarian Republic of Venezuela" ... "Chinese Taipei" ... "Curaçao/Netherlands Antilles" ... "Democratic Republic of the Congo" ... "Hong Kong (China)" ... "Islamic Republic of Iran" ... "Korea" ... 17 75 "Lao People's Democratic Republic" ... "People's Republic of China" ... "Plurinational State of Bolivia" ... "Republic of North Macedonia" ... "Republic of the Congo" ... "Slovak Republic" ... "United Republic of Tanzania" ], ... [string(countriesPWT(countriesPWT == "Venezuela (Bolivarian Republic of)" )), ... string(countriesPWT(countriesPWT == "Taiwan" )), ... string(countriesPWT(countriesPWT == "Curaçao" )), ... string(countriesPWT(countriesPWT == "D.R. of the Congo" )), ... string(countriesPWT(countriesPWT == "China, Hong Kong SAR" )), ... string(countriesPWT(countriesPWT == "Iran (Islamic Republic of)" )), ... string(countriesPWT(countriesPWT == "Republic of Korea" )), ... string(countriesPWT(countriesPWT == "Lao People's DR" )), ... string(countriesPWT(countriesPWT == "China" )), ... string(countriesPWT(countriesPWT == "Bolivia (Plurinational State of)" )), ... string(countriesPWT(countriesPWT == "North Macedonia" )), ... string(countriesPWT(countriesPWT == "Congo" )), ... string(countriesPWT(countriesPWT == "Slovakia" )), ... string(countriesPWT(countriesPWT == "U.R. of Tanzania: Mainland" ))]); countriesIEAcheck = unique(ieaData.country); ieaDataSanity2 = ieaData; % Merging these three input-output types into electricity production ieaData.sector = mergecats(ieaData.sector, ... [{ 'Electricity Plants' } { 'CHP Plants' } ], "4 electricity" ); ieaData.sector = mergecats(ieaData.sector, ... [{ 'Residential' } { 'Commercial and public services' } { 'Agriculture/forestry' } { 'Fishing' }], "3 other" ); ieaData.sector = mergecats(ieaData.sector, ... [{ 'Industry' }], "2 industry" ); ieaData.sector = renamecats(ieaData.sector, ... [ "Transport" ], ... [ "1 transport" ]); ieaDataSanity2b = ieaData; % Summing over grouped categories % Taking aboslute value to get rid of negative entries (transformation in raw data) 18 76 ieaData = varfun(@(x) sum(abs(x)), ieaData , "GroupingVariables" , ["country" "sector" ], ... "InputVariables" ,3:8); ieaDataSanity3 = ieaData; % The following for-loop is based on help from mathworks.com forum % https://se.mathworks.com/matlabcentral/answers/1710975-how-to- conditionally-and-by-groups-subtract-one-row-from-another-in-table % Find the available countries countries = unique(ieaData.country); ieaData = removevars(ieaData, [ "GroupCount" ]); ieaData = renamevars(ieaData, 3:8, [ "coal" "oil" "natGas" "bio" "renew" "elAndHeat" ]); % Loop through the available countries computing the net consumption for % each endRow = size(ieaData,1); % current ending row number for k = 1:numel(countries) % sum the supplies and consumption idl = ieaData.sector == "Total energy supply" & ieaData.country == countries(k); totalSupply = sum(ieaData{idl,3:end},1); idl = ieaData.sector == "Total final consumption" & ieaData.country == countries(k); totalConsumption = sum(ieaData{idl,3:end},1); idl = ieaData.sector == "4 electricity" & ieaData.country == countries(k); totalElectricity = sum(ieaData{idl,3:end},1); % compute net misc = totalSupply -totalConsumption - totalElectricity; % and add row endRow = endRow + 1; newRow = ieaData(find(idl),:); % base on any of the current matching rows newRow.sector = "misc" ; newRow{1,3:end} = misc; ieaData(endRow,:) = newRow; end % Does not make sense to perform misc. operation on electricity and total ieaData{ieaData.sector == "misc" , [ "elAndHeat" ]} = 0; ieaData = sortrows(ieaData, 'country' ,'ascend' ); ieaDataSanity4 = ieaData; % For each country, add misc to the sectors according to fuel shares endRow = size(ieaData,1); % current ending row number for k = 1:numel(countries) 19 77 % take out vectors for each sector idl = ieaData.sector == "1 transport" & ieaData.country == countries(k); transport = ieaData{idl,3:end}; idl = ieaData.sector == "2 industry" & ieaData.country == countries(k); industry = ieaData{idl,3:end}; idl = ieaData.sector == "3 other" & ieaData.country == countries(k); other = ieaData{idl,3:end}; idl = ieaData.sector == "Total final consumption" & ieaData.country == countries(k); totalConsumption = ieaData{idl,3:end}; idl = ieaData.sector == "misc" & ieaData.country == countries(k); misc = ieaData{idl,3:end}; % calculate shares (5x1) each trSh = transport ./ totalConsumption; inSh = industry ./ totalConsumption; otSh = other ./ totalConsumption; % stack to get (3x5) to use dot product sh = [trSh;inSh;otSh]; miscMatrix = repmat(misc, 3, 1); % matrix of misc split across sectors and fuels miscSectors = sh .* miscMatrix; % and add row for transport endRow = endRow + 1; newRow = ieaData(find(idl),:); % base on any of the current matching rows newRow.sector = "misc tr" ; newRow{1,3:end} = miscSectors(1,:); ieaData(endRow,:) = newRow; % industry endRow = endRow + 1; newRow = ieaData(find(idl),:); % base on any of the current matching rows newRow.sector = "misc in" ; newRow{1,3:end} = miscSectors(2,:); ieaData(endRow,:) = newRow; % and other endRow = endRow + 1; newRow = ieaData(find(idl),:); % base on any of the current matching rows newRow.sector = "misc ot" ; newRow{1,3:end} = miscSectors(3,:); ieaData(endRow,:) = newRow; end 20 78 ieaDataSanity5 = ieaData; % Merging misc. with corresponding sectors and summing again ieaData.sector = mergecats(ieaData.sector, ... [{ '1 transport' 'misc tr' }], "1 transport" ); ieaData.sector = mergecats(ieaData.sector, ... [{ '2 industry' 'misc in' }], "2 industry" ); ieaData.sector = mergecats(ieaData.sector, ... [{ '3 other' 'misc ot' }], "3 other" ); % omitnan is important since previous step gave 0/0 for some fuels in some regions ieaData = varfun(@(x) sum(x, "omitnan" ), ieaData , "GroupingVariables" , ["country" "sector" ], ... "InputVariables" ,3:8); ieaData = removevars(ieaData, [ "GroupCount" ]); ieaData = renamevars(ieaData, 3:8, [ "coal" "oil" "natGas" "bio" "renew" "elAndHeat" ]); ieaDataSanity6 = ieaData; % For each country, add energy own use and losses in electricity to sectors endRow = size(ieaData,1); % current ending row number for k = 1:numel(countries) % take out vectors for each sector idl = ieaData.sector == "4 electricity" & ieaData.country == countries(k); el = ieaData{idl, "elAndHeat" }; idl = ieaData.sector == "1 transport" & ieaData.country == countries(k); transport = ieaData{idl, "elAndHeat" }; idl = ieaData.sector == "2 industry" & ieaData.country == countries(k); industry = ieaData{idl, "elAndHeat" }; idl = ieaData.sector == "3 other" & ieaData.country == countries(k); other = ieaData{idl, "elAndHeat" }; idl = ieaData.sector == "Total final consumption" & ieaData.country == countries(k); totalConsumption = ieaData{idl, "elAndHeat" }; % eiou is Energy industry own use + Losses = Elec - cons eiou = el - totalConsumption; % calculate shares (1x1) each trSh = transport / totalConsumption; inSh = industry / totalConsumption; otSh = other / totalConsumption; % stack to get (3x1) to use dot product sh = [trSh;inSh;otSh]; eiouVector = repmat(eiou, 3,1); 21 79 % matrix of electricity energy own use split across sectors eiouSectors = sh .* eiouVector; eiouRow = zeros(3,6); eiouRow(:,6) = eiouSectors; % and add row for transport endRow = endRow + 1; newRow = ieaData(find(idl),:); % base on any of the current matching rows newRow.sector = "eiou tr" ; newRow{1,3:end} = eiouRow(1,:); ieaData(endRow,:) = newRow; % industry endRow = endRow + 1; newRow = ieaData(find(idl),:); % base on any of the current matching rows newRow.sector = "eiou in" ; newRow{1,3:end} = eiouRow(2,:); ieaData(endRow,:) = newRow; % and other endRow = endRow + 1; newRow = ieaData(find(idl),:); % base on any of the current matching rows newRow.sector = "eiou ot" ; newRow{1,3:end} = eiouRow(3,:); ieaData(endRow,:) = newRow; end ieaDataSanity7 = ieaData; % Merging misc. with corresponding sectors and summing again ieaData.sector = mergecats(ieaData.sector, ... [{ '1 transport' 'eiou tr' }], "1 transport" ); ieaData.sector = mergecats(ieaData.sector, ... [{ '2 industry' 'eiou in' }], "2 industry" ); ieaData.sector = mergecats(ieaData.sector, ... [{ '3 other' 'eiou ot' }], "3 other" ); % omitnan is important since previous step gave 0/0 for some fuels in some regions ieaData = varfun(@(x) sum(x, "omitnan" ), ieaData , "GroupingVariables" , ["country" "sector" ], ... "InputVariables" ,3:8); ieaData = removevars(ieaData, [ "GroupCount" ]); ieaData = renamevars(ieaData, 3:8, [ "coal" "oil" "natGas" "bio" "renew" "elAndHeat" ]); ieaDataSanity8 = ieaData; % Cleaning and deleting 22 80 ieaData(ieaData.sector == "Total energy supply" ,:) = []; ieaData(ieaData.sector == "Total final consumption" ,:) = []; ieaData(ieaData.sector == "Energy industry own use" ,:) = []; ieaData(ieaData.sector == "misc" ,:) = []; ieaData.sector = removecats(ieaData.sector, [ "Total energy supply" ... "Total final consumption" ... "Energy industry own use" ... "misc" ]); % Unstacking to get sector-wise usage of each fuel (incl. electricity % as sector) ieaDataUnstacked = unstack(ieaData, [ "coal" "oil" "natGas" "renew" "bio" "elAndHeat" ], "sector" ); % Summing over fuel use in sectors to get total fuel use per country coalVars = contains(ieaDataUnstacked.Properties.VariableNames(:), "coal" , "IgnoreCase" ,true); oilVars = contains(ieaDataUnstacked.Properties.VariableNames(:), "oil" , "IgnoreCase" ,true); natGasVars = contains(ieaDataUnstacked.Properties.VariableNames(:), "natGas" , "IgnoreCase" ,true); bioVars = contains(ieaDataUnstacked.Properties.VariableNames(:), "bio" , "IgnoreCase" ,true); renewVars = contains(ieaDataUnstacked.Properties.VariableNames(:), "renew" , "IgnoreCase" ,true); elAndHeatVars = contains(ieaDataUnstacked.Properties.VariableNames(:), "elAndHeat" , "IgnoreCase" ,true); ieaDataUnstacked.coal = sum(ieaDataUnstacked{:,coalVars},2); ieaDataUnstacked.oil = sum(ieaDataUnstacked{:,oilVars},2); ieaDataUnstacked.natGas = sum(ieaDataUnstacked{:,natGasVars},2); ieaDataUnstacked.bio = sum(ieaDataUnstacked{:,bioVars},2); ieaDataUnstacked.renew = sum(ieaDataUnstacked{:,renewVars},2); ieaDataUnstacked.elAndHeat = sum(ieaDataUnstacked{:,elAndHeatVars},2); save( "wrangling.mat" , "ieaData" , "-append" ); save( "wrangling.mat" , "ieaDataUnstacked" , "-append" ); %save("rawData.mat", "raw", "-append"); else load( "wrangling.mat" , "ieaData" ); load( "wrangling.mat" , "ieaDataUnstacked" ); %load("rawData.mat", "raw"); end % END IEA WRANGLING PWT TRANSPORT CAPITAL DETAIL DATA % PWT data is only for transport equipent, while OECD has for the whole % sector. I think we are better off extrapolating OECD data than using % negatively biased PWT data. 23 81 % raw.pwtTransData = readtable("raw_data\pwt100-capital-detail.xlsx", Sheet="Data"); % pwtTransData = raw.pwtTransData(raw.pwtTransData.year == 2019,["countrycode" "Nc_Mach" "Nc_Struc" "Nc_TraEq" "Nc_Other"]); % pwtTransData = categorizer(pwtTransData, 1); % pwtTransData.capStock = pwtTransData.Nc_Mach + pwtTransData.Nc_Struc + pwtTransData.Nc_TraEq + pwtTransData.Nc_Other; % pwtTransData.transCapShPWT = pwtTransData.Nc_TraEq ./ pwtTransData.capStock; % pwtTransData = pwtTransData(:, ["countrycode" "transCapShPWT"]); % END PWT TRANSPORT SHARE WRANGLING OECD CAPITAL DETAILS DATA () if wrangle.OECD == 1 raw.OECD = readtable( "raw_data\oecd capital data.csv" ); oecdDataAll = raw.OECD(:, ["LOCATION" "Country" "Variable" "Industry" "Time" "Value" ]); oecdDataAll = categorizer(oecdDataAll, 4); oecdDataAll = oecdDataAll(oecdDataAll.Variable == 'Net capital stock, volumes' ,:); % For sectors keep = [{ 'TOTAL' 'Agriculture, hunting, forestry and fishing [A]' 'Mining and quarrying [B]' 'Manufacturing [C]' 'Electricity, gas, steam and air conditioning supply [D]' 'Water supply; sewerage, waste management and remediation activities [E]' 'Construction [F]' 'Wholesale and retail trade, repair of motor vehicles and motorcycles [G]' 'Transportation and storage [H]' 'Accommodation and food service activities [I]' 'Information and communication [J]' 'Financial and insurance activities [K]' 'Real estate activities [L]' 'Professional, scientific and technical activities [M]' 'Administrative and support service activities [N]' 'Public administration and defence; compulsory social security [O]' 'Education [P]' 'Human health and social work activities [Q]' 'Arts, entertainment and recreation [R]' 'Other service activities [S]' }]; oecdData = oecdDataAll(ismember(oecdDataAll.Industry, keep),:); oecdData = renamevars(oecdData, ... [ "LOCATION" "Country" "Industry" "Time" ], ... 24 82 [ "countrycode" "country" "sector" "year" ]); transportSector = [{ 'Transportation and storage [H]' }]; industrySector = [{ 'Manufacturing [C]' } { 'Construction [F]' } { 'Mining and quarrying [B]' } { 'Electricity, gas, steam and air conditioning supply [D]' }]; otherSector = [{ 'Agriculture, hunting, forestry and fishing [A]' } { 'Water supply; sewerage, waste management and remediation activities [E]' } { 'Wholesale and retail trade, repair of motor vehicles and motorcycles [G]' } { 'Accommodation and food service activities [I]' } { 'Information and communication [J]' } { 'Financial and insurance activities [K]' } { 'Real estate activities [L]' } { 'Professional, scientific and technical activities [M]' } { 'Administrative and support service activities [N]' } { 'Public administration and defence; compulsory social security [O]' } { 'Education [P]' } { 'Human health and social work activities [Q]' } { 'Arts, entertainment and recreation [R]' } { 'Other service activities [S]' }]; oecdData.sector = mergecats(oecdData.sector, transportSector, "Transport (and storage)" ); oecdData.sector = mergecats(oecdData.sector, industrySector, "Industry (manufacturing and construction)" ); oecdData.sector = mergecats(oecdData.sector, otherSector, "Other" ); % Unstacking to get a variable per sector (a wider table, one country per row) oecdData = unstack(oecdData, "Value" ,"sector" ,... "VariableNamingRule" ,"preserve" ); oecdData = renamevars(oecdData, ... [ "Transport (and storage)" "Industry (manufacturing and construction)" "Other" "TOTAL" ], ... [ "transCap" "indCap" "othCap" "totalCap" ]); oecdData.transCapSh = oecdData.transCap ./ oecdData.totalCap; oecdData.indCapSh = oecdData.indCap ./ oecdData.totalCap; oecdData.othCapSh = 1 - oecdData.transCapSh - oecdData.indCapSh; oecdData.sanity = oecdData.transCapSh + oecdData.indCapSh + oecdData.othCapSh; % Sanity check failed for several countries % Some are just missing "other" categories --> now using reciprocal % Delete Ireland and Israel. They are missing manufacturing. oecdData((oecdData.country == "Ireland" | oecdData.country == "Israel" ),:) = []; oecdData(isnan(oecdData.transCap),:) = []; % Manually keeping most recent data [XXX Automate] oecdData = oecdData([2 4 6 7 9 11 13 15 16 18 20 22 23 25 27 28 30 32 33 34 35 37 38 40 42 44 47 50 55],:); 25 83 oecdData = oecdData(:,[ "countrycode" "transCapSh" "indCapSh" "othCapSh" ]); save( "wrangling.mat" , "oecdData" , "-append" ); %save("rawData.mat", "raw.OECD", "-append"); else load( "wrangling.mat" , "oecdData" ); %load("rawData.mat", "raw.OECD"); end US BLS DETAILED CAPITAL DATA FOR FUEL CAPITAL USE % Getting total capital in US coal/oil/gas production and refinement. % if wrangle.USBLS == 1 raw_USBLS = readtable( "raw_data\USBLS cap_details.xlsx" , Sheet= "Data" , VariableNamesRange= "A1" , DataRange= "A2" ); usblsVars = [ "sector" "type" "category" "unit" "value" ]; usblsDataAll = renamevars(raw_USBLS, [ "NAICSTitle" "MeasureTitle" "AssetCategory" "DurationTitle" "x2019" ], usblsVars); usblsDataAll = usblsDataAll(:,usblsVars); usblsDataAll = categorizer(usblsDataAll,4); % Note: Convert to 2017 dollars (PWT uses 2017) usblsDataAll = usblsDataAll(usblsDataAll.type == "Productive capital stock (direct aggregate-billions of 2012 dollars)" , :); usblsDataAll = usblsDataAll(usblsDataAll.category == "All assets" , :); usblsDataAll = usblsDataAll(usblsDataAll.unit == "Levels" , :); usblsData = usblsDataAll( ... (usblsDataAll.sector == "Oil and gas extraction" | ... usblsDataAll.sector == "Mining, except oil and gas" | ... usblsDataAll.sector == "Petroleum and coal products" | ... usblsDataAll.sector == "Pipeline transportation" ), :); % The direct capital stock % NOTE: This used PWT in millions, which is later changed to just ones. usblsFossilCapSum = sum(usblsData.value); % In billions 2012 USD usblsFossilCap = 1.0676 * usblsFossilCapSum; % In billions 2017 USD using https://www.in2013dollars.com/us/inflation/2012 usblsFossilCap = 1000 * usblsFossilCap; % PWT uses millions 2017 USD. PWTcapUS = 69059088; usblsFCsh = usblsFossilCap / PWTcapUS; % About 5,8% of total US capital stock share of PWT. Seems high? % Capital stock as share of total usblsTotCap = sum([2620.40700000000;2913.24600000000; ... 3198.02200000000;840.280000000000;6422.82200000000; ... 5284.94200000000;1949.82800000000;3703.83500000000; ... 2097.87400000000;7141.95100000000;1033.88200000000; ... 753.843000000000;519.944000000000;908.600000000000; ... 1886.45500000000;300.480000000000]); 26 84 usblsTotCap = usblsTotCap * 1067,6; usblsGovCap = 18739.076 * 1067,6; usblsCapSh = usblsFossilCap / (usblsTotCap+usblsGovCap); % This method gave 9% of total capital share. Maybe this data only % has private sector? % Added government, now it is 6,2% of total capital. % Average of 5,8% and 6,2% is 6%. Six percent of total capital % should go to fossil fuel extraction. This gives \bar(K), which % must be subtracted from capital in indstry to avoid double % counting % save("calibData.mat", "usblsFossilCap", "-append"); % else % load("calibData.mat", "usblsFossilCap"); % end CHINA CAPITAL DETAILS Manually extracted 2019 capital data from China Statistical Yearbook 2020 The following sectors: 'Mining and Wash- ing of Coal' 'Extraction of Petroleum and Natural Gas' 'Professional and Support Activities for Mining' 'Processing of Petroleum, Coal and Other Fuels' raw_ChinaCapDetails = readtable( "raw_data\china capital details.csv" ); chinaCapData = categorizer(raw_ChinaCapDetails, 1); chinaCapData.capStock = chinaCapData.totalAssets - chinaCapData.currentAssets; chinaCapIndTotal = chinaCapData{1, "capStock" }; % 100 million 2019 Yuan chinaCapFossil = sum(chinaCapData{2:5, "capStock" }); % 100 million 2019 Yuan chinaCapFossil = chinaCapFossil * 100; % To million 2019 Yuan chinaCapFossil = chinaCapFossil / PWT{PWT.countrycode == "CHN" , "xr" } ; % Converted from million 2019 Yuan to million 2019 USD chinaCapFossil = 0.96 * chinaCapFossil; % To 2017 USD chinaCapFossilSh = chinaCapFossil / PWT{PWT.countrycode == "CHN" , "cn" }; % constists of 1% of total capital. % Total assets method chinaTotalAssetsFossil = sum(chinaCapData.totalAssets(2:5)); chinaTotalAssetsFossil = (chinaTotalAssetsFossil * 100 * 0.96) / PWT{PWT.countrycode == "CHN" , "xr" }; chinaCapShTotAsSh = chinaTotalAssetsFossil / PWT{PWT.countrycode == "CHN" , "cn" }; % this method gives 1.55% --> I use this one. % Implies Russia 3% % RUSSIA: % https://www.investopedia.com/articles/markets/082615/5-biggest-russian- natural-gas-companies.asp % Got total assets from there 27 85 PART 2: COMBINING PRE-PROCESSED DA- TA INTO USABLE SPREADSHEETS FOR CALIBRATION %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%% MERGING FOR FINAL GOOD SECTORS CALIBRATION Combining data: PWT, UN, WIOD, ILOSTAT, OECD if wrangle.sectors == 1 % WIOD/UN MERGE finalGoodSectors = outerjoin(wiodData, unData, Keys= "countrycode" , MergeKeys=true); % Manually merging variables (XXX Could automate or shorten?) % Year variables isUndefined = isundefined(finalGoodSectors.year_wiodData); finalGoodSectors.year_wiodData(isUndefined) = finalGoodSectors.year_unData(isUndefined); finalGoodSectors(:, "year_unData" ) = []; % Sector variables isUndefined = isundefined(finalGoodSectors.sector_wiodData); finalGoodSectors.sector_wiodData(isUndefined) = finalGoodSectors.sector_unData(isUndefined); finalGoodSectors(:, "sector_unData" ) = []; % Value variables isUndefined = isnan(finalGoodSectors.sum_value_wiodData); % Numbers use NAN, categories <undefined> finalGoodSectors.sum_value_wiodData(isUndefined) = finalGoodSectors.sum_value_unData(isUndefined); finalGoodSectors(:, "sum_value_unData" ) = []; % Renaming variables to tidy up finalGoodSectors = renamevars(finalGoodSectors, ["country_unData" "year_wiodData" "sector_wiodData" "sum_value_wiodData" ], ... [ "country" "year" "sector" "output" ]); % Exporting list of countries with missing sector data countriesWithoutSectors = [finalGoodSectors.country(isnan(finalGoodSectors.output)) finalGoodSectors.countrycode(isnan(finalGoodSectors.output))]; % For now, I 'm just dropping the small countries for which there is no % PWT data. 28 86 finalGoodSectors(isundefined(finalGoodSectors.countrycode),:) = []; % Unstacking sectorData to get a variable per sector (a wider table) finalGoodSectors = unstack(finalGoodSectors, "output" ,"sector" ,... "AggregationFunction" ,@(x)x(~isempty(x)), "VariableNamingRule" ,"preserve" ); % Getting sectors as shares of output finalGoodSectors.totalShare = finalGoodSectors{:, "Total Economy" } ./ finalGoodSectors{:, "Total Economy" }; finalGoodSectors.transportShare = finalGoodSectors{:, "Transport (and storage)" } ./ finalGoodSectors{:, "Total Economy" }; finalGoodSectors.industryShare = finalGoodSectors{:, "Industry (manufacturing and construction)" } ./ finalGoodSectors{:, "Total Economy" }; finalGoodSectors.otherShare = finalGoodSectors.totalShare - finalGoodSectors.transportShare - finalGoodSectors.industryShare; % As reciprocial because poor data finalGoodSectors.sanityShare = finalGoodSectors.industryShare + finalGoodSectors.transportShare + finalGoodSectors.otherShare; % % Some countries do not sum to unity if reciprocal method isn't % % used % poorDataCountries = sectorData(sectorData.sanityShare < 0.9,:); % goodDataCountries = sectorData(sectorData.sanityShare > 0.99,:); % poorDataSum = summary(poorDataCountries); % goodDataSum = summary(goodDataCountries); % Doing single year to use 2019 only (and 2014 for those few WIOD % countries). Full data: 2019 has 114 countries, 2018 125, 2017 130. % NOTABLE missing shares from 2019: % Canada, Egypt, Japan, Korea, Philippines, UK % Missing shares if 2018: % Canada, Egypt, Phillipines % If 2017: % Egypt, Phillipines (non-recoverable % I choose 2019 as base year, but use older data for those with no % 2019 data. NOTE: Year 9999 are missing countries from UN, but kept for % regional extrapolation. finalGoodSectors = finalGoodSectors( ... (finalGoodSectors.year == "2014" | ... finalGoodSectors.year == "2019" | ... finalGoodSectors.year == "9999" | ... finalGoodSectors.country == "Japan" | ... finalGoodSectors.country == "Canada" | ... finalGoodSectors.country == "United Kingdom" | ... finalGoodSectors.country == "Republic of Korea" | ... finalGoodSectors.country == "Yemen" ),:); finalGoodSectors((finalGoodSectors.country == "Japan" & (finalGoodSectors.year == "2017" | isnan(finalGoodSectors.otherShare))), :) = []; 29 87 finalGoodSectors((finalGoodSectors.country == "Republic of Korea" & (finalGoodSectors.year == "2017" | isnan(finalGoodSectors.otherShare))), :) = []; finalGoodSectors((finalGoodSectors.country == "United Kingdom" & (finalGoodSectors.year == "2017" | isnan(finalGoodSectors.otherShare))), :) = []; finalGoodSectors((finalGoodSectors.country == "Canada" & isnan(finalGoodSectors.otherShare)),:) = []; finalGoodSectors((finalGoodSectors.country == "Yemen" & isnan(finalGoodSectors.otherShare)),:) = []; %sectorData = sectorData((sectorData.year == "2014" | sectorData.year == "2018"),:); %sectorData = sectorData(sectorData.sector == 'Total Economy',:); % Keeping only needed vars (dropping year, even if not all ==2019. % See previous point). finalGoodSectors = finalGoodSectors(:, ["countrycode" "country" "rice_code" "rice_region" "transportShare" "industryShare" "otherShare" ]); % GDP, CAPITAL, EMPLOYMENT MERGE FROM PWT finalGoodSectors = outerjoin(finalGoodSectors,PWT, "Keys" ,"countrycode" ,"MergeKeys" ,true); finalGoodSectors = finalGoodSectors(:, ["country_PWT" "countrycode" "rice_code_PWT" "rice_region_PWT" ... "thesisCode" "cgdpo" "cn" "emp" "transportShare" "industryShare" "otherShare" "labsh" "labshExt" ]); finalGoodSectors = renamevars(finalGoodSectors, [ "country_PWT" "rice_code_PWT" "rice_region_PWT" ], [ "country" "rice_code" "rice_region" ]); % MERGING WITH ILOSTAT ALSO finalGoodSectors = outerjoin(finalGoodSectors, ilostatData); %sectorLabor.Sanity = sectorLabor.otherLabSh + sectorLabor.industryLabSh + sectorLabor.transportLabSh; % sanity check passed finalGoodSectorsSanity = finalGoodSectors; % Deleting small countries without PWT data finalGoodSectors(isundefined(finalGoodSectors.country_finalGoodSectors), :) = []; %sectorData = removevars(sectorData, "country_ilostatData"); % MERGING WITH OECD CAPITAL SHARE DATA finalGoodSectors = outerjoin(finalGoodSectors,oecdData); finalGoodSectors = renamevars(finalGoodSectors, ... [ "country_finalGoodSectors" "countrycode_finalGoodSectors" ], ... [ "country" "countrycode" ]); 30 88 % MERGING WITH PWT CAPITAL IN TRANSPORT DATA % sectorData = outerjoin(sectorData,pwtTransData); % sectorData = renamevars(sectorData, "countrycode_sectorData", "countrycode"); % sectorData.tranSanity = sectorData.transCapSh - sectorData.transCapShPWT; % Sanity check failed. OECD >> PWT. Off by up to 10 percetage points. % PWT data is only for 'transport equipment', OECD has all capital in % the sector which could include more than just the equipment. % Conclusion: Dropping PWT data. % % MERGING WITH IEA VOLUME DATA % sectorDataWithIEA = outerjoin(sectorData, ieaDataUnstacked); % % MERGING WITH REGION CODES finalGoodSectors = outerjoin(finalGoodSectors, countriesPWTRICE, Keys= "countrycode" , MergeKeys=true); % Deleting small countries without PWT data %sectorData(isundefined(sectorData.country_sectorData), :) = []; %sectorData = removevars(sectorData, ["country"]); finalGoodSectors = renamevars(finalGoodSectors, ... [ "country_finalGoodSectors" "rice_code_finalGoodSectors" "rice_region_finalGoodSectors" "thesisCode_finalGoodSectors" ], ... [ "country" "rice_code" "rice_region" "thesisCode" ]); finalGoodSectors = sortrows(finalGoodSectors, "countrycode" ); finalGoodSectors = sortrows(finalGoodSectors, "countrycode" , "ascend" ); sectorDataPreInterpol = finalGoodSectors; save( "calibData.mat" , "sectorDataPreInterpol" , "-append" ); else load( "calibData.mat" , "sectorDataPreInterpol" ); end MERGING AND PREPARING INTERMEDIATE AND REFINED ENERGY SECTORS Data: IEA if wrangle.energy == 1 valueset = 1:4; catnames = { 'transport' ,'industry' ,'other' , 'electricity' }; energyData = outerjoin(countriesPWTRICE, ieaData); energyDataSanity = energyData; 31 89 energyData(isundefined(energyData.countrycode),:) = []; energyData(isnan(energyData.coal),:) = []; energyData.sector = string(energyData.sector); energyData = sortrows(energyData, [ "countrycode" "sector" ], "ascend" ); %sizes2 = categorical(A2,valueset,catnames,'Ordinal',true) energyDataUnstacked = outerjoin(countriesPWTRICE, ieaDataUnstacked); energyDataUnstacked(isundefined(energyDataUnstacked.countrycode),:) = []; % Countries with no PWT data. energyDataUnstacked = sortrows(energyDataUnstacked, "countrycode" , "ascend" ); energyDataUnstacked(isnan(energyDataUnstacked.coal),:) = []; % Countries with no IEA data save( "calibData.mat" , "energyData" , "-append" ); save( "calibData.mat" , "energyDataUnstacked" , "-append" ); else load( "calibData.mat" , "energyData" , "energyDataUnstacked" ); end MERGING INTO ONE BIG SHEET wrangledData = outerjoin(finalGoodSectors, energyDataUnstacked, Keys= "countrycode" ); Functions %% %%%%%%%%%%%%%%% % Changes table variables to category-type. Easier to work with. function tab = categorizer(tabInput, numOfVars) for i = 1:numOfVars tabInput = convertvars(tabInput,tabInput.Properties.VariableNames{i}, 'categorical' ); end tab = tabInput; end Published with MATLAB® R2022a 32 90 Appendix F Calibration script 91 Table of Contents ........................................................................................................................................................ 1 1. SETUP .......................................................................................................................................... 2 GROWTH RATES .............................................................................................................................. 6 MISSING DATA INTERPOLATION IN FINAL GOOD SECTOR DATA ................................................... 7 REGIONAL AGGREGATION (of levels) ............................................................................................. 11 Calibration read-ins (bottom-->top) ...................................................................................................... 13 Calibration coefficient equations .......................................................................................................... 15 Initialization of other coefficients ......................................................................................................... 17 Production calculation ........................................................................................................................ 18 Need input vectors to carry out calculation: ........................................................................................... 19 Refined primary energy production: ...................................................................................................... 19 Electricity sector ............................................................................................................................... 20 Intermediate sector (sector specific energy composite): ............................................................................ 20 Final good production sector: .............................................................................................................. 20 Final good aggregation sector: ............................................................................................................. 21 Diffusion model ................................................................................................................................ 21 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % ACE native production system % % last edited 05/24/22 % ANDREAS SYNC CHECK 16:22 CT 5:01 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % README %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%% % - Required add-ons: Statistical and Machine learning package (for regress function) % % - Pick correct region before running code, at first headline in SETUP. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%% % MATRIX ORDERS %%% % % a) Sectors are ALWAYS ordered (1) Transport (2) Industry (3) Other % % b) Fuels are ordered % EITHER % Coal, oil, natgas, bio, renew [into elec] % OR % Coal, oil, natgas, bio, elect [into int (d)] % so it is the fifth input that changes. % % c) *Regions* are always columns, while *sectors* or *fuels* are rows. % Table of contents % 1. Setup (load data, set code logicals, pick region and substitutabilities) 1 92 % 2. Growth rate calculations % 3. Missing data interpolations % 4. Regional aggregation % 5. Calibration input data read-in % 6. Calibration calculations % 7. Production calculations % LOADED DATASETS % pwtDynamic: Used for growth rates. PWT 2010-2019. % finalGoods Data: Final good sectors. PWT, UN, WIOD, OECD, ILOSTAT. % energyData: IEA energy data (matrix form, 4 rows per country) % energyDataUnstacked: IEA energy data (one row per country, wider) % wPriceLevel: Vector of regional price levels for thesis % CALIBRATION INPUT TABLE NAMES (Interpolated and regionalized) % growthRates = Regional growth rates [XXX and World coming] % finalGoods = Regional final good sector % energyMatrix & energy = energy data in matrix and one-row form, resp. % UNITS (after conversions) % Final good sector: Real GDP (in PPP 2017USD) -- NOTE: Original PWT is in millions. This is just in ones. % Energy: Terajoules (can consider Megajoules instead) % Emissions: kg CO2 % Price of energy: USD/TJ (PPP) % Price of emissions: USD/kg % Notes: % - all production parameters are in the prod structure, e.g.: prod.a_fin, prod.alpha_fin % - all calibration inputs are in the calib structure. % - initial state values are initial. % Code is called by RegionalACE, requiring calibrate_calculate being defined: % = 1 : calibration % = 2 : calculation % = 3 : both (if using file as stand-alone, uncomment next line) %clear all; calibrate_calculate = 3; recycle_mat_files = 0; % NOTE CT: % % Overwritten alpha in the main code by hand for the moment subracting nu*alpha_bar % if calibrate_calculate == 1 | 3 1. SETUP %clear all %clc 2 93 if recycle_mat_files == 0 load( 'calibData.mat' ); % Data import from wrangling.m prod.structure = 'ACE native' ; production.gr = 1; production.interpolate = 1; production.regionalize = 1; production.calibration_input=1; % Initialize parameters and variables with data input production.coefficients=1; % to calibrate the production system %production.calculation=1; % to use the file for simulating production %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Remove comment for selected region % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% regionSelected = "thesisCode" ; % is WORLD, 1 is LOW, 2 is HIGH %regionSelected = "rice_code"; % NOTE: Will be biased until alpha bar and prices are RICE-regionalized %regionSelected = "country_code"; % NOTE: Will not work until correspondance between IEA data and rest is sorted. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Substitutabiity parameters in different sectors: % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % World parameters prod.agg_s = -1; % Subst. at aggregation level prod.agg_sbar = 1; % Returns to scale prod.int_s = [-4 -.0001 .1667]'; % Subst. energy intermediate sectors prod.int_s_0 = .444; % Subst. in electricity production %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Avg. Fossil industry capital share of total capital % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Used to get alpha bars, which are extrapolated fossilCapShareUS = 0.055; % Source USBLS (2019 data), China, Russia fossilCapShareCHN = 0.0155; % Source Chn. stat. yearbook 2020. fossilCapShareRUS = 0.03; % Source various. %%%%%%%%%%%%% % Alpha bar % %%%%%%%%%%%%% % US alpha bar: 0.7723 (based on 5.5% capital) % Chinese: 0.283 (1.55%) % Russian: 0.469 (3%) alphaBarH = 0.712 % 80/20 avg of US and Russia alphaBarL = 0.283 % Chinese data. alphaBarH = 0.1 alphaBarL = 0.05 alphaBarW = 0.8*alphaBarH + 0.2*alphaBarL; % Weighed by share of total fossil. 3 94 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % CO2 coefficients per fuel type % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % CO2 emissions should be in kg per TJ % [Coal, oil, gas, bio, renew]' co2Factors = [90762.95; 69247.51; 50148.00; 3462.38; 0]; % Observed emissions correction (IEA = 33.2 Gt) co2Factors = co2Factors .* 1.0463; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Average world refined energy prices % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Original units %%% % Coal: 83.16 USD per million tonne % Oil prodcuts: 71.64 USD per barrel % Nat. gas: 3.13 USD per million Btu % Bio (ethanol): 1.25 USD per gallon % Bio (biodiesel): 800 USD per ton % Bio (wood pell): 166.25 per ton % Renew: 0,055 USD/kWh % 1 short ton = 0.90718474 tonne % Conversion factors (https://www.justintools.com/unit-conversion/ energy.php) % COAL % 1 Tonne of coal equivalent = 0.029288 TJ % OIL PRODUCTS % Barrel to tonnes (oil products basket) = 0.124. BP Conversion factors % Tonne to gigajoule (oil products basket) = 43.076 BP Conversion factors % Gigajoule to terajoule = 0.001 % ===> 1 barrel = 0.005341424 TJ % NATURAL GAS % 1 000 000 Btu = 0.00105505585 TJ % BIO % Ethanol: 80000 Btu per gallon whivh gives 8.440448E-5 TJ % Biodiesel: 1 t biodiesel = 0,86 toe which is 0.03600648 TJ % Pellets: 1 t pellets = 5 MWh = 0.018 TJ % RENEW: % 1 kWh = 3.6E-6 TJ % Converting idiosyncratic units to USD/TJ price.coal = 83.16/0.029288; price.oil = 71.64/0.005341424; price.natGas = 3.13/0.00105505585; %price.bioE = 1.3/8.440448E-5; 4 95 %price.bioD = 850 / 0.03600648; price.bioW = 166.25 / 0.018; price.renew = 0.055 / 3.6E-6; % Vector of refined energy prices enePricesWorld = [ price.coal; price.oil; price.natGas; price.bioW; price.renew ]; % Electricity = price of renewables elPriceWorld = price.renew; % Setting prices for the two thesis regions enePricesHigh = enePricesWorld; elPriceHigh = elPriceWorld; % bioenergy price half in low-income countries enePricesLow = enePricesHigh .* [1 1 1 .5 1]'; elPriceLow = elPriceHigh; % Merging, converting from 2019 to 2017 and adjusting for PPP % Energy enePrices = [enePricesWorld enePricesLow enePricesHigh]; % regional matrix enePrices = enePrices .* 0.9588; % Inflation adjustment enePrices = enePrices ./ wPriceLevel'; % PPP correction % Electricity elPrices = [elPriceWorld elPriceLow elPriceHigh]; % Nominal 2019 USD. Row, one price for each region. elPrices = elPrices .* 0.9588 ; % Inflation adjusted. Row, one price for each region. elPrices = elPrices ./ wPriceLevel'; % PPP adjusted 2017 USD. %%%%%%%%%%%%%%%%%%%% % Emissions prices % %%%%%%%%%%%%%%%%%%%% % Finding world average emissions price emCoverage = 0.145; % World Bank estimate coverage rate emPriceCovered = 2.74887 % Weighted avg price of covered emissions, in 2017USD per TONNE co2 emPriceCovered = emPriceCovered / 1000; % to per kg co2 (emissions factors are in kg per TJ) emPriceWorld = emCoverage * emPriceCovered; % Avg world emissions price. % Setting emissions prices for two-region model emPriceL = 0; % No price initiatives in these countries emPriceH = emPriceWorld / 0.807; % 80.7 percent of tot. emissions are in H. 5 96 % Collecting and adjusting for PPP emPrices = [emPriceWorld emPriceL emPriceH;] % In USD/tCO2 - row vector emPricesKG = emPrices .* wPriceLevel'; % PPP adjusted (kg CO2) % Need same units as ene prices, for additivity. % This is a matrix: rows are fuels, columns are regions %emPricesTJ = co2Factors * emPrices; % In nom USD/TJ, for PPP sensitivity check emPricesTJ = co2Factors * emPricesKG; % in PPP USD/TJ % end setup GROWTH RATES (1) Takes pwtDynamic as input (2) Groups data into regions (3) Calculates growth rates for GDP and capital per region (4) Adds world growth rate on top of table (5) "growthRates" is output table (region is World) if production.gr == 1 % Aggregates GDP and capital over regions for each year and takes log transformations. % Runs a regression of logvars on constant and year to get avg. yearly growth rates. pwtDynamicRegional = varfun(@(x) sum(x, "omitnan" ), pwtDynamic, 'InputVariables' , ... [ "cgdpo" "cn" ] , 'GroupingVariables' , [regionSelected "year" ]); logs = varfun(@log, pwtDynamicRegional, "InputVariables" , ["Fun_cgdpo" "Fun_cn" ]); pwtDynamicRegional = [pwtDynamicRegional logs]; reg_gdp = varfun(@(x) regress(x, [ones(10,1) unique(pwtDynamicRegional.year)]), ... pwtDynamicRegional, 'InputVariables' , 'log_Fun_cgdpo' , 'GroupingVariables' , regionSelected); % pwtDynamicRegional, InputVariables="log_Fun_cgdpo", GroupingVariables=regionSelected); reg_cap =varfun(@(x) regress(x, [ones(10,1) unique(pwtDynamicRegional.year)]), ... pwtDynamicRegional, 'InputVariables' , 'log_Fun_cn' , 'GroupingVariables' , regionSelected); % pwtDynamicRegional, InputVariables="log_Fun_cn", GroupingVariables=regionSelected); gr_gdp = reg_gdp(2:2:end, :); gr_cap = reg_cap(2:2:end, :); growthRates = join(gr_gdp,gr_cap); % World % pwtDynamicWorld = varfun(@(x) sum(x, "omitnan"), pwtDynamic, InputVariables=["cgdpo" "cn"], GroupingVariables="year"); pwtDynamicWorld = varfun(@(x) sum(x, "omitnan" ), pwtDynamic, 'InputVariables' , [ "cgdpo" "cn" ] , 'GroupingVariables' , 'year' ); 6 97 logs = varfun(@log, pwtDynamicWorld, "InputVariables" , ["Fun_cgdpo" "Fun_cn" ]); pwtDynamicWorld = [pwtDynamicWorld logs]; reg_gdpW = regress(pwtDynamicWorld.log_Fun_cgdpo, [ones(10,1) unique(pwtDynamicWorld.year)]); reg_capW = regress(pwtDynamicWorld.log_Fun_cn, [ones(10,1) unique(pwtDynamicWorld.year)]) growthRatesWorld = [reg_gdpW(2) reg_capW(2)]; newRow = growthRates(1,:); newRow{1,regionSelected} = categorical(0); newRow{1,3:4} = growthRatesWorld; growthRates = [newRow; growthRates]; end % growth rate calculations MISSING DATA INTERPOLATION IN FINAL GOOD SECTOR DATA I use the regional averages to interpolate missing country-level data. This code interpolates over RICE regions, but it is possible to use other regions (after some cumbersome re-coding) if production.interpolate == 1 % Saving an untouched version finalGoodsData = sectorDataPreInterpol; % Finding GDP per capital stock and GDP per worker to use for % extrapolation finalGoodsData.capPerGdp = finalGoodsData{:, "cn" } ./ finalGoodsData{:, "cgdpo" }; finalGoodsData.empPerGdp = finalGoodsData{:, "emp" } ./ finalGoodsData{:, "cgdpo" }; % Finding mean of sectors in each region sectorDataRegionsMean = varfun(@(x) mean(x, 'omitnan' ), finalGoodsData, ... 'GroupingVariables' , [ "rice_region" "rice_code" ], ... 'InputVariables' , [ ... "cgdpo" ... "cn" ... "emp" ... "capPerGdp" ... "empPerGdp" ... "transportShare" ... "industryShare" ... "otherShare" ... "transportLabSh" ... "industryLabSh" ... "otherLabSh" ... "transCapSh" ... 7 98 "indCapSh" ... "othCapSh" ... "labsh" ]); % "othCapSh"]); and above: % GroupingVariables=["rice_region" "rice_code"], ... % InputVariables=[ ... % Applying regional mean shares to countries without sectoral data % Missing GDP shares for i = 1:12 if ~isempty(finalGoodsData((finalGoodsData.rice_code == string(i) & isnan(finalGoodsData.transportShare)),:)) % Filling in missing GDP shares from regional mean finalGoodsData.transportShare((finalGoodsData.rice_code == string(i) & isnan(finalGoodsData.transportShare))) = ... sectorDataRegionsMean{sectorDataRegionsMean.rice_code == string(i), "Fun_transportShare" }; finalGoodsData.industryShare((finalGoodsData.rice_code == string(i) & isnan(finalGoodsData.industryShare))) = ... sectorDataRegionsMean{sectorDataRegionsMean.rice_code == string(i), "Fun_industryShare" }; finalGoodsData.otherShare((finalGoodsData.rice_code == string(i) & isnan(finalGoodsData.otherShare))) = ... sectorDataRegionsMean{sectorDataRegionsMean.rice_code == string(i), "Fun_otherShare" }; else disp(i) end end % Missing capital data for i = 1:12 if ~isempty(finalGoodsData((finalGoodsData.rice_code == string(i) & isnan(finalGoodsData.cn)),:)) % Filling in missing capital data from cap/gdp mean % extrapolation of regional mean finalGoodsData.capPerGdp((finalGoodsData.rice_code == string(i) & isnan(finalGoodsData.capPerGdp))) = ... ectorDataRegionsMean{sectorDataRegionsMean.rice_code == string(i), "Fun_capPerGdp" }; % Getting capital and labor from gdp*(x/gdp) [last fraction is regional mean] finalGoodsData.cn((finalGoodsData.rice_code == string(i) & isnan(finalGoodsData.cn))) = ... finalGoodsData.cgdpo((finalGoodsData.rice_code == string(i) & isnan(finalGoodsData.cn))) .* ... finalGoodsData.capPerGdp((finalGoodsData.rice_code == string(i) & ... isnan(finalGoodsData.cn))); else disp(i) end end 8 99 % Missing emp data for i = 1:12 if ~isempty(finalGoodsData((finalGoodsData.rice_code == string(i) & isnan(finalGoodsData.emp)),:)) % Filling in missing labor data from emp/gdp mean % extrapolation of regional mean finalGoodsData.empPerGdp((finalGoodsData.rice_code == string(i) & isnan(finalGoodsData.empPerGdp))) = ... sectorDataRegionsMean{sectorDataRegionsMean.rice_code == string(i), "Fun_empPerGdp" }; % Getting capital and labor from gdp*(x/gdp) [last fraction is regional mean] finalGoodsData.emp((finalGoodsData.rice_code == string(i) & isnan(finalGoodsData.emp))) = ... finalGoodsData.cgdpo((finalGoodsData.rice_code == string(i) & isnan(finalGoodsData.emp))) .* ... finalGoodsData.empPerGdp((finalGoodsData.rice_code == string(i) & isnan(finalGoodsData.emp))); else disp(i) end end % Missing labor share in sectors data for i = 1:12 if ~isempty(finalGoodsData((finalGoodsData.rice_code == string(i) & isnan(finalGoodsData.transportLabSh)),:)) % Filling in missing labor shares from regional mean finalGoodsData.transportLabSh((finalGoodsData.rice_code == string(i) & isnan(finalGoodsData.transportLabSh))) = ... sectorDataRegionsMean{sectorDataRegionsMean.rice_code == string(i), "Fun_transportLabSh" }; finalGoodsData.industryLabSh((finalGoodsData.rice_code == string(i) & isnan(finalGoodsData.industryLabSh))) = ... sectorDataRegionsMean{sectorDataRegionsMean.rice_code == string(i), "Fun_industryLabSh" }; finalGoodsData.otherLabSh((finalGoodsData.rice_code == string(i) & isnan(finalGoodsData.otherLabSh))) = ... sectorDataRegionsMean{sectorDataRegionsMean.rice_code == string(i), "Fun_otherLabSh" }; else disp(i) end end % Missing labor share of GDP data for i = 1:12 if ~isempty(finalGoodsData((finalGoodsData.rice_code == string(i) & isnan(finalGoodsData.labsh)),:)) % Filling in missing labor shares from regional mean finalGoodsData.labsh((finalGoodsData.rice_code == string(i) & isnan(finalGoodsData.labsh))) = ... 9 100 sectorDataRegionsMean{sectorDataRegionsMean.rice_code == string(i), "Fun_labsh" }; else disp(i) end end % Getting capital share of GDP as extensive variable preparing for regional aggregation finalGoodsData.capPropExtPWT = finalGoodsData.cgdpo .* (1 - finalGoodsData.labsh); % Missing capital share data. For now, all NaNs get the OECD average, irrespective of region finalGoodsData.transCapSh(isnan(finalGoodsData.transCapSh)) = mean(finalGoodsData.transCapSh, "omitnan" ); finalGoodsData.indCapSh(isnan(finalGoodsData.indCapSh)) = mean(finalGoodsData.indCapSh, "omitnan" ); finalGoodsData.othCapSh(isnan(finalGoodsData.othCapSh)) = mean(finalGoodsData.othCapSh, "omitnan" ); finalGoodsData = sortrows(finalGoodsData, 'rice_code' ,'ascend' ); % Getting nominal value added instead of shares of output finalGoodsData.transVA = finalGoodsData{:, "transportShare" } .* finalGoodsData{:, "cgdpo" }; finalGoodsData.indVA = finalGoodsData{:, "industryShare" } .* finalGoodsData{:, "cgdpo" }; finalGoodsData.othVA = finalGoodsData{:, "otherShare" } .* finalGoodsData{:, "cgdpo" }; %sectorData.sanity = sectorData.transVA + sectorData.indVA + sectorData.othVA - sectorData.cgdpo; % sanity check passed %sectorData.Sanity = sectorData.otherLabSh + sectorData.industryLabSh + sectorData.transportLabSh; % sanity check passed % Getting number employed in sector instead of fraction finalGoodsData.transLab = finalGoodsData{:, "transportLabSh" } .* finalGoodsData{:, "emp" } / 100; finalGoodsData.indLab = finalGoodsData{:, "industryLabSh" } .* finalGoodsData{:, "emp" } / 100; finalGoodsData.othLab = finalGoodsData{:, "otherLabSh" } .* finalGoodsData{:, "emp" } / 100; %sectorData.sanityLab = sectorData.emp -sectorData.transLab - sectorData.indLab - sectorData.othLab; % sanity check passed % Getting capital value instead of shares finalGoodsData.transCap = finalGoodsData{:, "transCapSh" } .* finalGoodsData{:, "cn" }; finalGoodsData.indCap = finalGoodsData{:, "indCapSh" } .* finalGoodsData{:, "cn" }; 10 101 finalGoodsData.othCap = finalGoodsData{:, "othCapSh" } .* finalGoodsData{:, "cn" }; %sectorData.sanityLab = sectorData.cn - sectorData.transCap - sectorData.indCap - sectorData.othCap; % sanity check passed end %interpolation REGIONAL AGGREGATION (of levels) This section takes country level macro and energy data and aggregates it into regions. Region is World. For thesis, region 1 is Poor and 2 is Rich. if production.regionalize == 1 % For pre-aggregation deletion of share variables notShareVars = ~contains(finalGoodsData.Properties.VariableNames(:), "Sh" ); %%%%%%%%% % WORLD % %%%%%%%%% regionCode = categorical( "0" ); GroupCount = 1; % Final good sectors finalGoodsWorld = finalGoodsData(:,notShareVars); finalGoodsWorld = varfun(@(x) sum(x, "omitnan" ), finalGoodsWorld, ... "InputVariables" , @isnumeric); finalGoodsWorld = addvars(finalGoodsWorld, regionCode, GroupCount, 'Before' , 1); % Energy unstacked (Whole region in one row) energyWorld = varfun(@(x) sum(x, "omitnan" ), energyDataUnstacked, ... "InputVariables" , @isnumeric); energyWorld = addvars(energyWorld, regionCode, GroupCount, 'Before' , 1); % Energy stacked (Four rows per region) energyWorldStacked = varfun(@(x) sum(x, 'omitnan' ), energyData, ... "InputVariables" ,@isnumeric, "GroupingVariables" ,[ "sector" ]); energyWorldStacked.regionCode(:) = regionCode; energyWorldStacked.GroupCount(:) = GroupCount; energyWorldStacked = movevars(energyWorldStacked, ... [ "regionCode" "GroupCount" ], 'Before' , 1); %%%%%%%%%%% % REGIONS % %%%%%%%%%%% 11 102 % Final good sectors finalGoodsRegional = finalGoodsData(:,notShareVars); finalGoodsRegional = varfun(@(x) sum(x, "omitnan" ), finalGoodsRegional, ... "InputVariables" , @isnumeric, 'GroupingVariables' , [regionSelected]); %"InputVariables", @isnumeric, GroupingVariables=[regionSelected]); finalGoodsRegional.Properties.VariableNames(1) = "regionCode" ; % Energy unstacked (Whole region in one row) energyRegional = varfun(@(x) sum(x, "omitnan" ), energyDataUnstacked, ... "InputVariables" , @isnumeric, "GroupingVariables" , [regionSelected]); energyRegional.Properties.VariableNames(1) = "regionCode" ; % Energy stacked (Four rows per region) energyRegionalStacked = varfun(@(x) sum(x, 'omitnan' ), energyData, ... "InputVariables" ,@isnumeric, "GroupingVariables" , [regionSelected "sector" ]); energyRegionalStacked.Properties.VariableNames(1) = "regionCode" ; finalGoods = [finalGoodsWorld;finalGoodsRegional]; finalGoods.capShPWT = finalGoods.Fun_capPropExtPWT ./ finalGoods.Fun_cgdpo; energy = [energyWorld;energyRegional]; energyMatrix = [energyWorldStacked;energyRegionalStacked]; % Adding total fuel use energy.totalFossil = energy.Fun_coal + energy.Fun_oil + energy.Fun_natGas; energy.totalPrimary = energy.Fun_coal + energy.Fun_oil + energy.Fun_natGas + ... energy.Fun_bio + energy.Fun_renew; if regionSelected == "thesisCode" % Manually appending bunkers to thesis emissions, since this data was made available right before the deadline. energy.Fun_oil_x1Transport = energy.Fun_oil_x1Transport + [1.8E+07; 0.3E+07; 1.5E+07]; energy.Fun_oil = energy.Fun_oil + [1.8E+07; 0.3E+07; 1.5E+07]; end end % region making 12 103 Calibration read-ins (bottom-->top) This section takes cleaned and regionalized data and reads it into vectors used for parameter calibration and model initialization if production.calibration_input == 1 % Loops over all regions numOfRegions = size(finalGoods, 1); for i = 1:numOfRegions % CO2Factors prod.co2Factors(:,i) = co2Factors; % REFINED ENERGY SECTOR: prices and energy volumes % Rows: Energy sector. Column: Region. if regionSelected == "thesisCode" % (p^e) (5x1) vector [coal; oil; natGas; bio; renew] calib.price_ene_e(:,i) = enePrices(:,i) + emPricesTJ(:,i); % PPP USD/TJ elseif regionSelected == "rice_code" calib.price_ene_e(:,i) = enePricesWorld + emPricesTJ(:,1); % TJ end % (e_i) (5x1) vector [coal; oil; natGas; bio; renew] calib.quant_ene_e(:,i) = energy{i, ["Fun_coal" ; "Fun_oil" ; "Fun_natGas" ; "Fun_bio" ; "Fun_renew" ]}; % TJ % REFINED ENERGY SECTOR: emissions % Emissions are in kg, to match real emission data. % Rows: Energy sector. Column: Region. if regionSelected == "thesisCode" % (p^E) Emission prices. (5x1) vector, one per fuel. calib.price_ene_E(i) = emPricesKG(i); % PPP USD/kgCO2 % (E) Emissions per fuel. (5x1) vector, one per fuel calib.quant_ene_E(:,i) = co2Factors .* calib.quant_ene_e(:,i); % kg CO2 elseif regionSelected == "rice_code" % (p^E) Emission prices. (5x1) vector, one per fuel. calib.price_ene_E(i) = emPricesKG(1); % PPP USD/kgCO2 (World avg for all regions) % (E) Emissions per fuel. (5x1) vector, one per fuel calib.quant_ene_E(:,i) = co2Factors .* calib.quant_ene_e(:,i); % kg CO2 end % ELECTRICITY SECTOR % Rows: Fuel inputs to electricity. Column: Region. if regionSelected == "thesisCode" calib.price_int_0(i) = elPrices(i) + emPricesTJ(i); %(p^e_0) electricity price scalar elseif regionSelected == "rice_code" 13 104 calib.price_int_0(i) = elPrices(1) + emPricesTJ(1); end %calib.quant_ene_0 = energyMatrix{28, calib.quant_ene_0(:,i) = ... energy{i, [ "Fun_coal_x4Electricity" ; "Fun_oil_x4Electricity" ; "Fun_natGas_x4Electricity" ; "Fun_bio_x4Electricity" ; "Fun_renew_x4Electricity" ]}; calib.quant_ene_0_inputSum(i) = sum(calib.quant_ene_0(:,i)); % (e_0)(sum of inputs before losses) calib.quant_int_0Test(i) = energy{i, [ "Fun_elAndHeat" ]}; % (e_0) the total produced electricity (read-in of output from data) % INTERMEDIATE SECTOR % Rows: Inputs and outputs. Column: Region. calib.price_int_d(i) = 1; % (p_l^d) Intermediate good prices (unity by normalization) calib.price_int_e(:,i) = [calib.price_ene_e(1:4,i); calib.price_int_0(i)]; % (N/A) Vector of prices of inputs to intermediate production [c o g b el]' %calib.quant_int_e = energyMatrix{25:27, ["Fun_coal" "Fun_oil" "Fun_natGas" "Fun_bio" "Fun_elAndHeat"]}; % (N/A) (3x5) calib.quant_int_e_tr(:,i) = energy{i, [ "Fun_coal_x1Transport" ; "Fun_oil_x1Transport" ; "Fun_natGas_x1Transport" ; "Fun_bio_x1Transport" ; "Fun_elAndHeat_x1Transport" ]}; %(5x1) calib.quant_int_e_in(:,i) = energy{i, [ "Fun_coal_x2Industry" ; "Fun_oil_x2Industry" ; "Fun_natGas_x2Industry" ; "Fun_bio_x2Industry" ; "Fun_elAndHeat_x2Industry" ]}; calib.quant_int_e_ot(:,i) = energy{i, [ "Fun_coal_x3Other" ; "Fun_oil_x3Other" ; "Fun_natGas_x3Other" ; "Fun_bio_x3Other" ; "Fun_elAndHeat_x3Other" ]}; % Stacking sectors to get matrix for easier calc. in next step. Remember, happens for each country so matrix is ok. calib.quant_int_e = [calib.quant_int_e_tr(:,i)'; calib.quant_int_e_in(:,i)'; calib.quant_int_e_ot(:,i)']; calib.quant_int_d_val(:,i) = calib.quant_int_e * calib.price_int_e(:,i); % Matrix multiplication (3x5)(5x1) = (3x1) vector of value of intermediate by sector %calib.quant_int_d_test = sum(calib.quant_int_e,2); calib.quant_int_0(i) = calib.quant_int_e_tr(5,i) + calib.quant_int_e_in(5,i) + calib.quant_int_e_ot(5,i); % FINAL GOODS AND AGGREGATION % Rows: Inputs and outputs. Column: Region. calib.price_fin_c(i) = 1; % (p_l) Sector prices (column vector) calib.price_K(i) = 1; % (p^K) (economy-wide) %calib.price_N(i) = 1; % (omega) (economy-wide calib.quant_fin_c(:,i) = [finalGoods{i, "Fun_transVA" }; finalGoods{i, "Fun_indVA" }; finalGoods{i, "Fun_othVA" }]; % (c) (3x1) Sector quantities. calib.quant_fin_K(:,i) = finalGoods{i, "Fun_cn" }; % (K) Scalar. Total capital in region, used to calibrate alpha. calib.quant_fin_K_sectors(:,i) = finalGoods{i, [ "Fun_transCap" ; "Fun_indCap" ; "Fun_othCap" ]}; 14 105 calib.quant_fin_N(:,i) = finalGoods{i, "Fun_emp" }; % (N) Scalar.Total labor in region (not vector!) calib.quant_fin_N_sectors(:,i) = finalGoods{i, [ "Fun_transLab" ; "Fun_indLab" ; "Fun_othLab" ]}; calib.price_agg_Y(i) = 1; % (p) Aggregate price level (scalar) calib.quant_agg_Y(:,i) = finalGoods{i, "Fun_cgdpo" }; calib.gr_Y(i) = growthRates{i, "Fun_log_Fun_cgdpo" }; calib.gr_K(i) = growthRates{i, "Fun_log_Fun_cn" }; % end calibration read-ins Calibration coefficient equations Each set of sectors has a matrix containing varieties in columns and production coefficients on different inputs in a row % Alpha bar is extrapolated from only 3 countries. % High is 80/20 split of US and Russia. % Low is China % I use world average if RICE regions are used if regionSelected == "thesisCode" if i == 1 prod.ene_alpha(i) = alphaBarW; elseif i == 2 prod.ene_alpha(i) = alphaBarL; elseif i == 3 prod.ene_alpha(i) = alphaBarH; end elseif regionSelected == "rice_code" prod.ene_alpha(i) = alphaBarW; end % (a_{l,i}^tilde) Intermediate energy good CES shares (NOTE: col 5 is electricity. Does not include renew) (B.14) % % Rows: Fuel-specific parameters. Column: Region. % NOTE: currently manually selecting substitutability parameter. Should be automated to have dynamic number of sectors. prod.int_atildestar_tr(:,i) = (calib.price_int_e(:,i) / calib.price_int_d(i)) .* (calib.quant_int_e_tr(:,i) ./ ... calib.quant_int_d_val(1,i)).^(1-prod.int_s(1)); prod.int_asum_tr(i) = sum(prod.int_atildestar_tr(:,i)); prod.int_Atilde_tr(i) = prod.int_asum_tr(i).^(1./ prod.int_s(1)); prod.int_atilde_tr(:,i) = prod.int_atildestar_tr(:,i) ./ prod.int_asum_tr(i); prod.int_atildestar_in(:,i) = (calib.price_int_e(:,i) / calib.price_int_d(i)) .* (calib.quant_int_e_in(:,i) ./ ... calib.quant_int_d_val(2,i)).^(1-prod.int_s(2)); 15 106 prod.int_asum_in(i) = sum(prod.int_atildestar_in(:,i)); prod.int_Atilde_in(i) = prod.int_asum_in(i).^(1./ prod.int_s(2)); prod.int_atilde_in(:,i) = prod.int_atildestar_in(:,i) ./ prod.int_asum_in(i); prod.int_atildestar_ot(:,i) = (calib.price_int_e(:,i) / calib.price_int_d(i)) .* (calib.quant_int_e_ot(:,i) ./ ... calib.quant_int_d_val(3,i)).^(1-prod.int_s(3)); prod.int_asum_ot(i) = sum(prod.int_atildestar_ot(:,i)); prod.int_Atilde_ot(i) = prod.int_asum_ot(i).^(1./ prod.int_s(3)); prod.int_atilde_ot(:,i) = prod.int_atildestar_ot(:,i) ./ prod.int_asum_ot(i); % (a_{0,i}^tilde) Electricity sector CES share on fuel inputs (incl. renew) (missing in theory, from B.19) % % Rows: Fuel-specific parameters. Column: Region. % Note: prod.int_atildestar_0(:,i) = (calib.price_ene_e(:,i) ./ calib.price_int_0(i)) .* (calib.quant_ene_0(:,i) ./ ... calib.quant_int_0(i)).^(1-prod.int_s_0); % (1x5) vector. Electricity sector. idx 5 is RENEW, not ELECTRICITY prod.int_asum_0(i) = sum(prod.int_atildestar_0(:,i)); prod.int_Atilde_0(i) = prod.int_asum_0(i).^(1./prod.int_s_0); prod.int_atilde_0(:,i) = prod.int_atildestar_0(:,i) ./ prod.int_asum_0(i); % (alpha, nu) Final consumption good CD function share calibration (B.12) % alpha is sector INdependent. CHECK: Should be (3x1) identical entries or scalar. % NOTE: I multiply the FLOW Y by 10 to get decadal timestep prod.fin_alpha(i) = (calib.price_K(i) ./ calib.price_fin_c(i)) .* (calib.quant_fin_K(i) ./ ... (10*calib.quant_agg_Y(i))); % Scalar or (3x1) vector with identical entries. % nu is sector DEpendent prod.fin_nu(:,i) = (calib.price_int_d(i) ./ calib.price_fin_c(i)) .* (calib.quant_int_d_val(:,i) ./ ... calib.quant_fin_c(:,i)); % Should be a (3x1) vector. Originally 0.1. % getting the overall nu for wage calibration prod.fin_nuOverAll(i) = sum(calib.quant_int_d_val(:,i)) ./ sum(calib.quant_fin_c(:,i)); prod.fin_nuOverAll(i) = mean(prod.fin_nu(:,i)); %prod.fin_nuOverAll(i) = 3 * prod.fin_nuOverAll(i); prod.fin_alpha(i) = prod.fin_alpha(i) - prod.fin_nuOverAll(i); %Debug %prod.fin_alpha(i) = alphaTest(i); 16 107 calib.shareN(i) = 1 - prod.fin_alpha(i)- prod.fin_nuOverAll(i); calib.GDPtoN(i)=calib.quant_agg_Y(i) / calib.quant_fin_N(i); calib.price_N(i) = (1 - prod.fin_alpha(i)- prod.fin_nuOverAll(i)) .* (calib.quant_agg_Y(i) / ... calib.quant_fin_N(i)); % (a^bar) The coefficient on E inside the min() function % Rows: Fuel-specific parameters. Column: Region. prod.ene_abar(:,i) = ((1-prod.ene_alpha(i)).* (calib.price_ene_e(:,i) .* calib.quant_ene_e(:,i)) ./ ... (calib.price_N(i) .* calib.quant_ene_E(:,i))) - ... (calib.price_ene_E(i) ./ calib.price_N(i)); % (5x1) vector of Leontief coefficients, one for each fuel. % (a) Final aggregation CES function share calibration (B.11) prod.agg_astar(:,i) = (calib.quant_fin_c(:,i) ./ calib.quant_agg_Y(i)).^(1-prod.agg_s); prod.agg_asum(:,i) = sum(prod.agg_astar(:,i)) prod.agg_A(i) = prod.agg_asum(i).^(1/prod.agg_s); % This is the important output prod.agg_a(:,i) = prod.agg_astar(:,i) / prod.agg_asum(i); % Should sum to one Initialization of other coefficients (A^bar) TFP in refined energy production % Rows: Fuel-specific parameters. Column: Region. prod.ene_Abar(:,i) = ((calib.price_N(i) + (calib.price_ene_E(:,i) ./ prod.ene_abar(:,i))).^(1- prod.ene_alpha(i))) ./ ... (calib.price_ene_e(:,i) .* (prod.ene_alpha(i)^prod.ene_alpha(i))*((1-prod.ene_alpha(i))^(1- prod.ene_alpha(i)))); % With co2factors prod.ene_Abar(:,i) = ((calib.price_N(i) + (calib.price_ene_E(:,i) .* prod.co2Factors(:,i))).^(1- prod.ene_alpha(i))) ./ ... (calib.price_ene_e(:,i) .* (prod.ene_alpha(i)^prod.ene_alpha(i))*((1-prod.ene_alpha(i))^(1- prod.ene_alpha(i)))); % No alpha version %prod.ene_Abar(:,i) = (calib.price_N(i) + (calib.price_ene_E(:,i) ./ prod.ene_abar(:,i))) ./ calib.price_ene_e(:,i); 17 108 % prod.fin_A(:,i) = calib.quant_fin_c(:,i) ./ ... % (calib.quant_fin_c(:,i).^(1- prod.fin_nuOverAll(:,i)) .* prod.fin_alpha(i).^prod.fin_alpha(i) .* ... % ((1 - prod.fin_alpha(i) - prod.fin_nu(:,i))/ calib.price_N(i)).^(1-prod.fin_alpha(i) - prod.fin_nu(i)) .* ... % calib.quant_int_d_val(:,i).^prod.fin_nu(:,i)); % TFP final good production (column vector) % % A version 2 % prod.fin_A2(:,i) = prod.fin_alpha(i).^(- prod.fin_alpha(i)) .* ... % ((calib.price_N(i) ./ (1- prod.fin_alpha(i) - prod.fin_nuOverAll(i))).^(1-prod.fin_alpha(i) - prod.fin_nuOverAll(i))) .* ... % (calib.quant_fin_c(:,i) ./ calib.quant_int_d_val(:,i)).^(prod.fin_nuOverAll(i)); % % % % Trying another version of A % prod.fin_A(:,i) = prod.fin_alpha(i).^(- prod.fin_alpha(i)) .* ... % prod.fin_nuOverAll(:,i).^(- prod.fin_nuOverAll(:,i)) .* ... % (calib.price_N(i) ./ (1 - prod.fin_alpha(i) - prod.fin_nuOverAll(:,i))).^(1 - prod.fin_alpha(i) - prod.fin_nuOverAll(:,i)); % Trying another version of A (sector wise nu) prod.fin_A(:,i) = prod.fin_alpha(i).^(- prod.fin_alpha(i)) .* ... prod.fin_nu(:,i).^(-prod.fin_nu(:,i)) .* ... (calib.price_N(i) ./ (1 - prod.fin_alpha(i) - prod.fin_nu(:,i))).^(1 - prod.fin_alpha(i) - prod.fin_nu(:,i)); % prod.fin_A2(:,i) = prod.fin_alpha(i).^(- prod.fin_alpha(i)) .* ... % ((calib.price_N(i) ./ (1-prod.fin_alpha(i) - prod.fin_nu(:,i))).^(1-prod.fin_alpha(i) - prod.fin_nu(:,i))) .* ... % (calib.quant_fin_c(:,i) ./ calib.quant_int_d_val(:,i)).^(prod.fin_nu(:,i)); end % for loop end save Prod_ACEn.mat else load Prod_ACEn.mat end % direct read-in option end % end of calibrate loop Production calculation if calibrate_calculate == 2 | 3 18 109 %if production.calculation == 1 for i = 1:numOfRegions Need input vectors to carry out calculation: controltest.K_fin(:,i) = calib.quant_fin_K_sectors(:,i); %(3,1) per region controltest.N_fin(:,i) = calib.quant_fin_N_sectors(:,i); %(3,1) per region controltest.K_ene(:,i) = ones(5,1); controltest.N_ene(:,i) = ones(5,1); controltest.K_ene(:,i) = calib.quant_fin_K(i) .* [.0014;.0058;.0012;.0009;.0029]; controltest.N_ene(:,i) = calib.quant_fin_N(i) .* [.0068;.0271;.0055;.0041;.0138]; controltest.E(:,i) = calib.quant_ene_E(:,i); %(5,1) per region controltest.sums(:,i) = [calib.quant_ene_e(1:4,i); calib.quant_int_0(i)]; % Rows: Total energy prod. per fuel (5th is electricity). controltest.el_e_shares(:,i) = calib.quant_ene_0(:,i) ./ calib.quant_ene_e(:,i); controltest.int_e_shares_tr(:,i) =calib.quant_int_e_tr(:,i) ./ controltest.sums(:,i); controltest.int_e_shares_in(:,i) =calib.quant_int_e_in(:,i) ./ controltest.sums(:,i); controltest.int_e_shares_ot(:,i) =calib.quant_int_e_ot(:,i) ./ controltest.sums(:,i); %controltest.int_e_shares = ones(3,5)/5; % Each sector's coefficient on fuel inputs. Col5 is electricity controltest.elTest(i) = controltest.int_e_shares_tr(5,i) + controltest.int_e_shares_in(5,i) + ... controltest.int_e_shares_ot(5,i); %controltest.elTest(i) = calib.quant_int_0(i); % Each set of sectors has a matrix containing varieties in columns and production coefficients on different inputs in a row Refined primary energy production: % Debugging: % prod.ene_Abar(:,i) = 1; % column vector of dimenions 'fuels'. f_ene(:,i) = min(controltest.N_ene(:,i) , prod.ene_abar(:,i) .* controltest.E(:,i)); % min of elements in each row, returns (5x1) vector %f_ene(5,i) = controltest.N_ene(5,i); e_ene(:,i) = prod.ene_Abar(:,i) .* controltest.K_ene(:,i).^prod.ene_alpha(i) .* f_ene(:,i).^(1 - prod.ene_alpha(i)); 19 110 Electricity sector % Debugging: % prod.int_Atilde_0(i) = 1; e_ene_0(i) = prod.int_Atilde_0(i) .* sum(prod.int_atilde_0(:,i) .* (controltest.el_e_shares(:,i) .* e_ene(:,i)).^prod.int_s_0).^(1./ prod.int_s_0); % Scalar Intermediate sector (sector specific energy composite): % Debugging: % prod.int_Atilde_tr(i) = 1; % prod.int_Atilde_in(i) = 1; % prod.int_Atilde_ot(i) = 1; % ---> Setting to one fixes Rich > World problem for d_int. d_int_tr(i) = prod.int_Atilde_tr(i).* (prod.int_atilde_tr(5,i) .* (controltest.int_e_shares_tr(5,i) .* e_ene_0(i)).^prod.int_s(1) + ... sum(prod.int_atilde_tr(1:4,i) .* (controltest.int_e_shares_tr(1:4,i) .* e_ene(1:4,i)).^prod.int_s(1))).^(1./ prod.int_s(1)); d_int_in(i) = prod.int_Atilde_in(i).* (prod.int_atilde_in(5,i) .* (controltest.int_e_shares_in(5,i) .* e_ene_0(i)).^prod.int_s(2) + ... sum(prod.int_atilde_in(1:4,i) .* (controltest.int_e_shares_in(1:4,i) .* e_ene(1:4,i)).^prod.int_s(2))).^(1./ prod.int_s(2)); d_int_ot(i) = prod.int_Atilde_ot(i) .* (prod.int_atilde_ot(5,i) .* (controltest.int_e_shares_ot(5,i) .* e_ene_0(i)).^prod.int_s(3) + ... sum(prod.int_atilde_ot(1:4,i) .* (controltest.int_e_shares_ot(1:4,i) .* e_ene(1:4,i)).^prod.int_s(3))).^(1./ prod.int_s(3)); d_int(:,i) = [d_int_tr(i); d_int_in(i); d_int_ot(i)]; % XXX double check that equation above is raising right parts to right power... Final good production sector: column vector 'goods' (e.g. transport, industry, other) % Debugging: % prod.fin_A(:,i) = 1; %Sectorwise nu 20 111 c_fin(:,i) = (prod.fin_A(:,i) .* controltest.K_fin(:,i).^prod.fin_alpha(i) .* ... controltest.N_fin(:,i).^(1-prod.fin_alpha(i)-prod.fin_nu(:,i)) .* d_int(:,i).^prod.fin_nu(:,i)); Final good aggregation sector: scalar % Debugging: % prod.agg_A(:,i) = 1; c_agg(i) = prod.agg_A(i).*(sum(prod.agg_a(:,i) .* c_fin(:,i).^prod.agg_s))^(prod.agg_sbar/prod.agg_s); emi(:,i) = e_ene(:,i) ./ prod.ene_abar(:,i); compEn(:,i) = e_ene(:,i) ./ (calib.quant_ene_e(:,i)); compEl(:,i) = e_ene_0(:,i) ./ (calib.quant_int_0(i)); compInt(:,i) = d_int(:,i) ./ calib.quant_int_d_val(:,i); compSec = c_fin(:,i) ./ [finalGoods{:, "Fun_transVA" } finalGoods{:, "Fun_indVA" } finalGoods{:, "Fun_othVA" }]'; end % for loop c_agg' ./ finalGoods{:, "Fun_cgdpo" } disp([ 'Aggregate consumption is ' num2str(c_agg)]) Y_gross_Andreas=c_agg(i) end % of calculation loop countrylist = PWT(:, [ "country_PWT" "thesisCode" ]); %writetable(finalGoodsRegional, 'finalGoods.xlsx'); % writetable(energyRegionalStacked, 'energyRegional.xlsx'); writetable(countrylist, 'countries.xlsx' ); Diffusion model Diffusion init prod.ene_Abar_dyn(:,i)= prod.ene_Abar(:,i); % initializing vector of TFP in energy g_ren_H= 0.01; % high income renewable growth g_renDecline = 0.02; theta_diffu = 0; % diffusion parameter (in 1) lambda_diffu = 0.00; % inherent growth in low income (in >0) welfare(i) = 0; L % Growth in renewable energy TFP Ahat = (prod.ene_Abar_dyn(5,3) - prod.ene_Abar_dyn(5,2))./ prod.ene_Abar_dyn(5,2) 21 112 breakcheck = Ahat > 0.01 if diffusion == 1 prod.ene_Abar_dyn(5,1) = prod.ene_Abar_dyn(5,1).*exp(g_ren_H(t).*timestep); if breakcheck g_ren_L = theta_diffu .* Ahat + lambda_diffu; else g_ren_L = 0; end prod.ene_Abar_dyn(5,2) = prod.ene_Abar_dyn(5,2)*exp(g_ren_L*timestep); prod.ene_Abar_dyn(5,3) = prod.ene_Abar_dyn(5,3).*exp(g_ren_H(t).*timestep); end g_ren_LTime(t) = g_ren_L; AhatOverTime(t) = Ahat; E(i,t)=sum(Emi); E_field(i,:,t)=Emi'; C_fin_field(i,:,t) = c_fin; C_fin_tr(i,t)=c_fin(1); C_fin_in(i,t)=c_fin(2); C_fin_ot(i,t)=c_fin(3); d_fin_tr(i,t)=d_int(1); d_fin_in(i,t)=d_int(2); d_fin_ot(i,t)=d_int(3); % Total energy use in regions ene_field(i,:,t) = ene'; e_ene_field(i,:,t) = e_ene; e_ene_tot(i,t)=sum(e_ene_field(i,:,t),2); ene_tot(i,t)=sum(ene_field(i,:,t),2); e_ene_c(i,t) = e_ene(1); % coal e_ene_o(i,t) = e_ene(2); % oil e_ene_g(i,t) = e_ene(3); % gas e_ene_b(i,t) = e_ene(4); % bio e_ene_r(i,t) = e_ene(5); % renew e_ene_e(i,t) = e_el(1); % el % How to find energy use within a sector? ene_tr(:,i,t) = cont(:,1) .* ene; ene_in(:,i,t) = cont(:,2) .* ene; ene_ot(:,i,t) = cont(:,3) .* ene; ene_el(:,i,t) = [cont(1:4,4) .* ene(1:4); e_ene(5)]; % debug %ene_sum = ene_tr + ene_in +ene_ot + ene_el; utility(i,t) = log(Y_net(i,t)*x(i)); % utils in that period if t == 1 welfare(i,t) = utility(i,t); else welfare(i,t) = welfare(i,t-1)+beta(i)^t .* utility(i,t); % the final t gives the total discounted end Published with MATLAB® R2022a 22 113 Husholdningers betalingsvillighet for å unngå strømbrudd Vista Analyse | Rapport 2022/23 3 Vista Analyse AS Meltzers gate 4 0257 Oslo post@vista -analyse.no vista -analyse.no
Jeg godtar
Vista-analyse.no bruker informasjonskapsler (cookies) for å gi deg den beste opplevelsen
GDPR