RATS 11
RATS 11

SHILLER.RPF is an example of mixed estimation (for a Shiller smoothness prior estimate of a distributed lag). This uses the same data set and basic model as in DISTRIBLAG.RPF.

 

Shiller (1973) proposed an estimation method for distributed lags which reduces the variability in the lags seen in least squares estimates, while imposing a less stringent shape restriction than the Polynomial Distributed Lag. His smoothness prior (of degree \(d\)) takes the form:

\begin{equation} \left( {1 - L} \right)^{d + 1} \beta _i = v_i \label{eq:shiller_restriction} \end{equation}

where \(\beta\) is the vector of lag coefficients. If the \(v\) were true zero (rather than being small random numbers), then \(\beta\) would follow a degree \(d\) polynomial. This creates a set of "dummy observations" on the lag coefficients. Since these have a fairly simple form (in particular, the \(\bf{V}\) matrix is scalar), we will do the estimates directly rather than using the @MIXED procedure.

 

We start out with CMOM and LINREG(CMOM) instructions to create the required cross product matrices and do the least squares distributed lag from which we will need the estimated residual variance to rescale the variances in the dummy observations.

 

compute lags=24

compute d=1

*

cmom

# constant shortrate{0 to lags}  longrate

*

* Do the unrestricted distributed lag

*

linreg(cmom) longrate

# constant shortrate{0 to lags}

 

We need to create the \(\bf{R}\) matrix so \eqref{eq:shiller_restriction} can be written

\begin{equation} {\bf{R}}\beta = {\bf{v}} \end{equation}

The instruction FMATRIX with the option DIFF=d+1 can be used—it creates a matrix which has the properties of a differencing or filtering operator which is precisely what we need.

 

This example uses a first degree prior (\(d=1\)) with lag zero of SHORTRATE left free. Thus, there are 22 rows in the R matrix: the 24 affected lags minus (d+1). FMATRIX starts at entry (1,3) because the CONSTANT and lag zero are the first two regressors in the model.

 

declare rect dummy(lags-(d+1),lags+2)

*

fmatrix(diff=d+1) dummy 1 3

compute dummyxx =tr(dummy)*dummy

 

We next pull out the \(\bf{X'X}\) and \({\bf{X'y}}\) matrices:

 

compute xx=%xsubmat(%cmom,1,%ncmom-1,1,%ncmom-1)

compute xy=%xsubmat(%cmom,1,%ncmom-1,%ncmom,%ncmom)

 

%NCMOM is the size of the full cross product matrix, so row/column %NCMOM is for the dependent variable (as we organized the CMOMENT instruction).

 

The only remaining question is what is the appropriate variance for the \(v\) in \eqref{eq:shiller_restriction}. This is part of the "prior" but we may have only a vague idea. We expect that the overall sum of the lag coefficients to be somewhere around 1 (since it is one interest rate on a another interest rate). As a general rule, the prior can be quite a bit "looser" than you might expect and still have a substantial effect on the coefficients—the data by itself has rather weak information about the shape of the lag distribution, so even a small hint in the direction of "smooth is better than not smooth" will change the shape. We actually use four different values: a base value of .01 (or a standard deviation of .1, which is generally the easiest way to think about it) and that variance divided by 2, 4 and 8 (implemented by multiplying up the DUMMYXX by those values).

 

compute scalefac=%seesq/.01

 

This is the scale factor that allows us to mix "dummy observations" with actual data by making them all have (roughly) the same variance. The following does the mixed estimation, combining data with prior information:

 

dofor [real] power = 1.0 2.0 4.0 8.0

   compute kfactor=power*scalefac

   compute xxq=xx+kfactor*dummyxx

   compute xyq=xy

   compute mixxx=inv(xxq)

   compute mixb =mixxx*xyq

   compute title="Shiller Smoothness Prior with k="+%strval(kfactor,"*.##")

   linreg(create,lastreg,coeff=mixb,covmat=mixxx,title=title) longrate

end dofor

 

