On Wed, 28 Nov 2007, Franck Nadaud wrote:
Hi folks, greetings from Paris !
I am currently working on a spatial statistics project. I intend to develop
progressively some gretl functions to compute spatial correlation tests.
This would be brilliant.
A difficulty is to handle spatial neighborhood matrices that are
compute those tests. More specifically, I have an external file storing the
matrix in vector form: in the first column the list of the spatial units, and
in the second the list of their neighbors. The difficulty is that having two
different datafiles of different dimensions does not easily allow to pass the
contiguity matrix into the datafile containing the data to be analysed.
One of the thing planned for future versions is a function for
reading/writing matrices from/to csv files. Would this be useful to you?
I guess it could be done with a null list and an append command into
provided a recoding is done so that the neighbor matrix is recoded eg, in the
Obs No Neighbor1 Neighbor2 Neighbor3 ... Neighbor n
1 nn1 nn2 nn3 nnN
where nn1-nnN is the Observation No of unit n
In this case handling is perfect. For now, I use a third party application to
do that. But would like to avoid that but I do not succeed in opening the
contiguity matrix file, recode it and store inot the datafile.
Any advice ?
I'm not sure I understand exactly what you mean, but in the (unlikely)
case I do, you may use the mshape() function to put thing into place and
then convert the columns of the resulting matrix to series.
Two, do the matrix commands support the boolean product command ? It would be
very useful for contiguity matrix handling purposes (ie, to compute the
neighbors of neighbors, etc...).
What's the boolean product? You mean something like this?
set seed 4385
matrix a = muniform(6,1)
matrix b = muniform(1,3)
matrix A = a > 0.5
matrix B = b > 0.5
matrix C = A*B
Three, if you are interested in this topic, I will gladly contribute
developments to the community.
Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche