Page 1 of 1
Graphs: Adding a line in a scatter plot
Posted: Fri Sep 04, 2015 10:54 am
by RDS
I would like to add a line showing the relationship between two variables x and y in a scatter plot.
graph gra_b1.scat(n) x y
gra_b1.option linepat
gra_b1.setelem(1) lcolor(blue) lwidth(2) symbol(circle)
gra_b1.setelem(2) lcolor(blue) lwidth(2) symbol(circle)
what is the command to add the line?
Thank you.
Re: Graphs: Adding a line in a scatter plot
Posted: Fri Sep 04, 2015 10:57 am
by CharlieEVIEWS
Code: Select all
wfcreate u 100
genr x = nrnd
genr y = nrnd
group myscat x y
freeze(myscat_graph) myscat.scat linefit
Re: Graphs: Adding a line in a scatter plot
Posted: Fri Sep 04, 2015 11:04 pm
by RDS
It is useful, but it seems not flexible enough.
For example you cannot standardize variables with the option (n):
myscat.scat(n)
or you cannot add a text with the option
myscat.addtext(.2, .1, x) Relation between x and y
Re: Graphs: Adding a line in a scatter plot
Posted: Fri Sep 04, 2015 11:34 pm
by RDS
I have figure out how to add a text:
myscat.addtext(.2, .1) Relation between x and y
but not how to standardize variables with the option (n)
Once standardized the variables, is it possible to add a vertical line crossing the zero?
Best
Re: Graphs: Adding a line in a scatter plot
Posted: Sat Sep 05, 2015 2:12 am
by RDS
I also found the way to add the vertical line crossing the zero.
The questions left are:
1) automatic standardization of the variables (n)
2) rather than a linear fit, what would be the command to add a polynomial (power = 2) in the graph?
All the information for fitting regressions in graphs are note available in "Eviews 8 Command Ref.pdf"
Where are these reported?
Best
Re: Graphs: Adding a line in a scatter plot
Posted: Sat Sep 05, 2015 6:35 am
by EViews Gareth
Object Reference
Re: Graphs: Adding a line in a scatter plot
Posted: Sat Sep 05, 2015 11:33 pm
by RDS
Thanks very useful.
The last think I need to do is to add a scalar in the graph.
For example I run a regression between x and y and save the adjusted R^2 named adjr2.
I need to add the scalar adjr2 in the graph.
Note that I cannot add the number using addtext because it is a loop of many charts.
Best
Re: Graphs: Adding a line in a scatter plot
Posted: Sun Sep 06, 2015 8:02 am
by EViews Gareth
You'll have to use addtext
Re: Graphs: Adding a line in a scatter plot
Posted: Sun Sep 06, 2015 3:06 pm
by RDS
Addtext would add a text not the scalar`.
Unless you are suggesting to add the number directly in the addtext option.
Re: Graphs: Adding a line in a scatter plot
Posted: Sun Sep 06, 2015 6:33 pm
by EViews Gareth
Convert the scalar to text with the @str function.