Innovation accounting: IRF and FEVD

Questions and discussions on Vector Autoregressions
ac_1
Posts: 495
Joined: Thu Apr 15, 2010 6:30 am

Innovation accounting: IRF and FEVD

Unread post by ac_1 »

Hi Tom,

I can calculate (univariate and bivariate) IRF's manually; and verify using IMPULSE and (bivariate) @VARIRF. I can generate results as in enders4 AETS CH5 Section 7 Figure 5.7.

I am having problems with understanding FEVD formuale and I cannot generate the same results using ERRORS (to aid my understanding) by-hand.

Here's a 2-variable example (based on e1.dat):

Code: Select all

open data e1.dat
calendar(q) 1960
data(format=prn,org=columns,skips=6) 1960:01 1982:04 invest income cons
*
set dinc  = log(income/income{1})
set dcons = log(cons/cons{1})
set dinv  = log(invest/invest{1})
*
system(model=varmodel)
variables dinv dcons
lags 1
det constant
end(system)
estimate(sigma,residuals=resids,noftests) * 1978:4

disp 'sigma' %sigma

comp chol = %decomp(%sigma)
disp 'chol:' chol


*===============================
errors(model=varmodel,steps=10,print)

With results:

Code: Select all

VAR/System - Estimation by Least Squares
Quarterly Data From 1960:03 To 1978:04
Usable Observations                        74

Dependent Variable DINV
Mean of Dependent Variable       0.0184283044
Std Error of Dependent Variable  0.0470362338
Standard Error of Estimate       0.0458457325
Sum of Squared Residuals         0.1492300146
Durbin-Watson Statistic                2.1079

    Variable                        Coeff      Std Error      T-Stat      Signif
************************************************************************************
1.  DINV{1}                      -0.252102535  0.118641101     -2.12492  0.03707530
2.  DCONS{1}                      0.915023222  0.539901911      1.69480  0.09449637
3.  Constant                      0.004577133  0.011724359      0.39040  0.69741321

Dependent Variable DCONS
Mean of Dependent Variable       0.0199455998
Std Error of Dependent Variable  0.0104517085
Standard Error of Estimate       0.0105593721
Sum of Squared Residuals         0.0079165240
Durbin-Watson Statistic                1.8937

    Variable                        Coeff      Std Error      T-Stat      Signif
************************************************************************************
1.  DINV{1}                      -0.006400833  0.027325892     -0.23424  0.81547236
2.  DCONS{1}                     -0.073329741  0.124352363     -0.58969  0.55726834
3.  Constant                      0.021530823  0.002700401      7.97319  0.00000000


Covariance\Correlation Matrix of Residuals
          DINV        DCONS
DINV  0.0020166218   0.27916925
DCONS 0.0001296675 0.0001069801

sigma
      0.00202
  1.29668e-04   1.06980e-04

chol:
      0.04491       0.00000
      0.00289       0.00993


Decomposition of Variance for Series DINV
 Step   Std Error    DINV    DCONS
      1 0.04490681  100.000   0.000
      2 0.04663193   96.202   3.798
      3 0.04675769   95.822   4.178
      4 0.04676489   95.798   4.202
      5 0.04676525   95.797   4.203
      6 0.04676527   95.797   4.203
      7 0.04676527   95.797   4.203
      8 0.04676527   95.797   4.203
      9 0.04676527   95.797   4.203
     10 0.04676527   95.797   4.203

Decomposition of Variance for Series DCONS
 Step   Std Error    DINV    DCONS
      1 0.01034312    7.794  92.206
      2 0.01038074    7.968  92.032
      3 0.01038115    7.976  92.024
      4 0.01038118    7.976  92.024
      5 0.01038118    7.976  92.024
      6 0.01038118    7.976  92.024
      7 0.01038118    7.976  92.024
      8 0.01038118    7.976  92.024
      9 0.01038118    7.976  92.024
     10 0.01038118    7.976  92.024

If I try to implement the forumale as in enders4, and just focusing on DINV.

The n-step-ahead FEVD of DINV are:

Step 1

DINV(1)^2 = 0.04491^2 * [-0.252102535(0)^2] + 0.00993^2 * [0.915023222(0)^2] ]

DINV = (0.04491^2 * [-0.252102535(0)^2]) / DINV(1)^2

and

DCONS = (0.00993^2 * [0.915023222(0)^2]) / DINV(1)^2

But they do not equal 100.000 and 0.000?

Amarjit
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Innovation accounting: IRF and FEVD