As POWER increases, the estimates get smoother, but note that even the first Shiller estimate, which is quite a loose prior, is substantially smoother than the original OLS regressions. (All of them have the property that the lag turns up at the end; just not as much with the tighter priors. This is common with lag truncations on variables with a high level of autocorrelation).

 

The SHILLERGIBBS.RPF example does the same type of analysis but uses the more modern approach of Gibbs sampling rather than mixed estimation.

Full Program

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
linreg(cmom) longrate
# constant shortrate{0 to 24}
*
declare rect dummy(22,27)
declare symm cmomhold(27,27) dummyxx(27,27)
fmatrix(diff=2) dummy 1 3
compute cmomhold=%cmom
compute dummyxx =tr(dummy)*dummy
*
compute scalefac=%seesq/.01
dofor [real] power = 1.0 2.0 4.0 8.0
   compute kfactor=power*scalefac
   compute %cmom  =cmomhold+kfactor*dummyxx
   compute title="Shiller Smoothness Prior with k="+%strval(kfactor,"*.##")
   linreg(cmom,title=title) longrate
   # constant shortrate{0 to 24}
end dofor
 

Output

 

Linear Regression - Estimation by Least Squares

Dependent Variable LONGRATE

Monthly Data From 1949:01 To 2007:04

Usable Observations                       700

Degrees of Freedom                        674

Centered R^2                        0.8951770

R-Bar^2                             0.8912889

Uncentered R^2                      0.9839108

Mean of Dependent Variable       6.1440571429

Std Error of Dependent Variable  2.6181144800

Standard Error of Estimate       0.8632282458

Sum of Squared Residuals         502.23986490

Regression F(25,674)                 230.2354

Significance Level of F             0.0000000

Log Likelihood                      -877.0561

Durbin-Watson Statistic                0.0896

 

    Variable                        Coeff      Std Error      T-Stat      Signif

************************************************************************************

1.  Constant                      1.672475104  0.067473794     24.78703  0.00000000

2.  SHORTRATE                     0.453439132  0.086136629      5.26418  0.00000019

3.  SHORTRATE{1}                 -0.094668190  0.144896493     -0.65335  0.51375318

4.  SHORTRATE{2}                  0.052983512  0.152244376      0.34802  0.72793667

5.  SHORTRATE{3}                 -0.018857374  0.153371945     -0.12295  0.90218183

6.  SHORTRATE{4}                  0.063790400  0.153616599      0.41526  0.67808578

7.  SHORTRATE{5}                  0.084543569  0.154480458      0.54728  0.58436975

8.  SHORTRATE{6}                 -0.004286232  0.156341085     -0.02742  0.97813613

9.  SHORTRATE{7}                  0.046222046  0.156782514      0.29482  0.76822497

10. SHORTRATE{8}                 -0.066795220  0.156624402     -0.42647  0.66990338

11. SHORTRATE{9}                  0.020265529  0.153969413      0.13162  0.89532376

12. SHORTRATE{10}                -0.058462752  0.150514569     -0.38842  0.69782848

13. SHORTRATE{11}                 0.056806104  0.149407094      0.38021  0.70390916

14. SHORTRATE{12}                 0.044969624  0.150030177      0.29974  0.76447004

15. SHORTRATE{13}                 0.015649051  0.149403284      0.10474  0.91661036

16. SHORTRATE{14}                -0.078691033  0.150520030     -0.52279  0.60128912

17. SHORTRATE{15}                -0.023182556  0.153947718     -0.15059  0.88034641

18. SHORTRATE{16}                -0.068641873  0.156619259     -0.43827  0.66132938

19. SHORTRATE{17}                 0.050922524  0.156858591      0.32464  0.74555452

20. SHORTRATE{18}                 0.119791197  0.156413095      0.76586  0.44402520

21. SHORTRATE{19}                -0.022025194  0.154557282     -0.14251  0.88672368

22. SHORTRATE{20}                 0.024980054  0.153787232      0.16243  0.87101391

23. SHORTRATE{21}                -0.023470380  0.153579909     -0.15282  0.87858443

24. SHORTRATE{22}                 0.090537387  0.152488292      0.59373  0.55288966

