Hello
I have a question regarding the interpretation of historical decompositions in general. I am using a structural VAR model with sign restrictions and three structural shocks to model the oil price.
I estimated the historical decomposition (using sign restriction approach by uhlig) and I have used dlog(oilprice) in my VAR. Now how do I interpret the results from the decomposition?
Should shock 1 + shock 2 + shock 3 + residual shock = actual price difference? So if I am looking at the oil price decline in 2014 in specific, I should get some 60% decline with the three shocks. However, my output does not result in that difference (see attachment). Do you know how to interprete it correctly?
Thanks
Historical decomposition interpretation
Moderators: EViews Gareth, EViews Moderator
-
irinamueller
- Posts: 3
- Joined: Wed Apr 06, 2016 2:22 am
Historical decomposition interpretation
- Attachments
-
- historical decomposition.jpg (42.62 KiB) Viewed 12616 times
Re: Historical decomposition interpretation
Actual change = Base forecast + Shock1 + Shock2 + Shock3 + ...
And you may want to display the cumulated effect of structural shocks.
And you may want to display the cumulated effect of structural shocks.
-
irinamueller
- Posts: 3
- Joined: Wed Apr 06, 2016 2:22 am
Re: Historical decomposition interpretation
Thank you for the quick reply! I am acctually not quite sure about the exact definition of the base forecast. I assume I obtain them when drawing the historical responses of the oil price (here v4_1 ... v4_4) as I used the code below for the historical decomposition.
How would I obtain the base forecast from there?
Btw the historical decomposition looks much better with the cummulated effects - thanks!
'Code using 4 lags and 4 variables where impact4lags is the name of the reduced-form VAR
' extract the reduced-form residuals
impact4lags.makeresids res1 res2 res3 res4
group g1 res1 res2 res3 res4
'convert residuals to a matrix
matrix res = @convert(g1)
' In recursive VAR, the A matrix is identity and B matrix is the cholesky decomposition of
' covariance matrix of the reduced-form shocks
' calculate the structural shock
matrix Amat1 = @subextract(Amat,1,1,nvar, nvar)
matrix Bmat1 = @subextract(Bmat,1,1,nvar, nvar)
matrix u = @inverse(bmat1) * Amat1 * @transpose(res)
%varsmpl = impact4lags.@smpl
smpl {%varsmpl}
' number of lags in the VAR
!p=4
' number of endogenous variables
nvar=4
' max lag of past values which affect the current value
!h = 30
' number of columns in matrix u
!column = @obssmpl
' extract the coefficient matrices for lag regressors
matrix(nvar, nvar*!p) AA = 0
for !lag=1 to !p
for !i=1 to nvar
for !j=1 to nvar
AA(!i, (!lag-1) * nvar+!j) = impact4lags.@coefmat((!j-1)*!p + !lag, !i)
next
next
matrix(nvar,nvar) Phi{!lag} = @subextract(AA, 1, nvar*(!lag-1)+1, nvar, nvar*!lag)
next
' coefficient matrices in the infinite MA representation for reduced VAR
matrix(nvar, nvar) AA0 = @identity(nvar)
for !i=1 to !p
matrix(nvar, nvar) AA{!i} = 0
for !j=1 to !i
!imj = !i - !j
AA{!i} = AA{!i} + Phi{!j} * AA{!imj}
next
next
for !i=!p+1 to !h
matrix(nvar, nvar) AA{!i} = 0
for !j=1 to !p
!imj = !i - !j
AA{!i} = AA{!i} + Phi{!j} * AA{!imj}
next
next
' the variance-covariance matrix of the reduced-form shocks
'sym Sigma = impact4lags.@residcov
' transform matrix applied to the structural shocks to make reduced-form shocks
'Cholesky decomposition
'matrix L = @cholesky(Sigma)
for !i=0 to !h
AA{!i} = AA{!i} * @inverse(Amat1) * Bmat1
next
matrix(nvar, !column) component1 = 0
matrix(nvar, !column) component2 = 0
matrix(nvar, !column) component3 = 0
matrix(nvar, !column) component4 = 0
for !i=!column to !h+1 step -1
for !row=1 to nvar
vector(nvar) result = 0
for !j=0 to !h
vector(nvar) tmp = 0
tmp(!row) = u(!row, !i-!j)
result = result + AA{!j}*tmp
next
colplace(component{!row}, result, !i)
next
next
for !i=1 to nvar
for %s v1 v2 v3 v4
series {%s}_{!i} = na
next
delete(noerr) g1
group g1 v1_{!i} v2_{!i} v3_{!i} v4_{!i}
component{!i} = @transpose(component{!i})
mtos(component{!i}, g1)
next
How would I obtain the base forecast from there?
Btw the historical decomposition looks much better with the cummulated effects - thanks!
'Code using 4 lags and 4 variables where impact4lags is the name of the reduced-form VAR
' extract the reduced-form residuals
impact4lags.makeresids res1 res2 res3 res4
group g1 res1 res2 res3 res4
'convert residuals to a matrix
matrix res = @convert(g1)
' In recursive VAR, the A matrix is identity and B matrix is the cholesky decomposition of
' covariance matrix of the reduced-form shocks
' calculate the structural shock
matrix Amat1 = @subextract(Amat,1,1,nvar, nvar)
matrix Bmat1 = @subextract(Bmat,1,1,nvar, nvar)
matrix u = @inverse(bmat1) * Amat1 * @transpose(res)
%varsmpl = impact4lags.@smpl
smpl {%varsmpl}
' number of lags in the VAR
!p=4
' number of endogenous variables
nvar=4
' max lag of past values which affect the current value
!h = 30
' number of columns in matrix u
!column = @obssmpl
' extract the coefficient matrices for lag regressors
matrix(nvar, nvar*!p) AA = 0
for !lag=1 to !p
for !i=1 to nvar
for !j=1 to nvar
AA(!i, (!lag-1) * nvar+!j) = impact4lags.@coefmat((!j-1)*!p + !lag, !i)
next
next
matrix(nvar,nvar) Phi{!lag} = @subextract(AA, 1, nvar*(!lag-1)+1, nvar, nvar*!lag)
next
' coefficient matrices in the infinite MA representation for reduced VAR
matrix(nvar, nvar) AA0 = @identity(nvar)
for !i=1 to !p
matrix(nvar, nvar) AA{!i} = 0
for !j=1 to !i
!imj = !i - !j
AA{!i} = AA{!i} + Phi{!j} * AA{!imj}
next
next
for !i=!p+1 to !h
matrix(nvar, nvar) AA{!i} = 0
for !j=1 to !p
!imj = !i - !j
AA{!i} = AA{!i} + Phi{!j} * AA{!imj}
next
next
' the variance-covariance matrix of the reduced-form shocks
'sym Sigma = impact4lags.@residcov
' transform matrix applied to the structural shocks to make reduced-form shocks
'Cholesky decomposition
'matrix L = @cholesky(Sigma)
for !i=0 to !h
AA{!i} = AA{!i} * @inverse(Amat1) * Bmat1
next
matrix(nvar, !column) component1 = 0
matrix(nvar, !column) component2 = 0
matrix(nvar, !column) component3 = 0
matrix(nvar, !column) component4 = 0
for !i=!column to !h+1 step -1
for !row=1 to nvar
vector(nvar) result = 0
for !j=0 to !h
vector(nvar) tmp = 0
tmp(!row) = u(!row, !i-!j)
result = result + AA{!j}*tmp
next
colplace(component{!row}, result, !i)
next
next
for !i=1 to nvar
for %s v1 v2 v3 v4
series {%s}_{!i} = na
next
delete(noerr) g1
group g1 v1_{!i} v2_{!i} v3_{!i} v4_{!i}
component{!i} = @transpose(component{!i})
mtos(component{!i}, g1)
next
Re: Historical decomposition interpretation
Base forecast refers to dynamic forecasts of each endogenous variable generated from the VAR model. If you like, you can also use hdecomp add-in.
-
irinamueller
- Posts: 3
- Joined: Wed Apr 06, 2016 2:22 am
Re: Historical decomposition interpretation
Thank you for your reply. I am not sure if my programm generates this output as it is rather long and messy... do you know where I could get some input regarding my code? That would be a great help, thank you!
Re: Historical decomposition interpretation
It's difficult for me to follow either. But, it is quite possible that your output already includes this base forecast. If so, all you should do is to produce dynamic forecasts from your VAR model and then substract them from your output. This should leave you with the sum of impacts from shocks.
Return to “Econometric Discussions”
Who is online
Users browsing this forum: No registered users and 1 guest
