notes smoothing-Splines

notes smoothing-Splines - Eco 572: Research methods in...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Eco 572: Research methods in Demography Smoothing: Splines This continues our work on smoothing. Let's start by making sure we have loaded the data. . infile age pop using /// > http://data.princeton.edu/eco572/datasets/cohhpop.dat (99 observations read) Our application will focus on regression splines, because they are the easiest ones to use in Stata, but we will mention briefly natural regression splines and smoothing splines. Regression Splines A cubic spline S(x) with knots t 1 ... t k has linear, quadratic and cubic terms on x , and one term of the form (x-t j ) 3 + for each knot. These terms can easily be computed and entered in a regression, although one should be careful about multi-collinearity when there are lots of knots. A better solution is to use b-splines , a well-conditioned basis for splines. Stata does not have built-in b-splines, but Roger Newson has contributed a command that you can install from the depository at SSC (the Statistical Software Components archive) or from his own website. Type findit bspline to learn more. Let us use spline regression to smooth the Colombian data. We will use a cubic spline with 3 internal knots at ages 25, 50 and 75. For comparison we will fit a second spline with 4 internal knots at ages 20, 40, 60 and 80. Newson's command requires you to specify the extremes as well, so we add 0 and 100 in both cases, but these don't count as real knots in our terminology. Don't forget to specify p(3) to get cubic splines, otherwise you get piecewise linear splines. . bspline, xvar(age) knots(0 25 50 75 100) p(3) gen(_bs3k)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

notes smoothing-Splines - Eco 572: Research methods in...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online