How to make impulse response lines an area

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator

tony
Posts: 59
Joined: Wed Jan 07, 2009 7:59 am

How to make impulse response lines an area

Postby tony » Tue Aug 25, 2020 1:47 am

Hi there,
I did a VAR model and obtained the IRF lines, and I want to make a confidence area and an estimated line.
How to do that?
Thanks.

EViews Matt
EViews Developer
Posts: 560
Joined: Thu Apr 25, 2013 7:48 pm

Re: How to make impulse response lines an area

Postby EViews Matt » Tue Aug 25, 2020 10:46 am

Hello,

Is the issue that the confidence lines are not being shown or that you want the area between the confidence lines to be filled?

tony
Posts: 59
Joined: Wed Jan 07, 2009 7:59 am

Re: How to make impulse response lines an area

Postby tony » Tue Aug 25, 2020 7:33 pm

EViews Matt wrote:Hello,

Is the issue that the confidence lines are not being shown or that you want the area between the confidence lines to be filled?


Yes, I want the area between the confidence lines to be filled.

EViews Matt
EViews Developer
Posts: 560
Joined: Thu Apr 25, 2013 7:48 pm

Re: How to make impulse response lines an area

Postby EViews Matt » Wed Aug 26, 2020 4:04 pm

Unfortunately, I'm not aware of a simple way to accomplish what you want. I've reworked an old example of mine to show how you could create a graph with a filled area band for the confidence interval. This example is probably overkill, but it demonstrates the core task of creating a mixed type graph. The mixed graph then includes, at least, a band area element for the confidence interval and a line element for the response proper.

Code: Select all

' Generate example data
create u 100
series x = rnd
series y = nrnd
series z = nrnd
var v.ls 1 2 x y z

' Generate impulse data
v.impulse(20,m,se=a,matbyr=irf_data)

' Create individual graphs for each IRF
for !i = 1 to irf_data.@cols
   vector irf = @columnextract(irf_data, !i)
   vector se = @columnextract(irf_data_se, !i)
   matrix m = @hcat(@hcat(@hcat(irf - se, irf + se), @hcat(irf - se, irf + se)), irf)
   freeze(gr!i) m.mixed band(1, 2) line(3, 4, 5)
   gr!i.setelem(1) fillcolor(@rgb(238,196,162))
   gr!i.setelem(1) linecolor(@rgb(218, 124, 48)) linepattern(2)
   gr!i.setelem(2) linecolor(@rgb(218, 124, 48)) linepattern(2)
   gr!i.setelem(3) linecolor(@rgb(57, 106, 177)) linepattern(1)
   gr!i.options linepat
   gr!i.legend -display
next

' Alter vertical axes so that each variable uses the same scale.
for !i = 1 to irf_data.@cols step v.@neqn
   !min = gr!i.@axismin("l")
   !max = gr!i.@axismax("l")
   for !j = !i + 1 to !i + v.@neqn - 1
      if gr!j.@axismin("l") < !min then
         !min = gr!j.@axismin("l")
      endif
      if gr!j.@axismax("l") > !max then
         !max = gr!j.@axismax("l")
      endif
   next
   for !j = !i to !i + v.@neqn - 1
      gr!j.axis("l") range(!min, !max)
   next
next

' Combine all individual graphs and display.
%all_graphs = @wlookup("gr*")
graph gr.merge {%all_graphs}
show gr

' Cleanup.
delete irf* se m gr?*


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 17 guests