On Mon, 12 Dec 2011, Riccardo (Jack) Lucchetti wrote:
On Mon, 12 Dec 2011, Sven Schreiber wrote:
> Hi,
>
> this time I have a working example insofar as the following script
> crashes gretl (recent cvs) for me: [...]
Some groundwork that maybe the chief may find useful:
1) The following slightly simplified script exposes the problem too:
<hansl>
open denmark
dataset addobs 4
# script operates on denmark with obs added until 1988:3
list lhs = IBO IDE# LRM LRY
series rhs = LRM
list allrhs = null
loop foreach i lhs
list rhs_$i = rhs(-1) # trivial example
if i=1
list allrhs = rhs_$i
else
list allrhs = allrhs ; rhs_$i
endif
endloop
system method=SUR
equations lhs allrhs
end system
fcast 1987:4 1988:3
</hansl>
2) The problem seems to be tied to the fact that sys_add_fcast_variance() is
called at line 3777 in lib/src/system.c at a point when the matrix sys->A is
NULL.
Good detective work! Yes, the problem is that sys->A (the
matrix of cofficients on lagged left-hand side variables)
was NULL. There's now a fix in CVS so that we don't attempt
sys_add_fcast_variance() out-of-sample if this matrix is not
present.
Next question: why is sys->A not present? The trouble is that
gretl is not finding any lagged dependent variable in the
system, and the reason is that on the left we have series
named IBO, IDE, LRM, and LRY while on the right we have a
series named rhs_1, the first lag of a series named rhs. This
happens to have originated as a copy of LRM, but that fact is
not immediately apparent to gretl.
Here's a modified version of Sven's script that works with
current CVS. It requires passing the right-hand side variable
in a list, not as a plain series argument, so that gretl can
figure out its provenance.
<hansl>
function void mycheck(list lhs, list rhs)
list allrhs = null
loop foreach i lhs -q
list rhs_$i = lags(1, rhs) # trivial example
if i=1
list allrhs = const rhs_$i
else
list allrhs = allrhs ; const rhs_$i
endif
endloop
system method=SUR
equations lhs allrhs
end system
fcast 1987:4 1988:3
end function
open denmark
dataset addobs 4
list lhs = IBO IDE LRM LRY
list rhs = LRM
smpl 1974:1 1987:3
mycheck(lhs,rhs)
</hansl>
Allin