{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

notes splines interpolation

# notes splines interpolation - Eco 572 Research methods in...

This preview shows pages 1–3. Sign up to view the full content.

Eco 572: Research methods in Demography Interpolation Splines can also be used for interpolation. Here we reproduce the results in the article by Mc Neil, Trussell and Turner listed in the readings. The Data The data represent cumulative fertility at ages 20(5)50, which we can just type into Stata. . clear . input age F age F 1. 15 0 2. 20 .080 3. 25 .593 4. 30 1.297 5. 35 1.840 6. 40 2.171 7. 45 2.296 8. 50 2.306 9. end Polynomial Interpolation With 8 data points we can get an exact fit using a 7-th degree polynomial. Let us reproduce Figure 1 in the article, showing that polynomials don't work very well in this case. We need age^2 to age^7: . forvalues p=2/7 { 2. gen age`p' = age^`p' 3. } . quietly regress F age* Because the fit is exact the residual sum of squares is 0 and the standard errors are undefined, so we wont print the results. To do the interpolation we create a new data set with age in single years and just predict . How that for easy? We'll go from 13 to 51 to the extremes. . drop _all . set obs 39 obs was 0, now 39 . gen age = 12 + _n . forvalues p=2/7 { 2. gen age`p' = age^`p' 3. } . predict Fit (option xb assumed; fitted values) . line Fit age, xlabel(15(5)50) name(Fp) Now that we have cumulative fertility at ages 13 to 51 we can compute differences to obtain age-specific fertility rates centered at the midpoints and plot them . gen fit = Fit - Fit[_n-1] http://data.princeton.edu/eco572/interpolation.html (1 of 5) [2/12/2008 10:28:16 AM]

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

View Full Document
Eco 572: Research methods in Demography (1 missing value generated) . gen agem = (age + age[_n-1])/2 (1 missing value generated) . line fit agem, xtitle(age) xlabel(15(5)50) name(fp) . graph combine Fp fp, xsize(6) ysize(3) title(Polynomial Fit) . graph export iasfrp.png, replace
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}