Unread post by TomDoan »

The FEVD for the one-step forecast just involves the impact shocks. (1-step ahead errors are just the residuals). By construction with that ordering, the impact of CONS on INV is 0, hence the 100%-0% FEVD. What you are computing is part of the 2-step ahead, but not correctly--errors in forecasting t+2 given t include both the t+1 errors and t+2 errors and you are just including the t+1 errors.

Why don't you just use IMPULSE and work with those, rather than computing the IRF's from the raw information? You said you understand how to compute IRF's so why not let the software do that work for you?
ac_1
Posts: 495
Joined: Thu Apr 15, 2010 6:30 am

Re: Innovation accounting: IRF and FEVD

Unread post by ac_1 »

TomDoan wrote: Tue Apr 30, 2024 1:27 pm The FEVD for the one-step forecast just involves the impact shocks. (1-step ahead errors are just the residuals). By construction with that ordering, the impact of CONS on INV is 0, hence the 100%-0% FEVD. What you are computing is part of the 2-step ahead, but not correctly--errors in forecasting t+2 given t include both the t+1 errors and t+2 errors and you are just including the t+1 errors.

Why don't you just use IMPULSE and work with those, rather than computing the IRF's from the raw information? You said you understand how to compute IRF's so why not let the software do that work for you?
Yes - I have. The formulae to calculate IRF's are in enders4 AETS, and I have manually (in Excel) verified using IMPULSE and @VARIRF in RATS.

Also for FEVD, and I'd like to do similar (to aid my understanding), calculate step2, step3, etc, but do not understand those i.e. how to calculate Step 2 onwards?

Code: Select all

Decomposition of Variance for Series DINV (y variable)
 Step   Std Error    DINV    DCONS
      1 0.04490681  100.000   0.000
      2 0.04663193   96.202   3.798
      3 0.04675769   95.822   4.178
etc
and from Step 1?

Code: Select all

Decomposition of Variance for Series DCONS (z variable)
 Step   Std Error    DINV    DCONS
      1 0.01034312    7.794  92.206
      2 0.01038074    7.968  92.032
      3 0.01038115    7.976  92.024
etc
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Innovation accounting: IRF and FEVD

Unread post by TomDoan »

Given that this is the RATS discussion list, have you looked at the description of the ERRORS instruction? ERRORS with the IMPULSES option also shows the IRF's that are used in doing the variance decomposition.
ac_1
Posts: 495
Joined: Thu Apr 15, 2010 6:30 am

Re: Innovation accounting: IRF and FEVD

Unread post by ac_1 »

TomDoan wrote: Thu May 02, 2024 6:58 am Given that this is the RATS discussion list, have you looked at the description of the ERRORS instruction? ERRORS with the IMPULSES option also shows the IRF's that are used in doing the variance decomposition.
Yes, it's using complicated matrix calculations, and as described in: https://en.wikipedia.org/wiki/Variance_ ... ast_errors & references therein.

To repeat, the idea is get a feel for the FEVD calculations in a simple 2-by-2 case as in enders4.

Code: Select all

errors(model=varmodel,steps=10,print,impulse)


Responses to Shock in DINV

 Entry      DINV        DCONS
       1  0.04490681  0.00288748
       2 -0.00867901 -0.00049918
       3  0.00173124  0.00009216
       4 -0.00035212 -0.00001784
       5  0.00007245  0.00000356
       6 -0.00001500 -0.00000072
       7  0.00000312  0.00000015
       8 -0.00000065 -0.00000003
       9  0.00000014  0.00000001
      10 -0.00000003 -0.00000000


Responses to Shock in DCONS

 Entry      DINV        DCONS
       1  0.00000000  0.00993189
       2  0.00908791 -0.00072830
       3 -0.00295750 -0.00000476
       4  0.00074123  0.00001928
       5 -0.00016923 -0.00000616
       6  0.00003703  0.00000153
       7 -0.00000793 -0.00000035
       8  0.00000168  0.00000008
       9 -0.00000035 -0.00000002
      10  0.00000007  0.00000000


Decomposition of Variance for Series DINV
 Step   Std Error    DINV    DCONS
      1 0.04490681  100.000   0.000
      2 0.04663193   96.202   3.798
      3 0.04675769   95.822   4.178
      4 0.04676489   95.798   4.202
      5 0.04676525   95.797   4.203
      6 0.04676527   95.797   4.203
      7 0.04676527   95.797   4.203
      8 0.04676527   95.797   4.203
      9 0.04676527   95.797   4.203
     10 0.04676527   95.797   4.203