25. SHORTRATE{23}                -0.157174438  0.145139493     -1.08292  0.27923126

26. SHORTRATE{24}                 0.417377352  0.086179819      4.84310  0.00000159

 

 

Linear Regression - Estimation by Shiller Smoothness Prior with k=74.52

Dependent Variable LONGRATE

Monthly Data From 1949:01 To 2007:04

Usable Observations                       700

Degrees of Freedom                        674

Mean of Dependent Variable       6.1440571429

Std Error of Dependent Variable  2.6181144800

Standard Error of Estimate       0.8660644952

Sum of Squared Residuals         505.54563649

Durbin-Watson Statistic                0.0752

 

    Variable                        Coeff      Std Error      T-Stat      Signif

************************************************************************************

1.  Constant                      1.677095269  0.067660859     24.78679  0.00000000

2.  SHORTRATE                     0.433771239  0.069613133      6.23117  0.00000000

3.  SHORTRATE{1}                 -0.050355226  0.073985362     -0.68061  0.49635161

4.  SHORTRATE{2}                  0.003051449  0.039216941      0.07781  0.93800272

5.  SHORTRATE{3}                  0.038421801  0.039199413      0.98016  0.32735752

6.  SHORTRATE{4}                  0.052981621  0.037452451      1.41464  0.15763677

7.  SHORTRATE{5}                  0.044203048  0.036882832      1.19847  0.23115448

8.  SHORTRATE{6}                  0.024046985  0.036786484      0.65369  0.51353400

9.  SHORTRATE{7}                  0.004674370  0.036811427      0.12698  0.89899291

10. SHORTRATE{8}                 -0.015057894  0.037295359     -0.40375  0.68652674

11. SHORTRATE{9}                 -0.022145919  0.037330072     -0.59325  0.55321549

12. SHORTRATE{10}                -0.002024797  0.037333135     -0.05424  0.95676327

13. SHORTRATE{11}                 0.027341817  0.037426439      0.73055  0.46530903

14. SHORTRATE{12}                 0.030641042  0.037422918      0.81878  0.41320278

15. SHORTRATE{13}                -0.003582276  0.037340587     -0.09594  0.92360056

16. SHORTRATE{14}                -0.047097986  0.037222494     -1.26531  0.20619756

17. SHORTRATE{15}                -0.048799272  0.037321580     -1.30753  0.19147691

18. SHORTRATE{16}                -0.007281560  0.036991597     -0.19684  0.84400925

19. SHORTRATE{17}                 0.038943655  0.036710940      1.06082  0.28915223

20. SHORTRATE{18}                 0.053056017  0.036819841      1.44096  0.15005962

21. SHORTRATE{19}                 0.033274189  0.037006807      0.89914  0.36890081

22. SHORTRATE{20}                 0.006799931  0.037015313      0.18371  0.85429944

23. SHORTRATE{21}                -0.011884553  0.037200794     -0.31947  0.74946882

24. SHORTRATE{22}                -0.001715693  0.039350148     -0.04360  0.96523564

25. SHORTRATE{23}                 0.083709261  0.035448522      2.36143  0.01848806

26. SHORTRATE{24}                 0.260032976  0.046421332      5.60158  0.00000003

 

 

Linear Regression - Estimation by Shiller Smoothness Prior with k=149.03

Dependent Variable LONGRATE

Monthly Data From 1949:01 To 2007:04

Usable Observations                       700

Degrees of Freedom                        674

Mean of Dependent Variable       6.1440571429

Std Error of Dependent Variable  2.6181144800

Standard Error of Estimate       0.8669965708

Sum of Squared Residuals         506.63437822

Durbin-Watson Statistic                0.0732

 

    Variable                        Coeff      Std Error      T-Stat      Signif

************************************************************************************

1.  Constant                      1.678264938  0.067726360     24.78008  0.00000000

2.  SHORTRATE                     0.424678577  0.067381180      6.30263  0.00000000

3.  SHORTRATE{1}                 -0.037920579  0.065915371     -0.57529  0.56528590

4.  SHORTRATE{2}                  0.006422285  0.033541606      0.19147  0.84821332

