* * Example 1.3.4 from page 10 * open data uspop.dat calendar(years=10) 1790 data(format=free,org=columns) 1790:1 1990:1 uspop * * Rescale to millions to keep the numbers more manageable * set uspop = uspop*1.e-6 * * These create the trend and squared trend. T is a reserved variable used in * SET instructions and elsewhere to represent the current time period. * set trend = t set trend2 = t**2 * * LINREG does a linear regression. The parameter on the first line is the * dependent variable. The explanatory variables are shown on a separate line that * starts with a "#" symbol. * linreg uspop # constant trend trend2 * * PRJ (in its simplest use) gets the fitted values from the regression just * completed. * prj fitted * graph(footer="Figure 1.8 Population of U.S. with Quadratic Trend",vlabel="Millions",$ overlay=dots,ovsame) 2 # fitted # uspop