Am 23.05.2008 22:44, Allin Cottrell schrieb:
On Fri, 23 May 2008, Sven Schreiber wrote:
> However, another new problem just appeared...
> matrix hausmanresult = $hausman
> pvalue X hausmanresult[1,2]-1 hausmanresult[1,1]
> -- and this now gives an "invalid argument" error (it didn't in
Oof, this is to do with a change I introduced at Stefano's
behest: not "casting" 1x1 matrix results to scalars automatically.
I'll have to think about that some more.
first, one thing I don't understand here: the second term
(hausmanresult[1,1]) doesn't seem problematic (see the workaround I
mentioned, where it is unchanged). But that would mean it is treated as
a scalar, no? Then why does the first term (hausmanresult[1,2]) give
secondly, I think there are two different issues involved here:
1) The first one is what data type is returned by a function (built-in
2) The second issue is what happens if you pick elements from a matrix,
as in the above example.
From my experience with earlier discussions about those issues on the
numpy (numerical python) mailing list, these issues can and should be
With respect to the first issue, I have some sympathy with Stefano's
view that the returned datatype should not depend on the specific matrix
dimension in particular cases.
As for the second issue, I would say that explicitly indexing a single
scalar element from a matrix --as in the above example-- should return a
scalar. However, that would *not* mean that each indexing range which
refers to a 1x1 submatrix should be returned as a scalar. For example,
let's say somebody picks the first row of a matrix mymat by using
mymat[1,] in an expression. In general the first row would not be just a
single element, and as such mymat[1,] should always be a matrix, even if
it turns out to be just a 1x1 matrix.
[and now continuing a different topic:]
> BTW, on various occasions I noticed that arithmetic expressions
> cannot always be used in place of simple variables. But
> sometimes it does seem to work. Is there some rule when it
> should work, or is it sheer luck when it does?
In general, arbitrary arithmetic should work for arguments to
built-in functions (or user-defined functions for that matter),
while it's not very likely to work for arguments to straight
In principle I think I understand, but I'm not sure the demarcation
between commands and functions is very clear in gretl. What would that
'pvalue' thing be for example?