linefit & equation in the spool object

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

ecofin
Posts: 182
Joined: Fri May 10, 2013 11:24 am

linefit & equation in the spool object

Postby ecofin » Mon Apr 18, 2016 10:44 am

hi,
i would like to show linefit in the five graph, and store every equation and graph in the spool objects, for example the eq_y_f the fist and g_y_f the second (every eqaution with the graph corresponding) and so on
group g1 y x z f h q
for !i=1 to 1
%iname=g1.@seriesname(!i)
for !j=!i+1 to g1.@count
%jname=g1.@seriesname(!j)
'generate 5 equation
equation eq_{%iname}_{%jname}.ls {%iname} {%jname}
' create 5 graph with line and save it in the wf
graph g_{%iname}_{%jname}.scat{%linefit} {%iname} {%jname}
{%spool}.display
next
next

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: linefit & equation in the spool object

Postby EViews Gareth » Mon Apr 18, 2016 10:48 am


ecofin
Posts: 182
Joined: Fri May 10, 2013 11:24 am

Re: linefit & equation in the spool object

Postby ecofin » Mon Apr 18, 2016 10:59 am

:D
1-but the linefit doesnt appear in the graph :roll: there is a mistake
group g1 y x z f h q
for !i=1 to 1
%iname=g1.@seriesname(!i)
for !j=!i+1 to g1.@count
%jname=g1.@seriesname(!j)
'generate 5 equation
equation eq_{%iname}_{%jname}.ls {%iname} {%jname}
' create 5 graph with line and save it in the wf
graph g_{%iname}_{%jname}.scat{%linefit} {%iname} {%jname}
spool myspool
myspool.append eq_{%iname}_{%jname} g_{%iname}_{%jname}.scat{%linefit}
next
next
2- suppose that i would like the show all eqaution followed by all graph in the spool( five equation followed by 5 graph), can you guide me.

ecofin
Posts: 182
Joined: Fri May 10, 2013 11:24 am

Re: linefit & equation in the spool object

Postby ecofin » Tue Apr 19, 2016 7:42 am

i have solved my second case but how can make regression line in all graph. could you help me please.
group g1 y x z f h q
for !i=1 to 1
%iname=g1.@seriesname(!i)
for !j=!i+1 to g1.@count
%jname=g1.@seriesname(!j)
'generate 5 equation
equation eq_{%iname}_{%jname}.ls {%iname} {%jname}
' create 5 graph with line and save it in the wf
graph g_{%iname}_{%jname}.scat{%linefit} {%iname} {%jname}
spool sp
sp.insert(offset=first) eq_{%iname}_{%jname}
sp.insert g_{%iname}_{%jname}
delete g_{%iname}_{%jname}
next
next
sp.move(offset=first) untitled01
sp.move(loc=untitled02) untitled09
sp.move(loc=untitled05) untitled03
sp.move(loc=untitled09) untitled07

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: linefit & equation in the spool object

Postby EViews Gareth » Tue Apr 19, 2016 8:03 am

You'll have to explain it a bit better.

ecofin
Posts: 182
Joined: Fri May 10, 2013 11:24 am

Re: linefit & equation in the spool object

Postby ecofin » Tue Apr 19, 2016 8:34 am

i would like to make linefit with y x, y z, y q, y h, y f (y is dependent variable), the problem when i right this code the linefit doesn't appear in the all graph just the scatter.

Code: Select all

graph g_{%iname}_{%jname}.scat{%linefit} {%iname} {%jname}

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: linefit & equation in the spool object

Postby EViews Gareth » Tue Apr 19, 2016 8:37 am

What do you mean all the graph?

ecofin
Posts: 182
Joined: Fri May 10, 2013 11:24 am

Re: linefit & equation in the spool object

Postby ecofin » Tue Apr 19, 2016 8:41 am

g_y_f , g_y_x, ....
Attachments
linefit.png
linefit.png (104.44 KiB) Viewed 11041 times

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: linefit & equation in the spool object

Postby EViews Gareth » Tue Apr 19, 2016 8:48 am

I don't understand what your code is doing at all.

But the way I would do it is to make a group containing the series you want to graph, then freeze the scat view of the group so that you can include a linefit.

ecofin
Posts: 182
Joined: Fri May 10, 2013 11:24 am

Re: linefit & equation in the spool object

Postby ecofin » Tue Apr 19, 2016 8:51 am

no, when i make all in the group i get all varialbles in one graph and all linefit in one graph

Code: Select all

group g1 y x z f h q g1.scat linefit

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: linefit & equation in the spool object

Postby EViews Gareth » Tue Apr 19, 2016 8:57 am

Don't put all the variables in the group.

Code: Select all

group temp {%iname} {%jname} freeze(g_{%iname}_{%jname}) temp.scat linefit d temp

ecofin
Posts: 182
Joined: Fri May 10, 2013 11:24 am

Re: linefit & equation in the spool object

Postby ecofin » Tue Apr 19, 2016 9:56 am

i get error message G_Y_X already exists in "GRAPH G_Y_X.SCAT Y X". the workfile attached

Code: Select all

group g1 y x z f h q for !i=1 to 1 %iname=g1.@seriesname(!i) for !j=!i+1 to g1.@count %jname=g1.@seriesname(!j) 'generate 5 equation equation eq_{%iname}_{%jname}.ls {%iname} {%jname} ' create 5 graph with line and save it in the wf graph g_{%iname}_{%jname}.scat {%iname} {%jname} group temp {%iname} {%jname} freeze(g_{%iname}_{%jname}) temp.scat linefit d temp spool sp sp.insert(offset=first) eq_{%iname}_{%jname} sp.insert g_{%iname}_{%jname} delete g_{%iname}_{%jname} next next sp.move(offset=first) untitled01 sp.move(loc=untitled02) untitled09 sp.move(loc=untitled05) untitled03 sp.move(loc=untitled09) untitled07
Attachments
austot_data_10day.WF1
(17.41 KiB) Downloaded 353 times

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: linefit & equation in the spool object

Postby EViews Gareth » Tue Apr 19, 2016 10:19 am

Delete this line:

Code: Select all

graph g_{%iname}_{%jname}.scat {%iname} {%jname}

ecofin
Posts: 182
Joined: Fri May 10, 2013 11:24 am

Re: linefit & equation in the spool object

Postby ecofin » Tue Apr 19, 2016 10:31 am

thanks! for your help :D


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests