Bug in statsby-functions with panel data

For notifying us of what you believe are bugs or errors in EViews.
Please ensure your copy of EViews is up-to-date before posting.

Moderators: EViews Gareth, EViews Moderator

Posts: 173
Joined: Wed Nov 07, 2012 9:11 am

Bug in statsby-functions with panel data

Postby mamo » Mon Jun 14, 2021 1:21 am

Dear Eviews team,

I use Eviews 12 March 22 2021 build.

I am wondering about the behaviour of @sumsby in the example code below. I would expect that the optional sample literal in by-group statistics (like @sumsby @meansby, etc,) makes the statistics being computed using the sample literal rather than the pre-selected page sample but it doesn't seem to be the case with panel data.

This behavior can certainly be circumvented by correspondingly preselecting the page sample. Nevertheless, it is a source of unexpected, potentially misleading results and can be considered a bug in view of the documention of the statsby function which says: "By default, EViews will use the workfile sample when computing the descriptive statistics. You may provide the optional sample s as a literal (quoted) sample expression or a named sample."

Best, mamo

Code: Select all

wfcreate a 2001 2010 2
series x=(@trend+1)*10^(crossid-1)
smpl 2001 2001 if crossid=1
' The following line shows "9  1 1" while the expected result should be "9  99 9"
show @sumsby(x, crossid, "2009 2009")  @sumsby(x,"2009 2009")   @sumsby(x,"2009 2009 if crossid=1")

EViews Matt
EViews Developer
Posts: 496
Joined: Thu Apr 25, 2013 7:48 pm

Re: Bug in statsby-functions with panel data

Postby EViews Matt » Mon Jun 14, 2021 10:18 am


The various statsby functions require at least two series arguments before you may optionally specify a sample. A call such as @sumsby(x,"2009 2009") interprets the second argument as a constant alpha autoseries, not as a sample. If you insert a trivial constant autoseries as the second argument into your example, e.g., show @sumsby(x, crossid, "2009 2009") @sumsby(x, 1, "2009 2009") @sumsby(x, 1, "2009 2009 if crossid=1"), then you'll achieve the results you expect.

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 4 guests