Resources

Simulating Klein's Model I

/*--------------------------------------------------------------

                    SAS Sample Library

        Name: simex01.sas
 Description: Example program from SAS/ETS User's Guide,
              The SIMLIN Procedure
       Title: Simulating Klein's Model I
     Product: SAS/ETS Software
        Keys: structural equations
        PROC: SIMLIN
       Notes:

--------------------------------------------------------------*/

data klein;
   input year c p w i x wp g t k wsum;
   date=mdy(1,1,year);
   format date year.;
   y   = c + i + g - t;
   yr  = year - 1931;
   klag = lag( k );
   plag = lag( p );
   xlag = lag( x );
   if year >= 1921;
   label c   ='consumption'
         p   ='profits'
         w   ='private wage bill'
         i   ='investment'
         k   ='capital stock'
         y   ='national income'
         x   ='private production'
         wsum='total wage bill'
         wp  ='govt wage bill'
         g   ='govt demand'
         t   ='taxes'
         klag='capital stock lagged'
         plag='profits lagged'
         xlag='private product lagged'
         yr  ='year-1931';
datalines;
1920     .  12.7     .    .  44.9    .     .     .  182.8     .
1921  41.9  12.4  25.5 -0.2  45.6  2.7   3.9   7.7  182.6  28.2
1922  45.0  16.9  29.3  1.9  50.1  2.9   3.2   3.9  184.5  32.2
1923  49.2  18.4  34.1  5.2  57.2  2.9   2.8   4.7  189.7  37.0
1924  50.6  19.4  33.9  3.0  57.1  3.1   3.5   3.8  192.7  37.0
1925  52.6  20.1  35.4  5.1  61.0  3.2   3.3   5.5  197.8  38.6
1926  55.1  19.6  37.4  5.6  64.0  3.3   3.3   7.0  203.4  40.7
1927  56.2  19.8  37.9  4.2  64.4  3.6   4.0   6.7  207.6  41.5
1928  57.3  21.1  39.2  3.0  64.5  3.7   4.2   4.2  210.6  42.9
1929  57.8  21.7  41.3  5.1  67.0  4.0   4.1   4.0  215.7  45.3
1930  55.0  15.6  37.9  1.0  61.2  4.2   5.2   7.7  216.7  42.1
1931  50.9  11.4  34.5 -3.4  53.4  4.8   5.9   7.5  213.3  39.3
1932  45.6   7.0  29.0 -6.2  44.3  5.3   4.9   8.3  207.1  34.3
1933  46.5  11.2  28.5 -5.1  45.1  5.6   3.7   5.4  202.0  34.1
1934  48.7  12.3  30.6 -3.0  49.7  6.0   4.0   6.8  199.0  36.6
1935  51.3  14.0  33.2 -1.3  54.4  6.1   4.4   7.2  197.7  39.3
1936  57.7  17.6  36.8  2.1  62.7  7.4   2.9   8.3  199.8  44.2
1937  58.7  17.3  41.0  2.0  65.0  6.7   4.3   6.7  201.8  47.7
1938  57.5  15.3  38.2 -1.9  60.9  7.7   5.3   7.4  199.9  45.9
1939  61.6  19.0  41.6  1.3  69.5  7.8   6.6   8.9  201.2  49.4
1940  65.0  21.1  45.0  3.3  75.7  8.0   7.4   9.6  204.5  53.0
1941  69.7  23.5  53.3  4.9  88.4  8.5  13.8  11.6  209.4  61.8
1942     .     .     .    .     .  8.5  13.8  11.6      .     .
1943     .     .     .    .     .  8.5  13.8  12.6      .     .
1944     .     .     .    .     .  8.5  13.8  11.6      .     .
1945     .     .     .    .     .  8.5  13.8  11.6      .     .
1946     .     .     .    .     .  8.5  13.8  11.6      .     .
1947     .     .     .    .     .  8.5  13.8  11.6      .     .
;

title1 'Simulation of Klein''s Model I using SIMLIN';
proc syslin 3sls data=klein outest=a;

   instruments klag plag xlag wp g t yr;
   endogenous c p w i x wsum k y;

   consume: model    c = p plag wsum;
   invest:  model    i = p plag klag;
   labor:   model    w = x xlag yr;

   product: identity x = c + i + g;
   income:  identity y = c + i + g - t;
   profit:  identity p = x - w - t;
   stock:   identity k = klag + i;
   wage:    identity wsum = w + wp;
run;

proc print data=a;
run;

title1 'Simulation of Klein''s Model I using SIMLIN';
proc simlin data=klein
            est=a type=3sls
            estprint
            total interim=2
            outest=b;
   endogenous c p w i x wsum k y;
   exogenous  wp g t yr;
   lagged  klag k 1   plag p 1   xlag x 1;
   id year;
   output out=c p=chat phat what ihat xhat wsumhat khat yhat
                r=cres pres wres ires xres wsumres kres yres;
run;

proc print data=b;
   where _type_ = 'REDUCED' | _type_ = 'IMULT1';
run;

title2 'Plots of Simulation Results';
proc sgplot data=c;
   scatter x=year y=c;
   series x=year y=chat / markers markerattrs=(symbol=plus);
   refline 1941.5 / axis=x;
run;