Page 1 of 1

Question on Linear Plott

Posted: Wed Apr 27, 2016 8:23 pm
by cyang40
Dear Tom,

Is there a way to restrict the axes of a linear plot without distorting the linear lines? As you can see in the attachment (linear_plot_2.jpg), when I restrict the vertical axis (vmin=0), the output is not the same as I expected. Ideally, I would like to focus on the positive section of the vertical axis. The code is provided below. Thank you very much.

Code: Select all

panel(entry=0, indiv=1, time=0) open_ca / finan_i

preg(title="OLS w. Country and Time FE",effects=both,method=fixed) growth 1//1971:1 51//2011:1
# govt opentg openfg openg
set m_fe_t20 1//1971:1 51//2011:1 = %beta(1)+%beta(2)*0.2+%beta(3)*finan_i+%beta(4)*0.2*finan_i
set m_fe_t40 1//1971:1 51//2011:1 = %beta(1)+%beta(2)*0.4+%beta(3)*finan_i+%beta(4)*0.4*finan_i
set m_fe_t80 1//1971:1 51//2011:1 = %beta(1)+%beta(2)*0.8+%beta(3)*finan_i+%beta(4)*0.8*finan_i
set m_fe_t120 1//1971:1 51//2011:1 = %beta(1)+%beta(2)*1.2+%beta(3)*finan_i+%beta(4)*1.2*finan_i

set fopen = finan_i*100

*Unrestricting the boundary (for graph please see attachment 1)

scatter(style=lines,header="Financial Openness and Fiscal Multiplier",$
klabel=||"TOPEN=20%","TOPEN=40%","TOPEN=80%","TOPEN=120%"||,key=below,$
hlabel="Financial Openness (%)",vlabel="Multiplier") 4
# fopen m_fe_t20
# fopen m_fe_t40
# fopen m_fe_t80
# fopen m_fe_t120

*Restricting the boundary (for graph please see attachment 2)

scatter(style=lines,header="Financial Openness and Fiscal Multiplier",$
klabel=||"TOPEN=20%","TOPEN=40%","TOPEN=80%","TOPEN=120%"||,key=below,vmin=0,$
hlabel="Financial Openness (%)",vlabel="Multiplier") 4
# fopen m_fe_t20
# fopen m_fe_t40
# fopen m_fe_t80
# fopen m_fe_t120
Sincerely,

Michael Yang

Re: Question on Linear Plott

Posted: Wed Apr 27, 2016 10:00 pm
by TomDoan
The problem is that you're doing that by STYLE=LINES with an unsorted "X" value. Your second graph actually is a huge number of line segments back and forth---you can only barely detect that because they all line up.

Since the data aren't actually important, you should just create your own "X' series which has the run of values that you want for the x-axis (use @GRIDSERIES) and compute the lines using that instead of finan_i.

Re: Question on Linear Plott

Posted: Wed Apr 27, 2016 11:40 pm
by cyang40
Thank you for the advice, Tom.