Am 24.02.2022 um 16:57 schrieb Sven Schreiber:
vecm 2 1 LRM LRY -q # again, printout says "lag order 2"
eval $system.order # gives 1
</hansl>
Of course all this is just a matter of convention, but since "vecm"
expects the lag order parameter as referring to the levels (thus the
same as the corresponding VAR), and the printout also refers to that
levels order, I tend to view this as a bug. Right?
OK, so in lib/src/var.c in the johansen_wrapper function we have the
root cause:
jvar = gretl_VAR_new(code, order - 1, rank, lags, list, dset, ...
However, that difference-order convention for VECMs is used in so many
subsequent and other places that we cannot simply change that there.
Note that this leads to funny re-incrementing hoops like the call to
johansen_wrapper inside real_gretl_restricted_vecm where the lag order
is specified as orig->order + 1.
At the same time, in lots of places in the code there are constructs
like calling effective_order or "int k = var->order + (var->ci ==
VECM);" to map the whole thing back to the levels convention. What's
more, in build_VAR_from_bundle the var->order is taken as-is from the
bundle, irrespective of whether it's a VECM or a VAR.
So, basically it seems that gretl uses the difference-order convention
for a VECM _internally_, but _externally_ we have the levels-order
convention. The problem is that "$system.order" exists both in the
internal and external spheres: internal because of how hansl's irf() and
fevd() functions are currently set up, and external for users like me
who want to work with the $system output.
How can we solve that? Not entirely sure, but perhaps we could change
the backends of irf() and fevd(), namely gretl_FEVD_from_bundle and
gretl_IRF_from_bundle to differentiate between a VAR and a VECM
appropriately, and then we could make $system.order adhere to the
external levels-order convention. (You couldn't transfer the produced
$system bundles across gretl versions, but that's not a showstopper
IMHO, because who does that anyway.)
What do you think?
thanks
sven