[Gretl-users] problem with matrix declaration from variables

Allin Cottrell cottrell at wfu.edu
Fri Apr 11 11:32:58 EDT 2008


On Fri, 11 Apr 2008, Franck Nadaud wrote:

> I am currently working on my spatial scripts under win snapshot.
> 
> I have trouble with scripts that used to work properly. The 
> problem is that I cannot declare a matrix calling either a list 
> or the variable references.
> 
> Here is what GRETL tells when I declare a 
> matrix V4 = {13, 14, 15, 16}
> 
> variables 13-16 are intergers listing the observation number of 
> each 4 nearest neighbors for my 257 data points.

Could you please send an actual script that doesn't work?  
According to gretl's syntax, the above definition of V4 will not 
reference any variables: "13", "14", "15" and "16" denote 
numerical constants -- and surely such a matrix is created 
correctly?  (I just checked here and it's OK).

Also created OK is a matrix composed of a set of scalar variables:

scalar s1 = 13
scalar s2 = 14
scalar s3 = 15
scalar s4 = 16
matrix M = {s1, s2, s3, s4}

However, scalar variables cannot be put into named lists, only 
series.  If I try

list L = s1 s2 s3 s4

I get an error: "Variable number 13 is out of bounds".  This is 
because gretl finds s1, sees that it's a scalar and so looks up 
its value, namely 13, and tries to add variable number 13 to the 
list.  But there is no variable number 13.

Allin.


More information about the Gretl-users mailing list