5.  SHORTRATE{3}                  0.037290530  0.032517310      1.14679  0.25187531

6.  SHORTRATE{4}                  0.048957594  0.031469069      1.55574  0.12024005

7.  SHORTRATE{5}                  0.040549901  0.030487277      1.33006  0.18394847

8.  SHORTRATE{6}                  0.021940078  0.030279818      0.72458  0.46896266

9.  SHORTRATE{7}                  0.003689201  0.030321404      0.12167  0.90319675

10. SHORTRATE{8}                 -0.011602564  0.030661318     -0.37841  0.70524484

11. SHORTRATE{9}                 -0.014817471  0.030650577     -0.48343  0.62894600

12. SHORTRATE{10}                 0.001152517  0.030594331      0.03767  0.96996121

13. SHORTRATE{11}                 0.020943706  0.030702418      0.68215  0.49537740

14. SHORTRATE{12}                 0.019849332  0.030668527      0.64722  0.51770893

15. SHORTRATE{13}                -0.007658719  0.030555740     -0.25065  0.80216306

16. SHORTRATE{14}                -0.038579448  0.030553829     -1.26267  0.20714396

17. SHORTRATE{15}                -0.037627695  0.030598351     -1.22973  0.21922749

18. SHORTRATE{16}                -0.004158710  0.030319810     -0.13716  0.89094411

19. SHORTRATE{17}                 0.032736445  0.030150238      1.08578  0.27796570

20. SHORTRATE{18}                 0.045173818  0.030324814      1.48967  0.13678008

21. SHORTRATE{19}                 0.029727078  0.030476511      0.97541  0.32970712

22. SHORTRATE{20}                 0.005777213  0.030455091      0.18970  0.84960436

23. SHORTRATE{21}                -0.007395059  0.031158369     -0.23734  0.81246686

24. SHORTRATE{22}                 0.013083133  0.032644911      0.40077  0.68871576

25. SHORTRATE{23}                 0.095155138  0.027594558      3.44833  0.00059916

26. SHORTRATE{24}                 0.237380679  0.041406673      5.73291  0.00000001

 

 

Linear Regression - Estimation by Shiller Smoothness Prior with k=298.07

Dependent Variable LONGRATE

Monthly Data From 1949:01 To 2007:04

Usable Observations                       700

Degrees of Freedom                        674

Mean of Dependent Variable       6.1440571429

Std Error of Dependent Variable  2.6181144800

Standard Error of Estimate       0.8682570686

Sum of Squared Residuals         508.10860724

Durbin-Watson Statistic                0.0714

 

    Variable                        Coeff      Std Error      T-Stat      Signif

************************************************************************************

1.  Constant                      1.679488544  0.067817947     24.76466  0.00000000

2.  SHORTRATE                     0.414006577  0.065153913      6.35429  0.00000000

3.  SHORTRATE{1}                 -0.022109252  0.058358589     -0.37885  0.70491729

4.  SHORTRATE{2}                  0.010826614  0.029608191      0.36566  0.71473142

5.  SHORTRATE{3}                  0.034454470  0.026735883      1.28870  0.19794537

6.  SHORTRATE{4}                  0.043007089  0.026410509      1.62841  0.10390566

7.  SHORTRATE{5}                  0.035776963  0.025286938      1.41484  0.15757733

8.  SHORTRATE{6}                  0.020110472  0.024824418      0.81011  0.41816374

9.  SHORTRATE{7}                  0.004800154  0.024847026      0.19319  0.84686974

10. SHORTRATE{8}                 -0.006385558  0.025090324     -0.25450  0.79918475

11. SHORTRATE{9}                 -0.008046114  0.025038255     -0.32135  0.74804267

12. SHORTRATE{10}                 0.002135403  0.024939500      0.08562  0.93179127

13. SHORTRATE{11}                 0.012963347  0.025025185      0.51801  0.60461988

14. SHORTRATE{12}                 0.009424698  0.024981678      0.37726  0.70609588

15. SHORTRATE{13}                -0.010027482  0.024887591     -0.40291  0.68714153

