Extract coefs form different objects, double seasonal
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
Extract coefs form different objects, double seasonal
Hi,
1/I have workfile with three page with a same frequency weekly, the first page contain series (gdp, oil, gas, usd, euro), the second page contain series (rgdp, oil, gas, usd, euro), the third page contain series (rgdp2, oil, gas, usd, euro).
I have estimate some models in each different page: four equation objects in the first page , and three models in the second and third page.
in page one:
eq01_p1_w1: gdp oil gas usd euro @expand(@datepart(@date,"ww"))
eq02_p1_w2: gdp usd euro @expand(@quarter)
eq03_p1_m: gdp oil gas usd @expand(@month)
eq04_p1_q: gdp usd @expand(@quarter)
in page two:
eq01_p2_w: rgdp oil gas usd euro @expand(@datepart(@date,"ww"))
eq02_p2_m: rgdp oil gas usd euro @expand(@month)
eq03_p2_q: rgdp oil gas usd euro @expand(@quarter)
in page three:
eq01_p3_w: rgdp2 oil gas usd euro @expand(@datepart(@date,"ww"))
eq02_p3_m: rgdp2 oil gas usd euro @expand(@month)
eq03_p3_q: rgdp2 oil gas usd euro @expand(@quarter)
my question is: how can extract seasonal coefficients from different objects in the first and second and third page as a series and renamed them with the names of objects, and save seasonal coefficients series of page two in page three.
i.g page one:
series eq01_p1_w1 contain: @datepart(@date,"ww")=1, @datepart(@date,"ww")=2,...etc
series eq02_p1_w2 contain: @month=1, @month=2,...etc
2/how can generate series contained double seasonal ( weekly and monthly in the same time).
1/I have workfile with three page with a same frequency weekly, the first page contain series (gdp, oil, gas, usd, euro), the second page contain series (rgdp, oil, gas, usd, euro), the third page contain series (rgdp2, oil, gas, usd, euro).
I have estimate some models in each different page: four equation objects in the first page , and three models in the second and third page.
in page one:
eq01_p1_w1: gdp oil gas usd euro @expand(@datepart(@date,"ww"))
eq02_p1_w2: gdp usd euro @expand(@quarter)
eq03_p1_m: gdp oil gas usd @expand(@month)
eq04_p1_q: gdp usd @expand(@quarter)
in page two:
eq01_p2_w: rgdp oil gas usd euro @expand(@datepart(@date,"ww"))
eq02_p2_m: rgdp oil gas usd euro @expand(@month)
eq03_p2_q: rgdp oil gas usd euro @expand(@quarter)
in page three:
eq01_p3_w: rgdp2 oil gas usd euro @expand(@datepart(@date,"ww"))
eq02_p3_m: rgdp2 oil gas usd euro @expand(@month)
eq03_p3_q: rgdp2 oil gas usd euro @expand(@quarter)
my question is: how can extract seasonal coefficients from different objects in the first and second and third page as a series and renamed them with the names of objects, and save seasonal coefficients series of page two in page three.
i.g page one:
series eq01_p1_w1 contain: @datepart(@date,"ww")=1, @datepart(@date,"ww")=2,...etc
series eq02_p1_w2 contain: @month=1, @month=2,...etc
2/how can generate series contained double seasonal ( weekly and monthly in the same time).
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Extract coefs form different objects, double seasonal
Do not understand either question.
Follow us on Twitter @IHSEViews
Re: Extract coefs form different objects, double seasonal
clubmed wrote:Hi,
1/I have workfile with three page with a same frequency weekly, the first page contain series (gdp, oil, gas, usd, euro), the second page contain series (rgdp, oil, gas, usd, euro), the third page contain series (rgdp2, oil, gas, usd, euro).
I have estimate some models in each different page: four equation objects in the first page , and three models in the second and third page.
in page one:
eq01_p1_w1: gdp oil gas usd euro @expand(@datepart(@date,"ww"))
eq02_p1_w2: gdp usd euro @expand(@quarter)
eq03_p1_m: gdp oil gas usd @expand(@month)
eq04_p1_q: gdp usd @expand(@quarter)
in page two:
eq01_p2_w: rgdp oil gas usd euro @expand(@datepart(@date,"ww"))
eq02_p2_m: rgdp oil gas usd euro @expand(@month)
eq03_p2_q: rgdp oil gas usd euro @expand(@quarter)
in page three:
eq01_p3_w: rgdp2 oil gas usd euro @expand(@datepart(@date,"ww"))
eq02_p3_m: rgdp2 oil gas usd euro @expand(@month)
eq03_p3_q: rgdp2 oil gas usd euro @expand(@quarter)
my question is: how can extract seasonal coefficients from different objects in the first and second and third page as a series and renamed them with the names of objects, and save seasonal coefficients series of page two in page three.
i.g page one:
series eq01_p1_w1 contain: @datepart(@date,"ww")=1, @datepart(@date,"ww")=2,...etc
series eq02_p1_w2 contain: @month=1, @month=2,...etc
2/how can generate series contained double seasonal ( weekly and monthly in the same time).
1/for example page one weekly frequency: extract seasonal coefficients from equation object named "eq01_p1_w1", and rename it by name of object "eq01_p1_w1"
the series "eq01_p1_w1" contain :
1998-01-05 @datepart(@date,"ww")=1
1998-01-12 @datepart(@date,"ww")=2
1998-01-19 ......
1998-01-26
1998-02-02
.....
the series "eq01_p1_m" contain
1998-01-05 @month=1
1998-01-12 @month=1
1998-01-19 @month=1
1998-01-26 @month=1
1998-02-02 @month=2
1998-02-09 @month=2
1998-02-16 @month=2
1998-02-23 @month=2
........
the series "eq01_p1_q" contain
1998-01-05 @quarter=1
1998-01-12 @quarter=1
1998-01-19 @quarter=1
1998-01-26 @quarter=1
1998-02-02 @quarter=1
1998-02-09 @quarter=1
1998-02-16 @quarter=1
1998-02-23 @quarter=1
........
1998-04-06 @quarter=2
1998-04-13 @quarter=2
1998-04-20 @quarter=2
1998-04-27 @quarter=2
.......
How do this for all page with same frequency weekly and date, and save seasonal coefficients series of page2 two in page3 three.
in the page one named "page1": i have four eqaution object: eq01_p1_w1, eq01_p1_w2, eq01_p1_m, eq01_p1_q
in the page two named "page2": i have three eqaution object: eq01_p2_w, eq01_p2_m, eq01_p2_q
in the page three named "page3": i have three eqaution object: eq01_p3_w, eq01_p3_m, eq01_p3_q
2/ generate series contain seasonal weekly and monthly in the same time (double seasonal generate Combined Double Seasonal Univariate Time Series daily and weekly, or weekly monthly...)
- Attachments
-
- double seasonal.png (6.04 KiB) Viewed 9690 times
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Extract coefs form different objects, double seasonal
Still not clear.
Coefficients are scalars. A set of coefficients is a vector. Neither are (generally) the same size as the workfile - so how would you store them in a series?
Coefficients are scalars. A set of coefficients is a vector. Neither are (generally) the same size as the workfile - so how would you store them in a series?
Follow us on Twitter @IHSEViews
Re: Extract coefs form different objects, double seasonal
I have the same size of my workfile for all the three pages ("weekly frequency" 05/01/1998 30/12/2002) the difference in the data ok!, i have make three page to organize my data.
I need to extract dummy coefficients. (probably the function @wlookup do this)
page1:
equation object eq01_p1_w: gdp oil gas usd euro @expand(@datepart(@date,"ww")), series eq01_p1_w1 contain this:
1998-01-05 coef(5)
1998-01-12 coef(6)
1998-01-19 ......
1998-01-26
1998-02-02
......
equation object eq01_p1_q1: eq02_p1_w2: gdp usd euro @expand(@quarter), series eq02_p1_q1 contain this:
1998-01-05 coef(3)
1998-01-12 coef(3)
1998-01-19 coef(3)
1998-01-26 coef(3)
1998-02-02 coef(3)
1998-02-09 coef(3)
1998-02-16 coef(3)
1998-02-23 coef(3)
........
1998-04-06 coef(4)
1998-04-13 coef(4)
1998-04-20 coef(4)
1998-04-27 coef(4)
equation object eq04_p1_q2: gdp usd @expand(@quarter)
1998-01-05 coef(2)
1998-01-12 coef(2)
1998-01-19 coef(2)
1998-01-26 coef(2)
1998-02-02 coef(2)
1998-02-09 coef(2)
1998-02-16 coef(2)
1998-02-23 coef(2)
........
1998-04-06 coef(3)
1998-04-13 coef(3)
1998-04-20 coef(3)
1998-04-27 coef(3)
equation object eq03_p1_m: gdp oil gas usd @expand(@month), series eq02_p1_m contain this:
1998-01-05 coef(4)
1998-01-12 coef(4)
1998-01-19 coef(4)
1998-01-26 coef(4)
1998-02-02 coef(5)
1998-02-09 coef(5)
1998-02-16 coef(5)
1998-02-23 coef(5)
.....
for the page two and three i have this:
in page2:
eq01_p2_w: rgdp oil gas usd euro @expand(@datepart(@date,"ww")) extract: coef(5) coef(6)....
eq02_p2_m: rgdp oil gas usd euro @expand(@month) extract: ( coef(5) for the first month, coef(6) for the second month,...
eq03_p2_q: rgdp oil gas usd euro @expand(@quarter) extract: coef(5) for the first quarter, coef(6) for the second quarter,...
in page3:
eq01_p3_w: rgdp2 oil gas usd euro @expand(@datepart(@date,"ww")) extract: ( coef(5) coef(6)....
eq02_p3_m: rgdp2 oil gas usd euro @expand(@month) extract: coef(5) for the first month, coef(6) for the second month,...
eq03_p3_q: rgdp2 oil gas usd euro @expand(@quarter) extract: coef(5) for the first quarter, coef(6) for the second quarter,...
Finally save dummy coefficients series of page2 two in page3 three. (i would to make comparison).
2/Double seasonal, use nrnd to do this or other way. it is possible.
I need to extract dummy coefficients. (probably the function @wlookup do this)
page1:
equation object eq01_p1_w: gdp oil gas usd euro @expand(@datepart(@date,"ww")), series eq01_p1_w1 contain this:
1998-01-05 coef(5)
1998-01-12 coef(6)
1998-01-19 ......
1998-01-26
1998-02-02
......
equation object eq01_p1_q1: eq02_p1_w2: gdp usd euro @expand(@quarter), series eq02_p1_q1 contain this:
1998-01-05 coef(3)
1998-01-12 coef(3)
1998-01-19 coef(3)
1998-01-26 coef(3)
1998-02-02 coef(3)
1998-02-09 coef(3)
1998-02-16 coef(3)
1998-02-23 coef(3)
........
1998-04-06 coef(4)
1998-04-13 coef(4)
1998-04-20 coef(4)
1998-04-27 coef(4)
equation object eq04_p1_q2: gdp usd @expand(@quarter)
1998-01-05 coef(2)
1998-01-12 coef(2)
1998-01-19 coef(2)
1998-01-26 coef(2)
1998-02-02 coef(2)
1998-02-09 coef(2)
1998-02-16 coef(2)
1998-02-23 coef(2)
........
1998-04-06 coef(3)
1998-04-13 coef(3)
1998-04-20 coef(3)
1998-04-27 coef(3)
equation object eq03_p1_m: gdp oil gas usd @expand(@month), series eq02_p1_m contain this:
1998-01-05 coef(4)
1998-01-12 coef(4)
1998-01-19 coef(4)
1998-01-26 coef(4)
1998-02-02 coef(5)
1998-02-09 coef(5)
1998-02-16 coef(5)
1998-02-23 coef(5)
.....
for the page two and three i have this:
in page2:
eq01_p2_w: rgdp oil gas usd euro @expand(@datepart(@date,"ww")) extract: coef(5) coef(6)....
eq02_p2_m: rgdp oil gas usd euro @expand(@month) extract: ( coef(5) for the first month, coef(6) for the second month,...
eq03_p2_q: rgdp oil gas usd euro @expand(@quarter) extract: coef(5) for the first quarter, coef(6) for the second quarter,...
in page3:
eq01_p3_w: rgdp2 oil gas usd euro @expand(@datepart(@date,"ww")) extract: ( coef(5) coef(6)....
eq02_p3_m: rgdp2 oil gas usd euro @expand(@month) extract: coef(5) for the first month, coef(6) for the second month,...
eq03_p3_q: rgdp2 oil gas usd euro @expand(@quarter) extract: coef(5) for the first quarter, coef(6) for the second quarter,...
Finally save dummy coefficients series of page2 two in page3 three. (i would to make comparison).
2/Double seasonal, use nrnd to do this or other way. it is possible.
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Extract coefs form different objects, double seasonal
For the first part, something like:
Code: Select all
for !i=1 to 53
smpl if @datepart(@date,"ww")=!i
series eq01_p1_w1 = eq01_p1_w.@coef(4+!i)
next
smpl @all
Follow us on Twitter @IHSEViews
Re: Extract coefs form different objects, double seasonal
That's what i need exactly, but i get message error if i rename my coefs series by the name of object.
I would just to loop from my three page, and use @pagelist and @pageselect, and rename series coefs by the name of page selected "series {!j}_{page1}_w".
could you give an example about @pagelist and @pageselect, for the @wlookup no problem.
I would just to loop from my three page, and use @pagelist and @pageselect, and rename series coefs by the name of page selected "series {!j}_{page1}_w".
could you give an example about @pagelist and @pageselect, for the @wlookup no problem.
Code: Select all
%eqlist = @wlookup("*","equation")
!n = @wcount(%eqlist)
for !j=1 to !n
'extract dummy weekly coefs page 1 model 1
for !i=1 to 53
smpl if @datepart(@date,"ww")=!i
series {!j}_p1_w = {!j}_p1_w.@coef(4+!i)
next
smpl @all
.....
next
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Extract coefs form different objects, double seasonal
An example of what?
Follow us on Twitter @IHSEViews
Re: Extract coefs form different objects, double seasonal
I get error message when i renamed the part of my series coefs: 7 is not a valid index for vector-series-coefficient in "SERIES
D_{%EQ} = EQ02.@COEF(2+5)".
use @pagelist to obtain a list of all the pages, and use it to rename series coefs (i.g: series {!j}_{page1}_w = {!j}_{page1}_w.@coef(4+!i), and @pageselect to switch between them.
1/ make @pagelist (use @pagelist to obtain a list of all the pages).
2/ extract all dummy coefs from page1 and rename it like this: d_eq01_page1, d_eq02_page1, d_eq03_page1, d_eq04_page1.
3/ switch to the page2 and ( make step (2): d_eq01_page2, d_eq02_page2, d_eq03_page2). (@pageselect to switch between them).
4/ switch to the page3 ( make step (2) d_eq01_page2, d_eq02_page2, d_eq03_page2).
D_{%EQ} = EQ02.@COEF(2+5)".
Code: Select all
%eqlist = @wlookup("*","equation")
!n = @wcount(%eqlist)
for !j=1 to !n
%eq = @word(%eqlist, !j)
next
for !i=1 to 53
smpl if @datepart(@date,"ww")=!i
series d_{%eq} = {%eq}.@coef(2+!i)
next
smpl @all
for !i=1 to 4
smpl if @quarter=!i
series d_{%eq} = {%eq}.@coef(2+!i)
next
smpl @all
use @pagelist to obtain a list of all the pages, and use it to rename series coefs (i.g: series {!j}_{page1}_w = {!j}_{page1}_w.@coef(4+!i), and @pageselect to switch between them.
1/ make @pagelist (use @pagelist to obtain a list of all the pages).
2/ extract all dummy coefs from page1 and rename it like this: d_eq01_page1, d_eq02_page1, d_eq03_page1, d_eq04_page1.
3/ switch to the page2 and ( make step (2): d_eq01_page2, d_eq02_page2, d_eq03_page2). (@pageselect to switch between them).
4/ switch to the page3 ( make step (2) d_eq01_page2, d_eq02_page2, d_eq03_page2).
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Extract coefs form different objects, double seasonal
Do you have 7 coefficients?
Follow us on Twitter @IHSEViews
Re: Extract coefs form different objects, double seasonal
1/ this is my workfile "test1" about the error massage. (it is just the test about if i can rename my series by @wlookup)
2/ Here is some detail on what I'm trying to do:
I have workfile with three page (same size weekly freq "05/01/1998 30/12/2002") named like this: page1, page2, page3.
the first page contain series named like this: gdp oil gas usd euro, i have estimated 4 models
equation eq01.ls gdp oil gas usd euro @expand(@datepart(@date,"ww"))
equation eq02.ls gdp usd euro @expand(@quarter)
equation eq03.ls gdp usd @expand(@quarter)
equation eq04.ls gdp oil gas usd @expand(@month)
the second page contain series named like this: rgdp oil gas usd euro, i have estimated 3 models
equation eq01.ls rgdp oil gas usd euro @expand(@datepart(@date,"ww"))
equation eq02.ls rgdp oil gas usd euro @expand(@month)
equation eq03.ls rgdp oil gas usd euro @expand(@quarter)
the third page contain series named like this: rgdp2 oil gas usd euro, i have estimated 3 models
equation eq01.ls rgdp2 oil gas usd euro @expand(@datepart(@date,"ww"))
equation eq02.ls rgdp2 oil gas usd euro @expand(@month)
equation eq03.ls rgdp2 oil gas usd euro @expand(@quarter)
I would like to use this functions: @wlookup, @pagelist, @pageselect to perform my program. ( bellow you can see my workfile gdp_test2 and prg_gdp_test2)
use @wlookup to rename the first part of my dummy coefs. d_{eq01},...
use @pagelist to rename the second part of my dummy coefs d_eq01_page1,...
use @pageselect to switch between page
and save dummy coefficients series of page2 (d_eq01_page2, d_eq02_page2, d_eq03_page2) in page3.
3/I can not find a documentation about @pageselect function Command Ref.pdf (i have the last update)
2/ Here is some detail on what I'm trying to do:
I have workfile with three page (same size weekly freq "05/01/1998 30/12/2002") named like this: page1, page2, page3.
the first page contain series named like this: gdp oil gas usd euro, i have estimated 4 models
equation eq01.ls gdp oil gas usd euro @expand(@datepart(@date,"ww"))
equation eq02.ls gdp usd euro @expand(@quarter)
equation eq03.ls gdp usd @expand(@quarter)
equation eq04.ls gdp oil gas usd @expand(@month)
the second page contain series named like this: rgdp oil gas usd euro, i have estimated 3 models
equation eq01.ls rgdp oil gas usd euro @expand(@datepart(@date,"ww"))
equation eq02.ls rgdp oil gas usd euro @expand(@month)
equation eq03.ls rgdp oil gas usd euro @expand(@quarter)
the third page contain series named like this: rgdp2 oil gas usd euro, i have estimated 3 models
equation eq01.ls rgdp2 oil gas usd euro @expand(@datepart(@date,"ww"))
equation eq02.ls rgdp2 oil gas usd euro @expand(@month)
equation eq03.ls rgdp2 oil gas usd euro @expand(@quarter)
I would like to use this functions: @wlookup, @pagelist, @pageselect to perform my program. ( bellow you can see my workfile gdp_test2 and prg_gdp_test2)
use @wlookup to rename the first part of my dummy coefs. d_{eq01},...
use @pagelist to rename the second part of my dummy coefs d_eq01_page1,...
use @pageselect to switch between page
and save dummy coefficients series of page2 (d_eq01_page2, d_eq02_page2, d_eq03_page2) in page3.
3/I can not find a documentation about @pageselect function Command Ref.pdf (i have the last update)
- Attachments
-
- test1.WF1
- (48.46 KiB) Downloaded 240 times
-
- prg_gdp_test2.prg
- (2.58 KiB) Downloaded 253 times
-
- gdp_test2.WF1
- (76.54 KiB) Downloaded 242 times
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Extract coefs form different objects, double seasonal
There doesn't seem to be much logic behind most of the program.
Obviously it is a little much to go through it line by line, but here's some pointers...
The use of @wlookup seems excessive. It works, but given you only have 4 equations, and you know what their names are (since you just named them), it would be easier (and more human readable) to just do:
(if you really needed them in a list).
This code does nothing other than set %eq = "eq04".
Do you really want to extract the coefficients from equation eq04? If so, why not just write it as:
Use of %eq is just over complicating things without adding any benefit.
Obviously it is a little much to go through it line by line, but here's some pointers...
Code: Select all
'estimate 4 models of the page 1
equation eq01.ls gdp oil gas usd euro @expand(@datepart(@date,"ww"))
equation eq02.ls gdp usd euro @expand(@quarter)
equation eq03.ls gdp usd @expand(@quarter)
equation eq04.ls gdp oil gas usd @expand(@month)
'use @wlookup function to rename coefs dummy
%eqlist = @wlookup("*","equation")
The use of @wlookup seems excessive. It works, but given you only have 4 equations, and you know what their names are (since you just named them), it would be easier (and more human readable) to just do:
Code: Select all
%eqlist = "eq01 eq02 eq03 eq04"
(if you really needed them in a list).
Code: Select all
!n = @wcount(%eqlist)
for !j=1 to !n
%eq = @word(%eqlist, !j)
next
This code does nothing other than set %eq = "eq04".
Code: Select all
for !i=1 to 53
smpl if @datepart(@date,"ww")=!i
series d_{%eq} = {%eq}.@coef(4+!i)
next
smpl @all
Do you really want to extract the coefficients from equation eq04? If so, why not just write it as:
Code: Select all
series d_eq04 = eq04.@coef(4+!i)
Use of %eq is just over complicating things without adding any benefit.
Follow us on Twitter @IHSEViews
Re: Extract coefs form different objects, double seasonal
I totally agree, i would like to use functions @wlookup, @pagelist, @pageselect (Personal motivation ), rather than use a %eqlist, and to simplify my program by functions.
Re: Extract coefs form different objects, double seasonal
1/Could you give an example on @pagelist and @pageselect (loop), I would also prefer to use @wlookup.
2/I get error message 7 is not a valid index for vector-series-coefficient in "SERIESD_{%EQ} = EQ02.@COEF(4+3)". and the code generate just d_eq02 with two obs otherwise NAs. this is just a test of part of code
Nice Week -end
2/I get error message 7 is not a valid index for vector-series-coefficient in "SERIESD_{%EQ} = EQ02.@COEF(4+3)". and the code generate just d_eq02 with two obs otherwise NAs. this is just a test of part of code
Code: Select all
pageselect p1
equation eq01.ls gdp oil gas usd euro @expand(@datepart(@date,"ww"))
equation eq02.ls gdp usd euro @expand(@quarter)
%eqlist = "eq01 eq02"
!n = @wcount(%eqlist)
for !j=1 to !n
%eq = @word(%eqlist, !j)
next
for !i=1 to 53
smpl if @datepart(@date,"ww")=!i
series d_{%eq} = {%eq}.@coef(4+!i)
next
smpl @all
for !i=1 to 4
smpl if @quarter=!i
series d_{%eq}= {%eq}.@coef(2+!i)
next
smpl @all
Nice Week -end
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Extract coefs form different objects, double seasonal
1. An example of what?
2. Equation 2 doesn't have 7 coefficients.
2. Equation 2 doesn't have 7 coefficients.
Follow us on Twitter @IHSEViews
Who is online
Users browsing this forum: Majestic-12 [Bot] and 30 guests