Bias squaring impulse responses?
Bias squaring impulse responses?
Hello, I am trying to program a forecast error variance decomposition of a VAR. I am using the bootstrap algorithm to compute standard errors for the explanation shares of the various shocks. After accumulating the impulses I need to take squares. But I found the following strange error inside my program. When I am squaring the impulse responses inside the bootstrap loop the resulting series is not the correct square of the original series.
I attached a file demonstrating the problem. This file is not my program, I just use it to demonstrate the problem shortly. I just took the bootvar.prg provided by estima. I calculated squares of the impulses inside the bootstrap loop. After finishing the bootstrap replications I read the mean of the impulse responses and calculate squares. I compare the squares of the responses calculated outside the bootstrap loop with those calculated inside the bootstrap. Normally the difference should be zero. But there is a growing bias. Where is my mistake?
Thanks a lot in advance
wolfgang
I attached a file demonstrating the problem. This file is not my program, I just use it to demonstrate the problem shortly. I just took the bootvar.prg provided by estima. I calculated squares of the impulses inside the bootstrap loop. After finishing the bootstrap replications I read the mean of the impulse responses and calculate squares. I compare the squares of the responses calculated outside the bootstrap loop with those calculated inside the bootstrap. Normally the difference should be zero. But there is a growing bias. Where is my mistake?
Thanks a lot in advance
wolfgang
- Attachments
-
- bootvar2.prg
- demonstration program
- (2.97 KiB) Downloaded 1014 times
Re: Bias squaring impulse responses?
In one case, you're computing the sample mean of the squares, and in the other, the square of the sample mean. The difference between the two (in the order you're doing them) is (minus) the sample variance, which looks about right.
Unless you're doing something more complicated than just bootstrapping the FEVD, you should probably use ERRORS rather than doing the calculation yourself.
Unless you're doing something more complicated than just bootstrapping the FEVD, you should probably use ERRORS rather than doing the calculation yourself.
Re: Bias squaring impulse responses?
Dear Tom, thanks a lot for the help. The task of my empirical work is a blanchard quah decomposition. The variables are I(1) in levels, therefore I have to estimate the VAR in first differences. But I'm interrested on the effect on the level of the variables.
When I'm using Errors instruction it computes the FEVD for the change in the variables, but I need the FEVD for the level. And for each share I need standard errors. But for the FEVD in levels. Therefore I computed the FEVD inside the bootstrap loop as follows:
* accumulating responses
do i=1,nvar
do j=1, nvar
acc impulses(i,j) 1 nstep impulsesacc(i,j)
end do j
end do i
*accumulating , taking squares, computing FEVD
do i=1, nvar
do j=1, nvar
acc impulsesacc(i,j) 1 nstep impulsesaccs(i,j)
set impulsessq(i,j) =impulsesaccs(i,j)^2
set fevd(i,j) =impulsessq(i,j)/(impulsessq(i,1)+impulsessq(i,2))
end do j
end do i
Whem I'm repeating the same procedure outside the bootstrap the FEVD shares are different. Outside the bootstrap loop I read the mean of the responses, accumulating..... an so on. You explained about the differences of taking squares. But which way is the right one? The square of the mean of the responses (outside the bootstrap) or the mean of the squared responses (inside the bootstrap)?
Thanks in advance
When I'm using Errors instruction it computes the FEVD for the change in the variables, but I need the FEVD for the level. And for each share I need standard errors. But for the FEVD in levels. Therefore I computed the FEVD inside the bootstrap loop as follows:
* accumulating responses
do i=1,nvar
do j=1, nvar
acc impulses(i,j) 1 nstep impulsesacc(i,j)
end do j
end do i
*accumulating , taking squares, computing FEVD
do i=1, nvar
do j=1, nvar
acc impulsesacc(i,j) 1 nstep impulsesaccs(i,j)
set impulsessq(i,j) =impulsesaccs(i,j)^2
set fevd(i,j) =impulsessq(i,j)/(impulsessq(i,1)+impulsessq(i,2))
end do j
end do i
Whem I'm repeating the same procedure outside the bootstrap the FEVD shares are different. Outside the bootstrap loop I read the mean of the responses, accumulating..... an so on. You explained about the differences of taking squares. But which way is the right one? The square of the mean of the responses (outside the bootstrap) or the mean of the squared responses (inside the bootstrap)?
Thanks in advance
Re: Bias squaring impulse responses?
You're doing the final calculation in the wrong order. You want to square the responses, then accumulate them. So you wantparetto wrote:Therefore I computed the FEVD inside the bootstrap loop as follows:
Code: Select all
* accumulating responses do i=1,nvar do j=1, nvar acc impulses(i,j) 1 nstep impulsesacc(i,j) end do j end do i *accumulating , taking squares, computing FEVD do i=1, nvar do j=1, nvar acc impulsesacc(i,j) 1 nstep impulsesaccs(i,j) set impulsessq(i,j) =impulsesaccs(i,j)^2 set fevd(i,j) =impulsessq(i,j)/(impulsessq(i,1)+impulsessq(i,2)) end do j end do i
Code: Select all
do j=1, nvar
set impulsessq(i,j) =impulsesaccs(i,j)^2
acc impulsessq(i,j) 1 nstep
set fevd(i,j) =impulsessq(i,j)/(impulsessq(i,1)+impulsessq(i,2))
end do j