Page 1 of 1

Syntax to set common axis scales in a graph

Posted: Thu May 26, 2011 8:10 pm
by Kavorka
I am using the command "scatplot" to make many scatterplots between different y and x. I have also included a regression line (by "linefit") in the scatter plots so that I can compare the slopes of the relationships. The problem is that the slopes of the regression lines cannot be compared between different scatter graphs since the axes are different for every scatter plot.
How do I change the startpoints of the scatter-plot axes to e.g. (xmin,ymin)=(0,0) and the maximal endpoints of the scatter graph set to (xmax,ymax)=(5,6).

for %j 1 2 3 5 10
group scat{%j} x{%j}(-{!lags}) y{%j}
freeze(scat{%j}) scat{%j}.scatpair linefit
next

I know how to change the axis scales (min, max) by clicking on the scatter graph with the mouse, but I am asking for a syntax to change the code above.

A secondary alternative solution (the first one does not work) to solve the problem would be to run a regression ls y{%j} c x{%j} and save the slope coefficient c(2) and automatically have that one inserted automatically into the scatter plot. Would that be possible? E.g. R2 may also be interesting to copy into the graph. I can of course do this separately and save it in a vector, but then it is hard to compare the relationships (and also look at the plot in a separate view), I want everything on the same picture.

However, the easiest way is probably just to change the axes' scales.

Best wishes,
Pelle

Re: Syntax to set common axis scales in a graph

Posted: Fri May 27, 2011 7:48 am
by EViews Gareth
The axis command contains options for changing the axis range. For example:

Code: Select all

gr.axis(l) range(0,10)
Will set the left hand axis on the graph GR to only be between the values of 0 and 10.

Re: Syntax to set common axis scales in a graph

Posted: Fri May 27, 2011 7:15 pm
by Kavorka
Thanks that works well!

One more thing, I would also like to force the regression line in the scatter plot through origo (regression without an intercept). Is that possible using the syntax in scatpair (where the default setting is with an intercept)?

freeze(scatTN{%j}F) scatTN{%j}.scatpair linefit

(This may sound like an odd request, but in my specific case it is definitely relevant with regession lines through origo) /Pelle

Re: Syntax to set common axis scales in a graph

Posted: Tue May 31, 2011 11:19 am
by EViews Glenn
Unfortunately, not using the built-in tool...