[Gretl-users] vertical matrix concatenation (was matrix declaration error)

Allin Cottrell cottrell at wfu.edu
Wed Jan 31 09:52:48 EST 2007


>> The main problem I see is identifying a "matrix-generating 
>> expression" for the purpose of interpreting "|".  My notion is 
>> that this would be the right-hand side of a "matrix M = ..." 
>> command, or the right-hand side of commands on the pattern
>>   genr M = ...
>>   M = ...
>> where "M" can be identified as a pre-existing matrix.


> Has the syntax changed here? I thought the 'matrix' keyword 
> always has to precede matrix-related statements?

Yes, it has changed.

Gretl now has "static typing".  This means that once a given 
variable is defined as having a certain type, you can't change
its type on the fly.  For example, this will produce an error:

  scalar x = 2
  x = log(price)

if "price" is a series.  On the other hand it is OK to "cast" a 
variable to a different type, as in

  scalar x = 2
  series y = x

which produces a series each of whose observations has value 2.

One advantage of static typing is that you don't have to keep 
repeating type identifiers such as "matrix": if M is initially 
defined as a matrix, you can thereafter use plain "M" on the 
left-hand side of genr-type commands: gretl will know that it's 
supposed to be generating a matrix.


More information about the Gretl-users mailing list