pysal / giddy

Exploratory spatiotemporal data analysis and Geospatial distribution dynamics analysis
http://pysal.org/giddy/
BSD 3-Clause "New" or "Revised" License
76 stars 25 forks source link

the spatial lags : related to issue 215 #216

Closed tra6sdc closed 5 months ago

tra6sdc commented 5 months ago

Hello,

I now understand that in the case of ties for the spatial lag a random number is used to break the tie. To explore this issue more I am looking at the lclass_ids attribute. I get these outputs:

[[4 4 4 4 4 4]
 [4 4 4 4 4 4]
 [4 4 4 4 4 4]
 ...
 [1 1 1 0 0 1]
 [2 3 2 0 2 0]
 [3 3 3 3 2 2]]

However if for my final polygon, # 7264, I manually identify the rank of spatial lags (minus 1) for this polygon's neighbours I get these lags:

7264    7                           
7023    7028    7029    7032    7036    7037    7039    Mode    
3   3   3   3   4   4   4   3   t1
4   2   4   3   4   4   4   4   t2
4   3   4   4   4   4   4   4   t3
4   3   4   3   4   4   4   4   t4
4   2   4   3   2   4   4   4   t5
3   2   3   2   3   4   4   3   t6

which for the final row of lclass_ids my calculation is

[3 4 4 4 4 3]

and not

[3 3 3 3 2 2]
martinfleis commented 5 months ago

Can you please provide fully reproducible code example we can run?

tra6sdc commented 5 months ago

Thanks, if you look back to issue #215 you should find the .csv, the .gal file and the code.

weikang9009 commented 5 months ago

@tra6sdc Thank you for reporting the issue. I was trying to use the files you uploaded to replicate the discrepancy. However, the result I got for your last polygon aligns with your manual calculation. Could you please rerun your program?

image

BTW, there is no need to specify the values of k and m with the discrete input values. Please refer to the giddy documentation for more information and examples (Example (4)).

tra6sdc commented 5 months ago

Yes, thank you so much for taking the time to look into this issue. Yes, I was using a different version of my input files. All is OK now. Sorry to have wasted your time.