Kenji Sato
2016-12-07
After taking Watkins's courses, I believe you are familiar with R programing language.
library(readstata13)
library(dplyr)
library(ggplot2)
pwt8 = read.dta13("pwt90.dta")
You can easily analyse the data with R + dplyr.
pwt8 %>%
filter(country == "Japan", year > 2010) %>%
mutate(rgdp_per_capita = rgdpo / pop) %>%
select(year, rgdp_per_capita)
year rgdp_per_capita
1 2011 34979.34
2 2012 35191.24
3 2013 35476.46
4 2014 35566.22
Unit: 2011US$
Note: With R it is difficult to see the descriptive labels that STATA variables have. Install gretl to work around.
We are interested in evolution of real GDP per person (per capita). Becase it is a nice statistic to measure the standard of living for a country.
Let's compare those of three countries since 1980.
rgdp <- pwt8 %>%
filter(countrycode %in% c("JPN","USA", "KOR"),
year > 1980) %>%
mutate(rgdp_pc = rgdpo / pop) %>%
select(country, year, rgdp_pc) %>%
as.data.frame
ggplot(rgdp, aes(x=year, y=rgdp_pc, color=country)) +
geom_point() + geom_line(aes(group=country))
When studying the growth rates, semi-log scale is helpful.
rgdp %>% ggplot(aes(x=year, y=rgdp_pc, color=country)) + geom_point() +
scale_y_log10() + # Plot in semi-log scale
geom_smooth(method = "lm", se = FALSE)
\[ \begin{aligned} & \text{Gross annual growth rate from 2000 to 2010} \\ &= \left(\frac{GDP_{2010}}{GDP_{2000}}\right)^{1/10} \end{aligned} \]
And so, ….
\[ \begin{aligned} & \log (\text{Gross annual growth rate from 2000 to 2010}) \\ &= \frac{\log GDP_{2010} - \log GDP_{2000}}{2010 - 2000} \end{aligned} \]
The slopes of the lines you observed in the semi-log plot correspond to the growth rates of the countries.
The growth rates change over time.
rgdp %>% ggplot(aes(x=year, y=rgdp_pc, color=country)) + geom_point() +
scale_y_log10() + # Plot in semi-log scale
geom_smooth(method="lm", se=FALSE) +
geom_smooth(data=filter(rgdp, year > 1995),
method="lm", se=FALSE)
cross_country <- pwt8 %>% filter(year == 2014) %>%
mutate(rgdp_pc = rgdpo / pop) %>%
select(countrycode, rgdp_pc) %>% as.data.frame
ggplot(cross_country, aes(x=rgdp_pc)) +
geom_histogram() + labs(x="GDP per Capita", y="Number of Countries")