Programming a group that is observation dependent?

For questions regarding programming in the EViews programming language.

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

miorinnovo
Posts: 199
Joined: Sun Mar 01, 2015 5:01 pm

Programming a group that is observation dependent?

Postby miorinnovo » Fri Jul 02, 2021 3:57 pm

Is it possible to create a group that is dependent on certain characteristics of the time series? For example, say I have 100 series, but I just want to take the 10 series with the highest value in the observation of its time series.

Thanks!

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

Re: Programming a group that is observation dependent?

Postby EViews Gareth » Fri Jul 02, 2021 9:11 pm

Not really.

For some statistics, you could put the 100 into a group then reorder that group (using group.reorder - documentation isn't available, but if you open the group, then click on View->Group Members, then hit the order button, you can see the command capture) by some statistic, then take the first 10 members of the reordered group and put them in a new group.
Follow us on Twitter @IHSEViews

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

Re: Programming a group that is observation dependent?

Postby EViews Gareth » Fri Jul 02, 2021 9:22 pm

Code: Select all

create u 100
for !i=1 to 100
   series x!i=nrnd
next

group g x*

g.reorder @mean

group bestmeans
for !i=1 to 10
   bestmeans.add g(!i)
next
Follow us on Twitter @IHSEViews

miorinnovo
Posts: 199
Joined: Sun Mar 01, 2015 5:01 pm

Re: Programming a group that is observation dependent?

Postby miorinnovo » Tue Jul 06, 2021 6:00 am

thanks for the work around suggestion. In eviews 11 Im getting this error: REORDER is not a valid view for G in "G.REORDER @MEAN"
on line 8.

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

Re: Programming a group that is observation dependent?

Postby EViews Gareth » Tue Jul 06, 2021 8:40 am

It was added in ev12
Follow us on Twitter @IHSEViews

miorinnovo
Posts: 199
Joined: Sun Mar 01, 2015 5:01 pm

Re: Programming a group that is observation dependent?

Postby miorinnovo » Wed Jul 07, 2021 6:52 am

Thanks Gareth! I upgraded and it works!

Do you know if I could do something similar but instead of the mean I order by say the value for January 2020?

Edit: Sorry you said we cant do this, but we can order by the last observation... so I can use that and changing the sample. thanks!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 23 guests