In this lab, we will use Japan to illustrate the changes in age-structure that are resulting from the demographic transition and continued population aging.

Specifically, we will investigate:

  1. What has happened to the share of elderly and children from World War II until today?

  2. What will happen if current levels of fertility and mortality continue?

and

  1. How to use stable age-structures and the Solow model to understand the effect of fertility on consumption in the macro-economy.

Note 1: This lab is somewhat longer than previous labs. Please plan accordingly. There is relatively little code for you to write but there is a substantial amount of material to cover.

Note 2: Please be warned of the varying notation for the exponential growth rate of the stable population. Economists use “n” and demographers use “r”. We tend to mix this usage, in class and in this lab.

Part 0. Preliminaries

# Do not edit this chunk, but *do* press the green button to the answer key for the quiz info (the unreadable string below)
tot = 0
answer.key = "eJy9V01vGzcQvftXDIwWSgB3oS+n7aEHp26KFGkKOAaKHKndkZY1l9yQXMv693kzu5Il7VUo4I+llhzOvJl5b1R8812z4jgrZvQb4e9VUYYYucyF8Wm7f3F9f31V1NbnYflnCBvHNPnoy8gmcUXWV12J/2YVYrbBUzSZ8SnNfn337oaMJ5NamKWwvioM/WVa4zkxrYN7otS1HFO2crCY4CrrU45dKes0XPnArTMlU66ZPt/R1uaadqGL1PtJb7jYFDc0uZvIrd+6kDm9hSl+wTlvxNT/4Ty9eYSDnl+w2cNGovl0/u5tAU8OUM8V6vkYanlx/f4AtS4/2TUTgsA+48sdmUwrGxH8JnCidQyNuN1l+vmWchief7ml8AxQBKwSIMHXsKYFVVyaitMI4fnFEFZLChDVJtGKy9D0Jrchuoocw4FIqwDjsCIvHD+zE/+Aow3VVeHOQ/aVbmzFO+yzTRsRXsM+H8O6UFgXY1gXp7Dq8qPvMyp21xb5oxi2Ylw+aEyO9kVdCm3nNDQx2/mcCnqsA/A0G5TQdEIm4hnJCCifFn692Eb372313mnlaN7SDSXrSymvtfGZGpSccTbvpFaQsx05OAJoFMRRphYXy5Ra+sAoeL29zxZ7vT4F/PObgxu4aV93SSJWU6hvn61xbid15ay3OIFthtbGRnyaMpK902Y6ztNS87Qc50leXP9+yJMuP4escaCQTCewizkbqBSnzBPTs3EdGmGD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Hm6Dk9KVrW9imB53ucAhfCoALPGCw+3c6Ntuj"
library(quizify)
source.coded.txt(answer.key)

Note: the most helpful readings for this lab is Lee (2003) for Parts 1 and 2 and Lee et al (2014) for parts 3, 4, and 5.

Part 1. Population change over the demographic transition.

The first declines in mortality and fertility happened gradually in Europe. More recently, the pace of demographic transition has sped up. An early example of rapid demographic change, for which we have excellent statistics, is Japan.

Until shortly after World War II, Japanese fertility remained high. Mortality rates were improving, and the resulting population growth was very fast – indeed, rapid population growth was one of the reasons that Japan gave for expanding its empire.

After the War, fertility began to decline very rapidly.

## get TFR data from a file on our server
tfr.data <- read.table("/data175/japan_tfr.txt")
year.vec <- tfr.data$Year
tfr.vec <- tfr.data$TFR
plot(year.vec, tfr.vec, type = "o",
     main = "Japanese Period Total Fertility Rate")

In less than a decade, fertility fell to replacement levels near two children per woman.

Q1.1 What do you think happened in 1966?

A. There was a mistake in the data collection. Records were lost, or a calculation error must have been made.

B. The economy crashed

C. 1966 was an inauspicious year according to the Japanese zodiac, the year of the “fire horse” in which it was unlucky to have a daughter born.

D. Everything in C and further evidence of intentionality is that births were slightly higher both before and after 1966.

