Home | GLMs | Multilevel | Survival | Demography | Stata | R

Population Projections

This unit illustrates the use of the cohort component method in population projections.

All calculations are done in Mata. An alternative version of this handout using only Stata is available here.

Reading The Data

We will use the data from Sweden used in Box 6.1 (page 125 in the textbook), available as file Sweden93.dat to save you some typing. We read the population counts, the life table, and the fertility rates, and copy them to Mata. The last age group is 85+ and 'big-L' for that age is actually time lived after age 85. We also express person-years per birth, dividing by l0.

. infile age p L f using ///
>         http://data.princeton.edu/eco572/datasets/sweden93.dat
(18 observations read)

. list

     +-------------------------------+
     | age        p        L       f |
     |-------------------------------|
  1. |   0   293395   497487       0 |
  2. |   5   248369   497138       0 |
  3. |  10   240012   496901       0 |
  4. |  15   261346   496531    .012 |
  5. |  20   285209   495902   .0908 |
     |-------------------------------|
  6. |  25   314388   495168   .1499 |
  7. |  30   281290   494213   .1125 |
  8. |  35   286923   492760   .0441 |
  9. |  40   304108   490447   .0074 |
 10. |  45   324946   486613   .0003 |
     |-------------------------------|
 11. |  50   247613   480665       0 |
 12. |  55   211351   471786       0 |
 13. |  60   215140   457852       0 |
 14. |  65   221764   436153       0 |
 15. |  70   223506   402775       0 |
     |-------------------------------|
 16. |  75   183654   350358       0 |
 17. |  80   141990   271512       0 |
 18. |  85   112424   291707       0 |
     +-------------------------------+

. mata:
------------------------------------------------- mata (type end to exit) -------------------------------------------
: p93 = st_data(.,"p")

: L  =  st_data(.,"L")/100000

: f  = st_data(.,"f")

: sum(p93)
  4397428

: end
---------------------------------------------------------------------------------------------------------------------

The Leslie Matrix

We will write a function to compute a Leslie matrix given person-years 5Lx (with the convention that the last value is Tx and the radix is 1) and maternity rates 5mx.

. mata:
------------------------------------------------- mata (type end to exit) -------------------------------------------
: real matrix Leslie(real vector L, real vector m)
> {
>         n = length(L)
>         M = J(n,n,0)

>         // lower diagonal has survivorship ratios
>         for (i=1; i < n; i++) {
>                 M[i+1,i] = L[i+1]/L[i]
>         }
>         M[n,n-1] = M[n,n] = L[n]/(L[n-1]+L[n])

>         // first row has net maternity contributions
>         for(i=1; i < n; i++) {
>                 if(m[i]==0 & m[i+1]==0) continue
>                 M[1,i] = L[1]*(m[i] + m[i+1]*L[i+1]/L[i])/2
>         }
>         if (m[n] > 0) M[1,n] = L[1]*m[n]
>         return(M)
> }

: end
---------------------------------------------------------------------------------------------------------------------

The function computes the survivorship ratios and stores them in the lower diagonal. For example M[2,1] = L[2]/L[1] is the probability of surviving from 0-4 to 5-9, 5L5/5L0 in standard demographic notation. The only tricky bit is the last (open) age interval, where we combine the last two groups and project then using L[n]/(L[n-1]+L[n]). In Sweden we combine 80-84 and 85+ and use T85/T80 = T85/(5L80+T80) as the survival ratio. (As noted in class, if we had T90 we would use a slightly different procedure. The textbook describes that procedure on page 121 but uses the combined projection in Box 6.1.)

The rest of the calculation computes the average fertility rate for each age group and then survives the resulting births to age 0-4. For example women 15-19 are exposed to the rates at 15-19 and 20-24, with the latter discounted by the probability of surviving to 20-24, so we average m[4] and m[5]*L[5]/L[4]. The rate would be multiplied by 5, the width of the period, and the probability of surviving from birth to age 0-4, which is L[1]/5. The 5's cancel, so we don't include them. (As noted in class there are two ways of computing births, here we focused on the women and average the rates, an approach best suited for computing the Leslie matrix. The textbook also describes focusing on the rates and averaging the numbers of women exposed to each.)

Projections for 5 and 10 years

For Sweden we have fertility rates, so we divide by 2.05 to obtain maternity rates (females births) before calling our function. Once we have a Leslie matrix, projection is easy

. mata:
------------------------------------------------- mata (type end to exit) -------------------------------------------
: M = Leslie(L, f/2.05)

: p98 = M * p93

: p03 = M * p98

: round( (p93,p98,p03) )
             1        2        3
     +----------------------------+
   1 |  293395   293574   280121  |
   2 |  248369   293189   293368  |
   3 |  240012   248251   293049  |
   4 |  261346   239833   248066  |
   5 |  285209   261015   239529  |
   6 |  314388   284787   260629  |
   7 |  281290   313782   284238  |
   8 |  286923   280463   312859  |
   9 |  304108   285576   279147  |
  10 |  324946   301731   283344  |
  11 |  247613   320974   298043  |
  12 |  211351   243039   315045  |
  13 |  215140   205109   235861  |
  14 |  221764   204944   195388  |
  15 |  223506   204793   189260  |
  16 |  183654   194419   178141  |
  17 |  141990   142324   150666  |
  18 |  112424   131768   141960  |
     +----------------------------+

: sum(p98), sum(p03) 
                 1             2
    +-----------------------------+
  1 |  4449569.727   4478712.273  |
    +-----------------------------+

: end
---------------------------------------------------------------------------------------------------------------------

These results agree exactly with Box 6.1 (part 2) in the text.

The Stable Equivalent

While we have the Leslie matrix handy we can compute the intrinsic rate of growth and the stable age distribution by simply obtaining the first eigenvalue and eigenvector of the projection matrix.

This is easy to do in mata, as long as we define the output vector and matrix before. Here I use empty matrices.

. mata:
------------------------------------------------- mata (type end to exit) -------------------------------------------
: values = J(0,0,.)

: vectors = J(0,0,.)

: eigensystem(M,vectors,values)

: values[1]
  1.00111253

: log(values[1])/5
  .000222383

: stable = Re(vectors[,1]/sum(vectors[,1]))

: stable
                  1
     +---------------+
   1 |  .0619116748  |
   2 |  .0617994881  |
   3 |  .0617013816  |
   4 |  .0615869203  |
   5 |   .061440548  |
   6 |  .0612814302  |
   7 |  .0610952699  |
   8 |  .0608479527  |
   9 |  .0604950315  |
  10 |  .0599554177  |
  11 |  .0591567528  |
  12 |  .0579994637  |
  13 |   .056223923  |
  14 |  .0534997799  |
  15 |  .0493506342  |
  16 |  .0428804537  |
  17 |  .0331935317  |
  18 |   .035580346  |
     +---------------+

: end
---------------------------------------------------------------------------------------------------------------------

The first eigenvalue is 1.0011, so if the 1993 fertility and mortality rates stayed constant the population would eventually grow 0.11 percent every 5 years, or 0.022 percent per year. The first eigenvector, divided by its sum, gives as the proportionate age distribution. (The Re function takes the real part of a complex number. The eigenvalues and eigenvectors can be complex numbers and Stata stores them as such, althought the first eigenvalue and eigenvector of a Leslie matrix are real.)

We return to stable populations in a separate handout, but there is a lot you could do with the Swedish data. For one thing you might try projecting the population for a 100 years of so (20 periods) to verify that it becomes stable. You may also try plotting the current and stable equivalent age distributions to see what that says about population momentum.