16. SHORTRATE{14}                -0.029177912  0.024946921     -1.16960  0.24257554

17. SHORTRATE{15}                -0.026053042  0.024939109     -1.04467  0.29655183

18. SHORTRATE{16}                -0.000972826  0.024727394     -0.03934  0.96862933

19. SHORTRATE{17}                 0.025897580  0.024691341      1.04885  0.29462185

20. SHORTRATE{18}                 0.035142748  0.024872872      1.41289  0.15814831

21. SHORTRATE{19}                 0.023918140  0.024961331      0.95821  0.33830161

22. SHORTRATE{20}                 0.006727848  0.025145184      0.26756  0.78911981

23. SHORTRATE{21}                 0.002097010  0.026204571      0.08002  0.93624144

24. SHORTRATE{22}                 0.028995230  0.026562956      1.09157  0.27541379

25. SHORTRATE{23}                 0.102405240  0.021724674      4.71378  0.00000296

26. SHORTRATE{24}                 0.214557251  0.036660727      5.85251  0.00000001

 

 

Linear Regression - Estimation by Shiller Smoothness Prior with k=596.13

Dependent Variable LONGRATE

Monthly Data From 1949:01 To 2007:04

Usable Observations                       700

Degrees of Freedom                        674

Mean of Dependent Variable       6.1440571429

Std Error of Dependent Variable  2.6181144800

Standard Error of Estimate       0.8697568869

Sum of Squared Residuals         509.86552650

Durbin-Watson Statistic                0.0700

 

    Variable                        Coeff      Std Error      T-Stat      Signif

************************************************************************************

1.  Constant                      1.680635704  0.067929161     24.74101  0.00000000

2.  SHORTRATE                     0.404342658  0.062870789      6.43133  0.00000000

3.  SHORTRATE{1}                 -0.006393383  0.051319099     -0.12458  0.90089245

4.  SHORTRATE{2}                  0.015155162  0.026792886      0.56564  0.57182591

5.  SHORTRATE{3}                  0.030842519  0.021995357      1.40223  0.16130739

6.  SHORTRATE{4}                  0.036282272  0.021990379      1.64992  0.09942609

7.  SHORTRATE{5}                  0.030779192  0.021110306      1.45802  0.14530155

8.  SHORTRATE{6}                  0.019092788  0.020423706      0.93483  0.35020830

9.  SHORTRATE{7}                  0.007448397  0.020323024      0.36650  0.71410672

10. SHORTRATE{8}                 -0.000985832  0.020510502     -0.04806  0.96167887

11. SHORTRATE{9}                 -0.003253733  0.020483584     -0.15885  0.87383789

12. SHORTRATE{10}                 0.001132832  0.020364061      0.05563  0.95565387

13. SHORTRATE{11}                 0.005351040  0.020391550      0.26241  0.79308201

14. SHORTRATE{12}                 0.001409342  0.020375584      0.06917  0.94487625

15. SHORTRATE{13}                -0.010487065  0.020332474     -0.51578  0.60617783

16. SHORTRATE{14}                -0.020398833  0.020372288     -1.00130  0.31703967

17. SHORTRATE{15}                -0.016144669  0.020331763     -0.79406  0.42743915

18. SHORTRATE{16}                 0.001207989  0.020221262      0.05974  0.95238155

19. SHORTRATE{17}                 0.018852531  0.020266477      0.93023  0.35258390

20. SHORTRATE{18}                 0.024893758  0.020378423      1.22157  0.22229574

21. SHORTRATE{19}                 0.018250383  0.020487229      0.89082  0.37334494

22. SHORTRATE{20}                 0.009719829  0.020991196      0.46304  0.64348291

23. SHORTRATE{21}                 0.013844426  0.021964305      0.63031  0.52870229

24. SHORTRATE{22}                 0.043752194  0.021218943      2.06194  0.03959622

25. SHORTRATE{23}                 0.106365912  0.017586755      6.04807  0.00000000

26. SHORTRATE{24}                 0.193155555  0.032280860      5.98359  0.00000000

 


 


Copyright © 2025 Thomas A. Doan