The site has a collection of computing handouts, showing how to use Stata and R
(with dplyr
and ggplot2
) in demographic analysis. Click on the Table of Contents
for direct access to the logs, or see the descriptions below. The syllabus for
Spring 2017 is here. The class handouts originally
on Blackboard are now available here.
Here’s a computing handout on Growth Rates and Doubling Time, the topic of the first class, followed by one on Rates and Standardization, where we discuss direct and indirect standardization and the decomposition of differences in rates, the subjects of our second meeting.
On week 2 we start with age heaping and Myer’s index
before we enter the wonderful world of splines. To learn about running
means, running lines, and all sorts of splines, read the first 6 pages
of a statistical demography handout on
Smoothing and Non-Parametric Regression. The
applications start with running means and lines, including
the lowess
smoother, and continue with regression
splines and spline interpolation.
We start week 3 with a review of life tables, and a handout on period life table construction. We have an illustration of Brass’s relational logit model, and another fitting the modified logit and log-quadratic models.
How fast do we age? We fit a Gompertz curve to adult mortality in the U.S.. We work with male survival and invite you to do the same calculations for females. We also discuss the Kaplan-Meir estimate of a survival curve from censored data, and an application of Cox regression to the cancer relapse data we used for Kaplan-Meier.
The handout on unobserved heterogeneity provides a summary of the main ideas. (A more detailed discussion may be found on an earlier statistical demography handout; focus on gamma heterogeneity and the inversion formula). The illustration deals with heterogeneity and mortality cross-overs.
We go over the example in the textbook working with multiple-decrement and cause-deleted life tables, including a simplified approach that assumes constant risks within each age group. We illustrate increment-decrement life tables using a classic dataset on contraceptive discontinuation.
Spring is in the air and we turn to a study of marrriage. The handout covers current status life tables, with applications to nuptiality and duration of breastfeeding. And here’s the application of the Coale-McNeil and Hernes models of marriage.
We start our study of fertility by computing age-specific fertility rates from survey data using an exact and an approximate method. We fit Coale’s model of marital fertility by age to the data in Brostrom’s paper. We then apply Page’s model to study fertility by age and duration since first union in urban and rural areas.
Here’s a bith intervals analysis of the transition from second to third birth in Colombia in 1976 by childhood place of residence. I include illustrative computations of quintums and trimeans and, for good measure, a proportional hazards model.
To provide some background for our discussion of tempo effects on fertility and mortality, here’s an analysis of U.S. fertility 1917-1980, including an application of Ryder’s translation formula and the Bongaarts-Feeney tempo adjustment.
The handouts include an application of the cohort component method to the Swedish data in the textbook using a Leslie matrix, and an examination of key aspects of the Lee-Carter approach to forecasting mortality, with an application of the singular value decomposition to U.S. data for 1933-1987 and a simulation of stochastic forecasts.
We come to a close with two handouts on stable populations. The first deals with computing Lotka’s r and the stable equivalent age distribution, following the examples in Boxes 7.1 and 7.2 in the textbook. The second deals with the estimation of population momentum using the Preston-Guillot method illustrated in Box 7.3 of the textbook and, as a comparison, Keyfitz’s formula.
Note. The computing logs were all produced using the markstat
command to combine
Markdown with Stata and R, as described here,
see also this example.
All the scripts are available on GitHub, just follow the link on each page.
Updated Fall 2022