Am 18.01.2022 00:07 schrieb Sven Schreiber:
Hi,
I have a situation here where the "smpl ... --replace --restrict"
construct isn't working like (I, at least) expected. Sorry, I can't
give
a minimal working example yet. The context is a panel dataset and we're
inside a hansl function where the series y was passed as an argument,
but series 'unit' was created locally inside the function from the
$unit
accessor. 'donor' and 'target_group' are valid integers that are
actually present in the 'unit' series (I checked).
smpl unit == donor --restrict
matrix mydonor = {y} # no problem here, works
smpl --full # should be redundant, but isn't -- perhaps a gretl bug?
smpl unit == target_group --replace --restrict
When I leave out the "smpl --full" line, I get an error message at the
last quoted line saying "no observations would be left".
Somehow it feels as if the "--replace" option here isn't honored.
Because then the error message would make sense; since 'target_group'
is
a different unit than 'donor', putting the second restriction on top of
the first would leave an empty set. Again, inserting the smpl --full
line solves this, but it shouldn't be necessary, should it?
This is with the latest snapshot.
Hi,
I've experienced this tricky issue for about 1,5 years, too. Allin had
already fixed some corner case a while ago (discussed in a private
chat). But there are still situations where the --replace option is not
honored. This issue is tricky in so far as I was never able to replicate
it using some toy example. In my use-cases the scenario is often more
complex (nested functions, some series are passed from the outer scope
of some function while other series are compiled inside the function,
etc.).
Somehow I got adapted to it by "going the extra line" writing "smpl
full" instead of using the --replace option.
BTW: I surprised that the syntax "smpl --full" works at all as,
according to the help text, it should be "smpl full".
Best,
Artur