On Tue, 30 May 2017, Sven Schreiber wrote:
Hi,
in the changelog of 2017b I read:
"Fix bug: ensure that the $model accessor (bundle) is
available to function packages that attach to a model window"
And indeed I have a function here (to be packaged) that takes a $model-style
bundle as an argument. How do I have to specify the function signature or
argument so that it is actually the $model bundle that is automatically
handed over to the package?
I looked briefly in the package guide, but couldn't find an answer (I think).
Yep, it's not in the package guide yet. But it's straightforward: in
your GUI interface function, just grab hold of $model and pass it to
the function that actually does the business. I have an example that I
was planning to share in the "code sprint" -- here's its "GUI
main":
function bundle GUI_exogtest (int xvar[$mylist] "regressor to test")
matrix ds = exogtest($model, deflist(xvar))
return defbundle("test", ds[1], "df", ds[2], "pvalue",
ds[3])
end function
Besides illustrating use of $model there's a second novelty here: the
int "xvar" argument has a default value of "$mylist". This requires
that the gfn spec designates a "list-maker" function, as in
list-maker = exogtest_listmaker
Then the list-maker function will be invoked automatically to populate
a drop-down selector showing names of series, and the value received
for "xvar" will be the ID number of the series selected by the user.
I might as well attach the whole script for this forthcoming package
so you can get the context. It implements the "diff in Sargan" test
for exogeneity of a particular term in a TSLS model.
Allin