* * Application of GMM, section 18.5, pp 551-555 * open data tablef18-1[1].txt calendar(panelobs=9) 1979 data(format=prn,org=columns) 1//1979:01 265//1987:01 id year expend revenue grants * set ds = expend-expend{1} set dr = revenue-revenue{1} set dg = grants-grants{1} * set d1983 = %year(t)==1983 set d1984 = %year(t)==1984 set d1985 = %year(t)==1985 set d1986 = %year(t)==1986 set d1987 = %year(t)==1987 * * Figure out the number of lags needed for the instruments for each series. * compute nplags = 7+6+5+4+3 * * Create the instruments * dec vect[series] abspend(nplags) dec vect[series] abrev(nplags) dec vect[series] abgrants(nplags) * compute fill=1 do period=1987:1,1983:1,-1 do lag=period-1,2,-1 set abspend(fill) = %if(%period(t)==period,expend{lag},0.0) set abrev(fill) = %if(%period(t)==period,revenue{lag},0.0) set abgrants(fill) = %if(%period(t)==period,grants{lag},0.0) compute fill=fill+1 end do lag end do period * instruments d1983 d1984 d1985 d1986 d1987 abspend abrev abgrants * set smpl = %year(t)>=1983.and.%year(t)<=1987 * linreg(optimal,instruments,smpl=smpl) ds # d1983 d1984 d1985 d1986 d1987 ds{1 to 3} dr{1 to 3} dg{1 to 3} linreg(optimal,instruments,smpl=smpl) dr # d1983 d1984 d1985 d1986 d1987 ds{1 to 3} dr{1 to 3} dg{1 to 3} linreg(optimal,instruments,smpl=smpl) dg # d1983 d1984 d1985 d1986 d1987 ds{1 to 3} dr{1 to 3} dg{1 to 3} linreg(optimal,instruments,smpl=smpl) ds # d1983 d1984 d1985 d1986 d1987 ds{1 to 1} dr{1 to 1} dg{1 to 1} linreg(optimal,instruments,smpl=smpl) dr # d1983 d1984 d1985 d1986 d1987 ds{1 to 1} dr{1 to 1} dg{1 to 1} linreg(optimal,instruments,smpl=smpl) dg # d1983 d1984 d1985 d1986 d1987 ds{1 to 1} dr{1 to 1} dg{1 to 1} linreg(optimal,instruments,smpl=smpl) ds # d1983 d1984 d1985 d1986 d1987 ds{1 to 3} dr{1 to 3} dg{1 to 3}