##  "Replace the NA with your answer (e.g., 'A' in quotes)"
answer1.1 = 'D'
quiz.check(answer1.1)
Your  answer1.1 : D
Correct.
Explanation:  Google 'Increased induced abortion rate in 1966, an aspect of
.a Japanese folk superstition.' (The next one is 2026).

We can see that the pace of mortality improvement was steady the entire time.

e0.data <- read.table("/data175/japan_e0_female.txt")
year.vec <- e0.data$Year
e0.vec <- e0.data$Female
plot(year.vec, e0.vec, type = "o",
     main = "Japanese Period Life Expectancy at Birth, Female")

Life expectancy is greatly influenced by the level of child mortality. Right after WWII we see the enormous effects of reducing child mortality. Today, mortality improvement is still steady, but because the increases in survival are at older ages, the same pace of improvement in mortality rates adds fewer years of life expectancy at birth.

Q1.2 What is the pace of life expectancy improvement from 1980 to 2010?

A. About 1 year per year.

B. About 2-3 years per decade

C. About 1 month per year

##  "Replace the NA with your answer (e.g., 'A' in quotes)"
answer1.2 = 'B'
quiz.check(answer1.2)
Your  answer1.2 : B
Correct.
Explanation:  Japan has become the world leader both in the level of period
.life expectancy and the pace of improvement

Now we are ready to explore the history of Japan’s age-structure.

## read in matrix of population counts
tmp <- read.table("/data175/japan_pop_matrix_1947_2015.txt")
colnames(tmp) <- gsub("X", "", colnames(tmp))
Nxt.mat <- as.matrix(tmp)
# ages 0-110 are rows of the matrix, years 1947-2015 are on the columns
dim(Nxt.mat)
[1] 111  69
# births for each year are given in the row labeled "0"
print(Nxt.mat["0",]) # or equivalently 'print(Nxt.mat[1,])'
   1947    1948    1949    1950    1951    1952    1953    1954    1955    1956    1957    1958    1959    1960    1961 
1855504 2556684 2574462 2551884 2266171 2064338 1944604 1811329 1718212 1683513 1622596 1532070 1609696 1593355 1561461 
   1962    1963    1964    1965    1966    1967    1968    1969    1970    1971    1972    1973    1974    1975    1976 
1562666 1590710 1632791 1686220 1740020 1366045 1902321 1846873 1867598 1875397 1981238 2031447 2069887 2005175 1895777 
   1977    1978    1979    1980    1981    1982    1983    1984    1985    1986    1987    1988    1989    1990    1991 
1817227 1740385 1693313 1625423 1572318 1519929 1506173 1499213 1475690 1421098 1375595 1339677 1304501 1243599 1210966 
   1992    1993    1994    1995    1996    1997    1998    1999    2000    2001    2002    2003    2004    2005    2006 
1217248 1203511 1183835 1219259 1183219 1185310 1190235 1190331 1173903 1163465 1163147 1147730 1117107 1092810 1059566 
   2007    2008    2009    2010    2011    2012    2013    2014    2015 
1086697 1084090 1082996 1057749 1043133 1052895 1031912 1024543 1005404 

Q1.3 What is happening to the number of births from 2014 to 2015?

A. They are increasing as a residual effect of past population growth.

B. They are declining at a rate of 1 or 2 percent a year

##  "Replace the NA with your answer (e.g., 'A' in quotes)"
answer1.3 = 'B'
Warning message:
In scan(file = file, what = what, sep = sep, quote = quote, dec = dec,  :
  EOF within quoted string
quiz.check(answer1.3)
Your  answer1.3 : B
Correct.
Explanation:  Fertility has been low so long in Japan that births are
.exponentially declining at a fairly steady rate

Let’s now visualize the change in Japan’s age structure. We start by viewing the change frame-by-frame:

year.vec <- colnames(Nxt.mat)
for (i in 1:length(year.vec))
{
    barplot(Nxt.mat[,i], horiz = T,
            xlim = c(0, 2.5 * 10^6),
            xlab = "Number of people N(x,t)", ylab = "Age x")
    title(year.vec[i])
##     Sys.sleep(1/10)
}