Development II Seminar Documentation Release 0.1

Development II Seminar Documentation Release 0.1

Development II seminar Documentation Release 0.1 Jonathan Conning Oct 04, 2018 Contents 1 Development Microeconomics with Jupyter Notebooks3 1.1 Economics with Jupyter Notebooks...................................3 1.2 Lucas (1990) “Why Doesn’t Capital Flow from Rich to Poor Countries?”...............8 1.3 Edgeworth Box: Efficiency in production allocation.......................... 16 1.4 The Specific Factors or Ricardo-Viner Model.............................. 24 1.5 Migration, urban-bias and the informal sector.............................. 37 1.6 Coase, Property rights and the ‘Coase Theorem’............................ 44 1.7 Farm Household Models......................................... 55 1.8 Testing for Separation in Household models............................... 66 1.9 Equilibrium Size Distribution of Farms................................. 69 1.10 Causes and consequences of insecure Property Rights to land..................... 80 1.11 Consumer Choice and Intertemporal Choice.............................. 84 1.12 Quasi-hyperbolic discounting and commitment savings......................... 94 1.13 Notes on Incentive Contracts and Corruption.............................. 102 1.14 Research Discontinuity Designs (in R)................................. 111 1.15 Data APIs and pandas operations.................................... 122 1.16 Stata and R in a jupyter notebook.................................... 128 1.17 Jupyter running an R kernel....................................... 128 1.18 Jupyter with a Stata Kernel........................................ 129 1.19 Python and Stata combined in the same notebook............................ 129 i ii Development II seminar Documentation, Release 0.1 Lecture Notes and materials for The Graduate Center’s Economics 842 taught by Jonathan Conning • Reading list (links to weekly reading assignments and slides) • Syllabus (course details and longer bibliography) These reading and lecture notes on development microeconomics are written mostly as interactive jupyter notebooks which are kept at this github repository. • https://github.com/jhconning/Dev-II See below for different ways to access and interact with this content. Contents 1 Development II seminar Documentation, Release 0.1 2 Contents CHAPTER 1 Development Microeconomics with Jupyter Notebooks List of notebooks: 1.1 Economics with Jupyter Notebooks • Jupyter Notebook is “a web application that allows you to create and share documents that contain live code, equations, visualizations and explanatory text. Uses include: data cleaning and transformation, numerical sim- ulation, statistical modeling, machine learning and much more.” • Open-source, browser-based • Evolved from ipython notebook to leverage huge scientific python ecosystem. • Now a ‘language agnostic’ platform so that you can use any of 50+ other kernels including MATLAB, Octave, Stata, Julia, etc. • Open-source, fast evolving, large community: Widely used in academic and scientific computing community. • Ties projects together: Code, data, documentation, output and analysis all in one place. • Encourages reproducible science: • Easy workflow from exploratory analysis to publish. • Works well with github and other open-source sharing tools. 1.1.1 Ways to view and run jupyter notebooks Jupyter server for interactive computing Run on a local machine or cloud server to modify code and results on the fly. • On your computer: – Jupyter notebook on your local machine. I recommend using Anaconda to install Jupyter and scientific python. A good instalation guide here 3 Development II seminar Documentation, Release 0.1 – nteract. A good one-click install solution for running notebooks. Provides you with standalone program that installs scientific python and runs jupyter notebooks (not quite full functionality). • Jupyter notebooks are big in the data science space. Lots of free cloud server solutions are emerging: – Microsoft Azure notebooks: Setup a free account for cloud hosted jupyter notebooks. – Google Colaboratory: Run notebooks stored on your google drive. – Cocalc: jupyter notebooks, SageMath and other cloud hosted services. – Try Jupyter: another cloud server, but you can’t save work at all. Static rendering for presentations and publishing. • Jupyter notebooks can be rendered in different ways for example as a styled HTML slideshow or page or as a PDF book by using tools and services such as github, nbconvert, Sphinx and Read the Docs. • This very notebook is: – hosted on the Dev-II repository on github where it is rendered in simple HTML (though underlying format is json). – viewable in HTML or as javascript slideshow via nbviewer. To then see in slideshow mode click on ‘present’ icon on top right. – Tied together with other documents via Sphinx to create a website on readthedocs – Also viewable as a PDF book on readthedocs 1.1.2 A simple jupyter notebook example: We can combine text, math, code and graph outputs in one place. Let’s study a simple economics question: Are average incomes per capita converging? Neoclassical growth theory: • Solow-growth model with Cobb-Douglas technology f(k) = k훼. • Technology, saving rate s, capital depreciation rate 훿, population growth rate n and technological change rate g assumed same across countries. • Steady-state capital per worker to which countries are converging: * 1 k = (g=s) 훼−1 • Transitional dynamics: k_ (t) = sk(t)t − (n + g + 훿)k(t) • Diminishing returns to the accumulated factor k implies convergence: • Lower initial capital stock implies lower initial per-capita GDP. • Country that starts with lower capital stock and GDP per capita ‘catches up’ by growing faster. 4 Chapter 1. Development Microeconomics with Jupyter Notebooks Development II seminar Documentation, Release 0.1 Convergence plots Did countries with low levels of income per capita in 1960 grow faster? I found a dataset from World Penn Tables on this website (original data source here). Let us import useful python libraries for data handling and plots and load the dataset into a pandas dataframe: In [1]: import matplotlib.pyplot as plt %matplotlib inline import pandas as pd import seaborn as sns from ipywidgets import interact df= pd.read_stata(".\data\country.dta") (in the future we will follow best practice and place library imports at the top of our notebooks). Scatterplot of log GDP per capita and average growth 1960-2000: In [2]:g= sns.jointplot("lgdp60","ggdp", data=df, kind="reg", color="b", size=7) 1.1. Economics with Jupyter Notebooks 5 Development II seminar Documentation, Release 0.1 Same plot but excluding African countries: In [3]:g= sns.jointplot("lgdp60","ggdp", data=df[df.cont !="Africa"], kind="reg", color="r", size=7) 6 Chapter 1. Development Microeconomics with Jupyter Notebooks Development II seminar Documentation, Release 0.1 Interactive plots There are ways to make plots like these interactive. * On the next slide I use ipywidgets: When the notebook is run on a jupyter server ‘radio buttons’ above the plot allow quick re-plotting for selected country regions. • Other libraries such as Bokeh and Plotly create plots with embedded javascript code that allow interactive plot elements even on HTML renderings (i.e. in most browsers even if you do not have a jupyter server running). Here is how do do a dropdown menu. First we write a function to take a ‘region’ as argument that plots data only for that region (by specifying that filter in the pandas dataframe). We then use interact from the ipywidgets library to switch quickly between regions. 1.1. Economics with Jupyter Notebooks 7 Development II seminar Documentation, Release 0.1 You’ll only see this as truly interactive on a live notebook, not in a static HTML rendering of the same notebook. In [4]: def jplot(region): sns.jointplot("lgdp60","ggdp", data=df[df.cont == region], kind="reg", color="g", size=7) plt.show(); In [5]: interact(jplot, region=list(df.cont.unique())) Out[5]: <function __main__.jplot> 1.1.3 More on jupyter notebooks and scientific python • An excellent introduction to Jupyter notebooks and scientific python for economists written by John Stachurski is at this link: http://quant-econ.net/py/learning_python.html 1.2 Lucas (1990) “Why Doesn’t Capital Flow from Rich to Poor Coun- tries?” Summary and analytical notes on the paper: Lucas, Robert E. (1990) “Why Doesn’t Capital Flow from Rich to Poor Countries?” American Economic Review: 92-96. Note: To change or interact with the code and figures in this notebook first run the code section below the ‘Code Section’ below. Then run any code cells above. 1.2.1 Neoclassical trade, migration and growth model predictions: • the convergence of factor prices and incomes per-capita over time (Factor Price Equalization Theorem) • via substitute mechanisms: factor movement, trade in products, and/or capital accumulation (e.g. Solow). • rests on assumptions about technology and market competition – in particular: diminishing returns to the accumulated factor capital (i.e. FKK < 0 ). Simplest model Assume two countries with same aggregate production function, where X is capital stock and L is labor force: Y = AX훽L1−훽 in intensive or per-capita form: y = Ax훽 where Y X y = and x = L L Marginal Product of Capital is: r = 퐴훽x훽−1 8 Chapter 1. Development Microeconomics with Jupyter Notebooks Development II seminar Documentation, Release 0.1 Marginal Product of Capital (MPK) as a function of income per capita: 1 훽−1 r = 훽A 훽 y 훽 or 훽−1 (︁ y )︁ 훽 r = 퐴훽 A Steps: y = Ax훽 so 1 (︁ y )︁ 훽 x = A substitute this into r = 퐴훽x훽−1 The puzzle • Let capital share 훽 = 0:4 (average of USA and India) • Assume first that A is the same in both countries • In 1988 income per capita in USA was 15 times higher than USA: y US = 15 yIN • this implies MPK in India would have to be: 1−훽 r [︂y ]︂ 훽 IN = US = 58:1 rUS yIN times higher in India! Implausibly large. What differences in capital per worker account for this large a gap? (︀ y )︀ As $x = f A g ^thismultiple of the amount of capital per worker compared to India: So if in India the capital-labor ratio is 1 in the USA it must be 871.4 ! • With such huge differences in returns, capital would surely RUSH from USA to India quickly lower the gap in returns and incomes.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    137 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us