On Tue, 29 Jun 2010, Sven Schreiber wrote:
Am 29.06.2010 16:02, schrieb Allin Cottrell:
>> smpl 1961 1980 # not sure if this works here [...]
>
> Sven's idea is fine, but that last "smpl" line will work only for
> time-series data. Let's suppose you have a variable called "year"
> in your data set which identifies the year. (If you don't already,
> you can easily construct one, e.g. "year = time + 1960").
Actually as a goal (2.0-ish?) I think it would be nice if sample
restrictions worked better with panel data. For example, something like:
smpl 1960 1980 --idtime=year
would ideally leave the cross-sectional dimension alone and restrict the
time dimension as was intended above.
Or alternatively/equivalently:
setobs unitcount year --panel-vars
smpl 1960 1980 --time-dim
This idea looks quite attractive at first, but I'm afraid it gets
confusing fast. The trouble is that we have two modes of setting
the sample, which behave somewhat differently and have different
support behind the scenes: (a) just shifting the end-points; and
(b) carving a chunk out of the full dataset on some criterion, and
making the chunk the current dataset for the time being.
In a panel dataset in the form of stacked time-series (which is
the representation gretl uses) you can sample in mode (a) by
choosing a contiguous subset of individuals or units, but sampling
by time period necessarily involves mode (b): we have to carve the
dataset up; it's a --restrict operation. The syntax you're
suggesting in effect "dresses up" a --restrict as if it were a
simple moving of end points. But we can't make this sort of
sampling behave in that way and I suspect it will end in tears.
Allin Cottrell