Page 1 of 1

Bug in statsby-functions with panel data

Posted: Mon Jun 14, 2021 1:21 am
by mamo
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")

Re: Bug in statsby-functions with panel data

Posted: Mon Jun 14, 2021 10:18 am
by EViews Matt
Hello,

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.