Decomposition of Variance for Series DCONS
 Step   Std Error    DINV    DCONS
      1 0.01034312    7.794  92.206
      2 0.01038074    7.968  92.032
      3 0.01038115    7.976  92.024
      4 0.01038118    7.976  92.024
      5 0.01038118    7.976  92.024
      6 0.01038118    7.976  92.024
      7 0.01038118    7.976  92.024
      8 0.01038118    7.976  92.024
      9 0.01038118    7.976  92.024
     10 0.01038118    7.976  92.024


comp chol = %decomp(%sigma)
disp "Cholesky matrix = " ##.################ chol

Cholesky matrix =
 0.0449068126170768  0.0000000000000000
 0.0028874800596432  0.0099318937521667
If I try to implement the forumale as in enders4, and just focusing on DINV:

Step 2

Code: Select all

comp denom = (0.0449068126170768 * (0.04490681^2 + (-0.00867901)^2)) + $
             (0.0099318937521667 * (0.00288748^2 + (-0.00049918)^2))
disp denom

comp fevd_dinv = 100.0 * ((0.0449068126170768 * 0.04490681^2) / denom)
disp fevd_dinv

comp fevd_dcons = 100.0 * ((0.0099318937521667 * 0.00288748^2) / denom)
disp fevd_dcons
does not equal 96.202 and 3.798, respectively; and I'd very much appreciate help with calculating the steps.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Innovation accounting: IRF and FEVD

Unread post by TomDoan »

The Cholesky factor is already incorporated in the IRF's---the whole point of orthogonalization is to create shocks which are uncorrelated contemporaneously with unit variance.

For two-step forecasts:

compute a=(0.04490681^2+(-0.00867901)^2)
compute b=(0^2+0.00908791^2)
?100.0*a/(a+b) 100.0*b/(a+b)

Aside from the fact that you're double-dipping with Cholesky factor values, you're also confusing the responses of CONS to INV shock with the responses of INV to CONS shock.
ac_1
Posts: 495
Joined: Thu Apr 15, 2010 6:30 am

Re: Innovation accounting: IRF and FEVD

Unread post by ac_1 »

TomDoan wrote: Sun May 05, 2024 8:34 pm The Cholesky factor is already incorporated in the IRF's---the whole point of orthogonalization is to create shocks which are uncorrelated contemporaneously with unit variance.

For two-step forecasts:

compute a=(0.04490681^2+(-0.00867901)^2)
compute b=(0^2+0.00908791^2)
?100.0*a/(a+b) 100.0*b/(a+b)

Aside from the fact that you're double-dipping with Cholesky factor values, you're also confusing the responses of CONS to INV shock with the responses of INV to CONS shock.

Thanks! I have a feel for these now :-) (2-variables), they are calculated via the IRF's. However, as you say let the software handle the calculations (n-variables) as in the ERRORS instruction description.

* STEP 3
compute a=((0.04490681)^2.0)+((-0.00867901)^2.0)+((0.00173124)^2.0)
compute b=((0.0)^2.0)+((0.00908791)^2.0)+((-0.00295750)^2.0)
?100.0*a/(a+b) 100.0*b/(a+b)

etc etc

Likewise for DCONS.

Also, in enders4 there is the moving average representation equation (5.37). Can the phi's be calculated from the VAR in Primitive or Structural Form combined with the VAR in Standard Form?

e.g.
phi11(i) = ( (a11^i)*1 + (a12^i)*(-b21) ) / (1 - b12*b21)

a11, a12: from VAR in Standard Form
b12, b21: from VAR in Primitive or Structural Form
i: steps ahead

Code: Select all

*===============================
* VAR: Primitive or Structural Form
* ---------------------------------

equation dinveq dinv
# constant dcons{0} dinv{1} dcons{1}
equation dconseq dcons
# constant dinv{0} dinv{1} dcons{1}

group varmodel1 dinveq dconseq
*sur(model=varmodel1) 2 * 1978:4
estimate(model=varmodel1) * 1978:4


* VAR: Standard Form
* ------------------
system(model=varmodel)
variables dinv dcons
lags 1
det constant
end(system)

*sur(model=varmodel,sigma) 2 * 1978:4
estimate(model=varmodel,sigma) * 1978:4
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Innovation accounting: IRF and FEVD

Unread post by TomDoan »

You can't estimate the model in that form. You can write it in that form if you have a consistent way to estimate it, but least squares can't be used.
Post Reply