[Gretl-users] spatial statistics
Riccardo (Jack) Lucchetti
r.lucchetti at univpm.it
Wed Nov 28 16:54:43 EST 2007
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 needed to
> 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 a loop,
> provided a recoding is done so that the neighbor matrix is recoded eg, in the
> following format:
>
> Obs No Neighbor1 Neighbor2 Neighbor3 ... Neighbor n
>
> 1 nn1 nn2 nn3 nnN
> 2 nn1
> ...
> n
>
> 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?
<script>
nulldata 3
set seed 4385
matrix a = muniform(6,1)
matrix b = muniform(1,3)
matrix A = a > 0.5
matrix B = b > 0.5
A
B
matrix C = A*B
C
</script>
> Three, if you are interested in this topic, I will gladly contribute my
> developments to the community.
Please do!
Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche
r.lucchetti at univpm.it
http://www.econ.univpm.it/lucchetti
More information about the Gretl-users
mailing list