Am 18.07.2011 22:00, schrieb Allin Cottrell:
I'm thinking it might be good to revise the functions
firstobs() and lastobs() so they restrict their checks for
non-missing values to the current sample range (right now they
scan the entire dataset).
This would be backward incompatible, but I'd be surprised if
it would cause much trouble. Although it's so stated in the
manual, I think it's unintuitive for function writers that
firstobs() and lastobs() can give you observation indices that
are outside of the sample passed by the caller, and therefore
inaccessible.
Any support/objections?
Sounds reasonable, although in that area there may be subtleties, so I'm
not 100% sure I understand the implications.
Also, in combination with the "reachback" to pre-sample values that we
discussed earlier, couldn't there be some undesired side effect? Say the
subsample starts at obs 5, and you have two lags, so gretl would
normally include obs 3 and 4. But imagine obs 3 is missing. If the
function author asks firstobs(), currently she would get obs 4 as the
answer (right?). In the future, the answer would be obs 5, if I
understand correctly. The author would not be able to handle the
missings in the pre-sample values. (Or at least it would be more difficult.)
I'm not saying the change of firstobs() is bad, rather to me this looks
like a further indication that the pre-sample reachback behavior may be
problematic.
cheers,
sven