* * AKAIKE.RPF * Example of the use of information criteria for choosing lag length. * * RATS User's Guide, Example from Section 2.9 * open data haversample.rat calendar(m) 1947 data(format=rats) 1947:1 2007:4 fltg ftb3 set shortrate = ftb3 set longrate = fltg * cmom # constant shortrate{0 to 24} longrate * * Using DISPLAY instructions * disp "Lag" @10 "Akaike" @20 "Schwarz" do maxlag=0,24 linreg(cmom,noprint) longrate # constant shortrate{0 to maxlag} compute akaike =(-2.0*%logl+%nreg*2.0)/%nobs compute schwarz=(-2.0*%logl+%nreg*log(%nobs))/%nobs disp maxlag ##.### @10 akaike @20 schwarz end do * * Using REPORT * report(action=define,hlabels=||"Lags","Akaike","Schwarz"||,\$ title="Distributed Lag IC") do maxlag=0,24 linreg(cmom,noprint) longrate # constant shortrate{0 to maxlag} compute akaike =(-2.0*%logl+%nreg*2.0)/%nobs compute schwarz=(-2.0*%logl+%nreg*log(%nobs))/%nobs report(row=new,atcol=1) maxlag akaike schwarz end do * * Tag with a * the minimum in the 2nd and in the 3rd columns. * report(action=format,tag=minimum,special=onestar,atcol=2,tocol=2) report(action=format,tag=minimum,special=onestar,atcol=3,tocol=3) * * Use a common format of three decimals to the right. Force the numbers * to align on the decimal point for easy reading. * report(action=format,picture="*.###",align=decimal) report(action=show)