Near-VAR with sign restrictions
Re: Near-VAR with sign restrictions
The median and the bands should come from the nested simulations. The median target comes from the secondary calculation.
You do the median target because a referee will probably ask for it. There is no other compelling reason for it.
You do the median target because a referee will probably ask for it. There is no other compelling reason for it.
Re: Near-VAR with sign restrictions
Thank you so much for all your advice. I am 200% sure that my supervisor and the examiners are going to ask for this median target and that's why I am so concerned about it. Anyway, thanks a million.
Re: Near-VAR with sign restrictions
Dear Tom,
I have tried to remove the outer-loop in my simulation to obtain the median target as per your advice. However, the model doesn't work now and I don't know how to correct it. I am very new to this sign restriction, so could you please help me to fix the problem? Thanking you in advance.
I have tried to remove the outer-loop in my simulation to obtain the median target as per your advice. However, the model doesn't work now and I don't know how to correct it. I am very new to this sign restriction, so could you please help me to fix the problem? Thanking you in advance.
Last edited by Yashodha on Fri Jul 26, 2019 1:41 am, edited 1 time in total.
Re: Near-VAR with sign restrictions
Once you've computed the median target responses, the generated responses used in computing those aren't needed any longer. You can just do the nested draws after that to generate the information for the actual medians and the error bands.
Re: Near-VAR with sign restrictions
Dear Tom,
Thank you very much for your advice.
Since I have multiple shocks in my model, I should be optimizing across all identified shocks as well as across all variables to find the model that provides the median target responses. Am I correct? I have changed my code to do this optimization and to save the median target responses but my model doesn't work again. I would truly appreciate if you could help me to correct the code so that I can save the MT responses before I move to the nested simulation.
Thanking you in advance.
Thank you very much for your advice.
Since I have multiple shocks in my model, I should be optimizing across all identified shocks as well as across all variables to find the model that provides the median target responses. Am I correct? I have changed my code to do this optimization and to save the median target responses but my model doesn't work again. I would truly appreciate if you could help me to correct the code so that I can save the MT responses before I move to the nested simulation.
Thanking you in advance.
Last edited by Yashodha on Fri Jul 26, 2019 1:41 am, edited 1 time in total.
Re: Near-VAR with sign restrictions
I don't know what process (if any) has been proposed for doing median-target responses with multiple shocks.
Re: Near-VAR with sign restrictions
Dear Tom,
Thanks for helping me to clear up my earlier misunderstanding.
I have two more problems.
a) When I try to plot the median and median target in the same IRF graph I get very weird lines for MT (i.e. in the last set of graphs). I can't figure-out what the problem is.
b) Is it possible to get an IRF graph for a new variable, which is the ratio between two variables in the original variables set. For example, IRF graph for TOT, where TOT=EXPR/IMPR.
Please bear with me for having so many questions, but you are the only helpline I have at the moment. Thanking you in advance.
Thanks for helping me to clear up my earlier misunderstanding.
I have two more problems.
a) When I try to plot the median and median target in the same IRF graph I get very weird lines for MT (i.e. in the last set of graphs). I can't figure-out what the problem is.
b) Is it possible to get an IRF graph for a new variable, which is the ratio between two variables in the original variables set. For example, IRF graph for TOT, where TOT=EXPR/IMPR.
Please bear with me for having so many questions, but you are the only helpline I have at the moment. Thanking you in advance.
Re: Near-VAR with sign restrictions
graph(ticks,number=0,picture="##.##",header="Impulse Responses for"+vl(i)) 4Yashodha wrote:Dear Tom,
Thanks for helping me to clear up my earlier misunderstanding.
I have two more problems.
a) When I try to plot the median and median target in the same IRF graph I get very weird lines for MT (i.e. in the last set of graphs). I can't figure-out what the problem is.
# MT_wd (i)
# median
# upper / 2
# lower / 2
You never create an MT_WD(i). You just keep overwriting a single MT_WD series. (The (i) turns into a range parameter as you're written that).
Only for linear combinations. (Aren't those in logs? They should be). Mountford and Uhlig do quite a few derived linear responses.Yashodha wrote: b) Is it possible to get an IRF graph for a new variable, which is the ratio between two variables in the original variables set. For example, IRF graph for TOT, where TOT=EXPR/IMPR.
Re: Near-VAR with sign restrictions
Dear Tom,
I get your point. So, how can I save the MT responses before the nested simulation?
I get your point. So, how can I save the MT responses before the nested simulation?
Re: Near-VAR with sign restrictions
Save those into elements of a VECT[SERIES] rather into a single series. The lines in red below are the ones that are creating the problem.
compute v1_mt=%stereo(g_wd) set MT_wd 1 nstep = 0.0 spgraph(vfields=4,hfields=2,$ hlabel="Impulse Responses; World Demand Shock - Median Target") do i=1,nvar set MT_wd 1 nstep = ik_mt=%xt(impulses,t)*v1_mt,ik_mt(i) graph(ticks,number=0,picture="##.##",$ header="Impulse Responses for "+vl(i)) 3 # MT_wd 1 nstep # lower_mt_wd(i) 1 nstep 2 # upper_mt_wd(i) 1 nstep 2 end do i
Re: Near-VAR with sign restrictions
Now I feel quite stupid
. Even after you have pointed-out my mistakes, I still can't fix it. Could you please help me to correct my code.
Re: Near-VAR with sign restrictions
Dear Tom,
I managed to correct my code to get both median and median targets in the same graph (although the code is very lengthy, I believe what i did was correct). So thank you for all your advice.
Also I tried to get the impulse responses of the implied variable TOT (i.e. TOT= EXPR-IMPR) to the first identified shock in the model (last part of the code). However, I get three horizontal lines as the median, lower and upper-bound lines. Could you please help me to correct the code.
Thanking you in advance.
I managed to correct my code to get both median and median targets in the same graph (although the code is very lengthy, I believe what i did was correct). So thank you for all your advice.
Also I tried to get the impulse responses of the implied variable TOT (i.e. TOT= EXPR-IMPR) to the first identified shock in the model (last part of the code). However, I get three horizontal lines as the median, lower and upper-bound lines. Could you please help me to correct the code.
Thanking you in advance.
Re: Near-VAR with sign restrictions
You have your loops all messed up in this. First, you are constantly using things like
do i=1,1
....(i)
end do i
There's no point in a loop over a single value. Just write that as ....(1) (or (2) or (3) depending) without the enclosing do loop. As you have this written, you're writing over expr_wd and impr_wd for steps k=1,...,nstep-1, and being left only with the k=nstep value. You want the whole calculation to have the DO K loop on the outside.
You also missed the point on how to handle the median target. You wanted to use a VECT[SERIES] (the way virtually all the other results are handled). Instead, you "unrolled" that by using suffixes rather than subscripts:
Instead of that (repeated 8 times), you just need
dec vect mt_wd(nvar)
do i=1,nvar
set MT_wd(i) 1 nstep = ik_mt=%xt(impulses,t)*v1_mt,ik_mt(i)
end do i
do i=1,1
....(i)
end do i
There's no point in a loop over a single value. Just write that as ....(1) (or (2) or (3) depending) without the enclosing do loop. As you have this written, you're writing over expr_wd and impr_wd for steps k=1,...,nstep-1, and being left only with the k=nstep value. You want the whole calculation to have the DO K loop on the outside.
Code: Select all
do i=1,1
do k=1,nstep
set EXPR_wd = goodresp1(t)(k,i)
end do k
end do i
do i=2,2
do k=1,nstep
set IMPR_wd = goodresp1(t)(k,i)
end do k
end do i
do k=1,nstep
set TOTwd = (EXPR_wd - IMPR_wd)
compute frac_TOT=%fractiles(TOTwd,||.16,.84||)
compute lower_TOT(k)=frac_TOT(1)
compute upper_TOT(k)=frac_TOT(2)
compute median_TOT(k)=%avg(TOTwd)
end k
Code: Select all
set MT_wd1 1 nstep = 0.0
do i=1,1
set MT_wd1 1 nstep = ik_mt=%xt(impulses,t)*v1_mt,ik_mt(i)
end do i
*******************
set MT_wd2 1 nstep = 0.0
do i=2,2
set MT_wd2 1 nstep = ik_mt=%xt(impulses,t)*v1_mt,ik_mt(i)
end do i
dec vect mt_wd(nvar)
do i=1,nvar
set MT_wd(i) 1 nstep = ik_mt=%xt(impulses,t)*v1_mt,ik_mt(i)
end do i
Re: Near-VAR with sign restrictions
Thank you so much for your advice. Truly appreciate it.
Re: Near-VAR with sign restrictions
Dear Tom,
I have encountered few problems with my FEVD and HD.
1) Since this is a near-VAR model, the foreign variables are affected only by the foreign shocks. There are only three foreign variables and three foreign shocks specified by the sign restrictions in my model. Then, the FEVD of a foreign shock should add-up to 100, isn't it? But, the foreign shocks only account for about 30 per cent of the variation of a foreign variable in my model. What could be the reason? Have I made another mistake in my code?
2) In my HD graphs, I tried to plot the 3 variables - i.e. actual data, forecast data with a given shock and forecast data without any shock. But graphs for a particular shock under all three shocks looks extremely similar, which I think is soemwhat weird.
Could you please help me to figure-out where I have gone wrong.
Thanking you in advance.
I have encountered few problems with my FEVD and HD.
1) Since this is a near-VAR model, the foreign variables are affected only by the foreign shocks. There are only three foreign variables and three foreign shocks specified by the sign restrictions in my model. Then, the FEVD of a foreign shock should add-up to 100, isn't it? But, the foreign shocks only account for about 30 per cent of the variation of a foreign variable in my model. What could be the reason? Have I made another mistake in my code?
2) In my HD graphs, I tried to plot the 3 variables - i.e. actual data, forecast data with a given shock and forecast data without any shock. But graphs for a particular shock under all three shocks looks extremely similar, which I think is soemwhat weird.
Could you please help me to figure-out where I have gone wrong.
Thanking you in advance.
Last edited by Yashodha on Fri Jul 26, 2019 1:42 am, edited 1 time in total.