Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

UA 323

Problem Set 1

Development Economics

Due: Feb 06

Calculating Growth Rates

Assume that the aggregate production function can be expressed as

Y = AK   (hL)1 -

where Y is GDP, A is TFP, K and L are capital and labor services, respectively, and h stands for human capital (or “labor quality”).

1. What is the growth rate of gdp per worker?  Show the derivation. Remember that, from the notation in Tuesday’s class, the growth rate of gdp per worker can be written as ˆ(y) .

Now we’re going to download the data from the Penn World Tables. Fortunately, this is easy in R:

https://cran.r-project.org/web/packages/pwt10/pwt10.pdf

(You can just google “PWT 10.01 R”). If you are having trouble loading the pwt10 package, take a look at assignment 0.  You should also load the tidyverse  (again, see assignment 0).   Once you’ve loaded the

package, you can get a dataframe with all sorts of variables (described in that pdf) like this

data("pwt10.01")

It’s too many variables, actually.  The only ones we are going to need are: year, country, real gdp, capital services, employment, and the human capital index. I would pick the former two in constant 2017 national prices. We’re going to assume that α = 1/3.

Once you’ve igured those out, you can select the right ones using select() in the tidyverse, creating a new dataframe called pwt” .  If you wanted to select the variables a, b, and c, you would do it with the following command

pwt  =  select(pwt10.01,  ’a’,’b’,’c’)

You can make sure it’s worked using the head() command

head(pwt,5)

where the second part of the argument is the number of rows - 5 is a nice round number but you can pick whatever you want.

2.  At irst glance head(pwt,5) might seem a bit concerning.  Explain why it looks concerning, and in fact why it’s totally reasonable what’s going on.

We’re not going to want to go back to 1950. Let’s do something a little more recent, like 1975. We can do this using ilter()

pwt_short  =  filter(pwt,year>1975)

3. Is head(pwt short,5) less concerning?

So let’s instead only take the ones with no missing variables, using the very convenient drop na function

pwt_short  =  drop_na(filter(pwt,year>1975))

This is hard to read!  In english we want to read left to right, but this has to be read right to left: irst you ilter pwt, and then you drop the missings.  % > % is going to come to the rescue: it applies an argument to the () of the following function. So another way of writing the above is

pwt_short  =  pwt  %>%  filter(year>1975)    %>%  drop_na()

Which tells R to take the dataframe pwt, then to ilter only the years bigger than 1975, and then to drop the missings. Much easier to read.

Many of the useful tidyverse functions for manuplating data are actually located in a package called dplyr (which gets loaded with tidyverse).  Using google, which is your friend, igure out the command to show only the unique values of country (for instance, by googling “dplyr show unique values in column” where the irst hit may not be the most useful one)

4. Write out the code that reports all of the countries (once)

Now you get to pick a country. Whatever country you want!

5. Which country did you pick?  How can you make a new dataframe called “my country” that only contains the values for your country? Use our friend % > %, and go back to assignment 0 if you are having trouble remembering R logic for strings.

Now we are going to calculate the compound annual growth rate for your country (using whatever the start year and end year is for your country).

Some useful commands.

First: I would create a dataframe with only two years in it (where 19xx and 20xx are the irst and last years)

my_country_short  <- my_country %>%  filter(year==19xx   |   year  ==  20xx)

What do you think the j is doing?

Now we want to add some variables with the growth rates. I’ll show you how to do this for year, noting that we don’t actually care about the growth rate of years (since they grow at a rate of one a year) but it is useful for showing the code. I will use the functions lag (which is exactly what you might think it means) and mutate (which takes a data frame and appends it)

my_country_short  <- my_country_short %>% mutate(dif_years  =  year  -  lag(year), growth_years  =  ((year/  lag(year))^(1/dif_years))-1)

Note that R can handle the line split no problem - this is good for keeping your code legible.   (That function at the end is the compound annual growth rate formula)

6. What are the compound annual growth rates for Y, K, and L?

(You will get nonsense answers if you don’t adapt the code above carefully)

Now manipulate the data a bit more

7. What are the compound annual growth rates for y, k, and h?  (the lower case letters mean in per capita terms)

This question you can do with pencil and paper, you don’t have to calculate in R

8. Given your answer to (1), what must TFP growth in your country have been?

Now we’re going to go back to the all of the years in my country

Create new variables for the growth rates of y, k, h, and TFP, calling themy growth, k growth, h growth, and TFP growth .

We’re now going to work on making graphs, using a diferent package called ggplot2 (which is already loaded with tidyverse).

ggplot(data  = my_country, mapping  =  aes(year))    +

geom_line(aes(y  =  y_growth,  color  =  "y_growth"))  +

geom_line(aes(y  =  k_growth,  color  =  "k_growth"))+

geom_line(aes(y  =  h_growth,  color  =  "h_growth"))+

geom_line(aes(y  =  TFP_growth,  color  =  "TFP_growth"))

Note the plusses - I keep adding things to the ggplot graph. The last line doesn’t have a +, so R knows to run it.

9. Plot the relationship between year and all of the growth rates. I already gave you most of the code, but I want you to make two change to the default ggplot choices.  First, axis and legend names should never ever be variable names (unless the variable name is plain english like “year”).  Make the names relect the data. Second, make it so that the graph is legible when printed ( I would suggest changing two things: irst I would pick a diferent theme, getting rid of the gray background, and then I would igure out how to make the scale colors gray)

10.  Briely describe the growth experience of the country you have selected.  Which factor was the most important driver of growth? Was growth relatively constant over the period, or did it vary substantially?