On Tue, 6 Oct 2020, Riccardo (Jack) Lucchetti wrote:
On Tue, 6 Oct 2020, Allin Cottrell wrote:
>>>
>>>> ### compute the reduced form VAR representation
>>>>
>>>> matrix A = $sysGamma\$sysA
>>>> matrix b = $sysGamma\$sysB
>>>
>>> This is super elegant and concise - is it also correct (combined with
>>> varsimul below)? I dimly remember that there was an issue with the
>>> ordering of the regressors that might be different from what varsimul
>>> expects.
>>
>> Oh, I wans't aware of that. Care to elaborate?
>
> I think Sven's point concerned (a) lagged terms arranged by variable vs (b)
> lagged terms arranged by lag.
I just checked. It seems to be ok: $sysA returns the uppermost block of the
companion matrix, which is what varsimul wants. I'll add the script (with
some brief explanatory text) at the end of doc/tex/system.tex.
OK, nice!
I might just add, I ran a comparison with "fcast", for the case
where no simulated disturbances are thrown in. My script picks up
from after
# perform simulation
Sim = varsimul(A, X + E, init)
in Jack's at the top of this thread:
https://www.mail-archive.com/gretl-devel@gretlml.univpm.it/msg10883.html
<hansl>
# simulate without any disturbances
Sim2 = varsimul(A, X, init)
print Sim2
ft1 = $nobs - 1
dataset addobs 12
ft2 = $tmax
printf "fcast %d %d\n", ft1, ft2
fcast ft1 ft2 --quiet
F1 = $fcast
print F1
print "fcast --out-of-sample"
fcast --out-of-sample --quiet
F2 = $fcast
print F2
</hansl>
The first use of fcast does not exactly reproduce Sim2; that's
because the two leading rows are static forecasts rather than actual
observed values. It seemed to me that fcast with the --out-of-sample
option ought to reproduce Sim2 exactly, but in fact it failed
("missing data": it wasn't reaching far enough back for pre-sample
values). That's now fixed in git: F2 is identical to the last 12
rows of Sim2.
Allin