On Sun, 6 Dec 2015, Sven Schreiber wrote:
Am 06.12.2015 um 03:42 schrieb Allin Cottrell:
> On Fri, 4 Dec 2015, Sven Schreiber wrote:
>
>> as you will notice, I am currently working on a real-life panel dataset,
>> and so here's another panel problem, with example; the following doesn't
>> work for me ("no obs would be left"):
>>
>> <hansl>
>> open abdata.gdt
>> smpl IND == 3 --restrict # leaves 89 obs
>> smpl unit == min(unit) --restrict # lowest unit value of the 89 obs is 6
>> </hansl>
>>
>> My guess is that gretl evaluates min(unit) not as the lowest in-sample
>> value (after applying the first restriction), but instead looks for the
>> global minimum (which is 1). Then the two restrictions cannot hold
>> simultaneously.
>
> That's right. This is required if
>
> smpl <whatever> --restrict --replace
>
> is going to work.
Yes, but I did not have the --replace option in there !? The guide (in
section 5.3) says that "the second restriction augments the first".
Admittedly that does not pin down exactly the scope of the second
restriction, but I find this very surprising.
To put it differently, the expression "min(unit)" is currently evaluated
differently in identical circumstances (with respect to the active
sample and the contents of the series), if you compare my example with
your solution.
>
>> But I think that all gretl functions that take a series argument always
>> work on the currently defined sample, right? If so, then this looks like
>> a bug.
>
> I wouldn't say so.
?? Is this a "no" to the first sentence or just to the second?
I've changed my mind on this: I think that what you pointed out is a
bug, and it's now fixed in git and snapshots. Without the --replace
option, the "mask" for sub-sampling should be computed based on the
current sample, ignoring any out-of-range observations.
As for whether _all_ our functions respect the sample range, I'm not
certain. That's the general rule OK, but I'll have to take an
inventory and check there aren't any exceptions -- or (possibly) if
there are any exceptions where a good case can be made for special
behavior, ensure that this is clearly documented.
Allin