On Thu, 23 May 2013, Riccardo (Jack) Lucchetti wrote:
On Tue, 7 May 2013, Allin Cottrell wrote:
> 2) We provide a built-in function (or maybe eventually a
> command) that produces a plot from such a bundle: it checks
> for the creator of the bundle and hands off to the appropriate
> specialized plotting function.
>
> Right now this is (partially) implemented for the irf()
> function. Until now this function has returned a matrix, but
> in CVS it returns a bundle which contains the matrix along
> with the additional info needed for the plot (e.g. the names
> of the target and shock variables and the "alpha" for the
> confidence interval, if any).
>
> Isn't this backward incompatible? Actually, no. You can still
> assign from the irf() function to a matrix. [...]
This is all very clever and has so much potential that I'm beginning to think
that we should document this (and its generalisations like corrgm) in a
separate chapter of the manual about bundles and what they can do for you.
However, there is an element of backward incompatibility which, I'm afraid,
will be difficult to get rid of completely: suppose you do something like
<hansl>
list X = <whatever>
var 2 X
matrix Selected_IRFS = {}
loop foreach i 2 4 5
Selected_IRFS ~= irf(3,i)
end loop
</hansl>
now you get an error, because you can't concatenate a matrix to a bundle.
Jack, could you give a complete example that fails? That sort
of thing is supposed to work, and the following works OK here:
<hansl>
open data9-7
list X = QNC PRIME UNEMP INCOME PRICE
var 2 X
matrix Selected_IRFS = {}
loop foreach i 2 4 5
Selected_IRFS ~= irf(3,i)
endloop
print Selected_IRFS
</hansl>
The idea is that if we find a matrix on the left and a bundle
on the right, we check if the bundle has a "matrix payload"
and if so we substitute it for the bundle -- for both straight
assignment and also modified assignment such as "~=".
Allin