Allin,
One case that I can think of where your proposal would make sense is in the handling of
lags. In your example, if I set the sample range to 90:1-05:4 and then call a function
that estimates a VAR(4), I think I'd want the function to be able to access the
89:1-89:4 observations, rather than estimating from 91:1. There may be more efficient ways
to handle this situation, but this is the behavior that I'd expect.
PS
-----Original Message-----
From: gretl-devel-bounces(a)lists.wfu.edu [mailto:gretl-devel-bounces@lists.wfu.edu] On
Behalf Of Allin Cottrell
Sent: Thursday, January 20, 2011 9:15 AM
To: Gretl development
Subject: [Gretl-devel] user-defined functions and smpl
As you probably know, we've emphasized the principle of
"encapsulation" for user-functions in gretl. One aspect of this is
that if the dataset is sub-sampled (non-contiguous observations
have been selected on some boolean criterion) on entry to a
function, you can't "un-subsample" inside the function (i.e. "smpl
full" will not give you the entire dataset as it exists at caller
level). This seems to me appropriate and I don't propose changing
it.
But we've also applied this principle to "regular" smpl setting,
where you just shift the end-points of the sample. To explain:
suppose we have a quarterly dataset that runs from 1980:1 to
2010:4. And suppose that on entry to a function the sample range
has been set by the caller to 1990:1 - 2005:4. Then inside the
function, although you can use smpl to adjust the end-points you
cannot shift them outside of the range set at the caller level.
E.g. in this case you couldn't get access to data before 1990 or
after 2005.
I'm now wondering if that is perhaps too restrictive. Bear in mind
that whatever sample is in force when a function is called will
always be restored when the function exits (again, something I do
not propose changing).
Any thoughts on this? Does it seem OK to let a function extend the
incoming sample range, provided it's then reset on exit? I think
this would make it easier to write certain kinds of potentially
useful functions.
Allin
_______________________________________________
Gretl-devel mailing list
Gretl-devel(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-devel