I run into errors with distance-based spatial weights in pysal. When running a spatial lag model (e.g. twosls_sp.GM_Lag), I get the following exception:
Exception: All entries on diagonal must equal 0.
Trying the example here, the diagonal is 1 (i.e., an observation is also its own neighbor), and the output is different from that given in the docs:
import pysal
points=[(10, 10), (20, 10), (40, 10), (15, 20), (30, 20), (30, 30)]
w = pysal.DistanceBand(points,threshold=11.2,binary=False)
w.weights[0]
[0.10000000000000001, inf, 0.089442719099991588]
w.neighbors[0]
[1, 0, 3]
After row standardization, there are only zeros and nans in the weights matrix:
w.transform = 'r'
w.weights[0]
[0.0, nan, 0.0]
Is this a bug in pysal, or likely a problem with my installation?
I am running the Enthought Canopy Python installation, with pysal installed separately, on a Mac OSX 10.8. Pysal is v1.11.0.