* * Example 11.7, page 416 * Weighted least squares * * The only lines in Table 11.1 that we need are the 11th, 13th and 12th, * which give the average compensation and average productivity, and * the sample standard deviations. Note, however, a typo in y(5) in the CD text * file, which is corrected below. * data(unit=input,format=free) 1 9 y x sigma 3396.00 3787.00 4013.00 4104.00 4146.00 4241.00 4387.00 4538.00 4843.00 9355.00 8584.00 7962.00 8275.00 8389.00 9418.00 9795.00 10281.00 11750.00 743.70 851.40 727.80 805.06 929.90 1080.60 1243.20 1307.70 1112.50 * * Doing weighted least squares "by hand" * set wy = y/sigma set wc = 1/sigma set wx = x/sigma linreg wy # wc wx * * OLS * linreg y # constant x * * Using weighted least squares through linreg. For WLS, RATS has you specify the * the variances (or at least a series proportional to them). This is related to * the weights by weight = 1/sqrt(spread) * linreg(spread=sigma**2) y # constant x