Using functions on groups

For questions regarding programming in the EViews programming language.

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

pdwhoward
Posts: 11
Joined: Tue Oct 23, 2012 2:44 pm

Using functions on groups

Postby pdwhoward » Sat Feb 06, 2016 3:27 pm

I have a group and I would like to calculate statistics for the series in the group. So for example

Code: Select all

group group_return rm

defines the group group_return and contains the series rm. In Eveiws, I can execute

Code: Select all

@mean(rm)

but I cannot execute

Code: Select all

@mean(group_return(1))

Although, I can do

Code: Select all

ls group_return(1) c

in place of

Code: Select all

ls rm c

So I would like to know why I cannot use / how do I use function commands like @mean() on series in a group. I.e. I would like to use commands like

Code: Select all

@mean(group_return(1))


Thanks for the help.

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

Re: Using functions on groups

Postby EViews Gareth » Sat Feb 06, 2016 4:11 pm

Code: Select all

show @mean(group_return(1))
Follow us on Twitter @IHSEViews

pdwhoward
Posts: 11
Joined: Tue Oct 23, 2012 2:44 pm

Re: Using functions on groups

Postby pdwhoward » Sun Feb 07, 2016 10:45 am

That's great, thank you. How would I store the value. For example, I can issue the command

Code: Select all

scalar t = @mean(rm)

but the following command does not

Code: Select all

scalar t = @mean(group_return(1))

dagfinnrime
Posts: 49
Joined: Sat Oct 11, 2008 9:37 am
Location: Oslo
Contact:

Re: Using functions on groups

Postby dagfinnrime » Tue Sep 20, 2016 1:07 am

Hi,

I too would like to use functions on groups. (User request!!!).

The way I fix it now is the following:

Code: Select all

for !i = 1 to gr_data.@count
      %varname = gr_data.@seriesname(!i)
      tab_descstats(1,!c) = %varname
      !mret = (1+@mean({%varname}))^12-1
      !sdret = @stdev({%varname})
      tab_descstats(2,!c) = !mret            ' Return
      tab_descstats(3,!c) = !sdret            ' Std.Dev
      tab_descstats(4,!c) = !mret/!sdret         ' SR
      !c = !c+1
next


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 45 guests