Am 23.10.2024 um 10:45 schrieb Artur T.:
Am 23.10.24 um 08:22 schrieb Riccardo (Jack) Lucchetti:
>
> It's already in, Timmy, and has been for some time. All you have to
> do is write a function with the restriction you want to test. For
> example:
>
> <hansl>
> open data4-1.gdt
> ols price const sqft bedrms baths
>
> function scalar my_restr(matrix b)
> ret = b[4] - b[2]*b[3]
> return ret
> end function
>
> restrict
> rfunc = my_restr
> end restrict
> </hansl>
Nice, I've also added it here:
Yes, it's a nice example, even though very close to the documentation
for the "restrict" command. (Actually, I'm noticing that in the user
guide most of the explanations of restrictions are in the VECM context.
There doesn't seem to be any cross-ref to the command reference about
the restrict command or block in the rest of the guide.)
But: to be honest, the current interface is a bit lame. The only actual
information that the user is supplying is the formula "b[4] -
b[2]*b[3]". Everything else is boilerplate hansl code --with very
specific requirements-- that we demand from the user because it could be
said that the interface isn't really complete.
It would be nice if we could just write something like "b[baths] -
b[sqft]*b[bedrms]" (or maybe add "= 0" if you want), and be done. Then
this could also be done in a semi-GUI way, where users can write this
formula in a simple one-liner text field.
And this is of course a similar idea to what's already in Oleh
Komashko's package waldTest, which I had mentioned the last time this
question came up. Here's the analogous example:
<hansl>
include waldTest.gfn # contributed package by Oleh Komashko
open data4-1.gdt
ols price const sqft bedrms baths
bundle mymod = $model
string restr = "b[4] - b[2]*b[3]"
nlwaldtestm(restr, &mymod)
</hansl>
Additional detail comments: Here the F-form of the test is done, as
apposed to the Chi2 form in Jack's example. So the p-values are slightly
different. Secondly, I believe there's no real reason why the
nlwaldtestm() function requires the model bundle in pointer form, but
that's the current state of affairs. Otherwise the explicit copy of
$model to 'mymod' could be omitted, I guess, and $model could be stuck
directly into nlwaldtestm.
cheers
sven