Am 25.02.2022 um 17:00 schrieb Sven Schreiber:
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. (
Another option might be to simply document $system.order in the VECM
case better, and perhaps also add a new $system.levelsorder element
which would equal $system.order + 1 (in the vecm case).
Below is my current state of a hansl function which retrieves the levels
lag order from $system in the various cases. Currently we don't have
$system.order for a "system" in the narrow sense (non-var, non-vecm),
maybe we should add that as well.
thanks
sven
---
<hansl>
function scalar getorder(const bundle sys)
if sys.command == "system"
# infer the endogenous lag order from the sysA shape
order = cols(sys.A) / sys.neqns
elif sys.command == "var" || sys.command == "vecm"
if sys.command == "var"
order = sys.order
elif sys.command == "vecm"
order = sys.order + 1
# (at least up to gretl 2022a the vecm $system.order
# refers to the differences)
endif
else
funcerr "input doesn't seem to be a $system bundle"
endif
return order
end function
</hansl>