esda.Smaup

class esda.Smaup(n, k, rho)[source]

S-maup: Statistical Test to Measure the Sensitivity to the Modifiable Areal Unit Problem.

Parameters:
n : int

number of spatial units

k : int

number of regions

rho : float

rho value (level of spatial autocorrelation) ranges from -1 to 1

n[source]

number of spatial units

Type:

int

k[source]

number of regions

Type:

int

rho[source]

rho value (level of spatial autocorrelation) ranges from -1 to 1

Type:

float

smaup[source]

: S-maup statistic (M)

Type:

float

critical_01[source]

: critical value at 0.99 confidence level

Type:

float

critical_05[source]

: critical value at 0.95 confidence level

Type:

float

critical_1[source]

: critical value at 0.90 confidence level

Type:

float

summary[source]

: message with interpretation of results

Type:

string

Notes

Technical details and derivations can be found in [Duque et al., 2018].

Examples

>>> import libpysal, numpy
>>> from esda import Moran, Smaup
>>> w = libpysal.io.open(libpysal.examples.get_path("stl.gal")).read()
>>> f = libpysal.io.open(libpysal.examples.get_path("stl_hom.txt"))
>>> y = numpy.array(f.by_col['HR8893'])
>>> rho = Moran(y, w).I
>>> n = len(y)
>>> k = int(n/2)
>>> s = Smaup(n, k, rho)
>>> round(s.smaup, 6)
np.float64(0.152213)
>>> s.critical_01
np.float64(0.38970613333333337)
>>> s.critical_05
np.float64(0.3557221333333333)
>>> s.critical_1
np.float64(0.3157950666666666)
>>> s.summary
'Pseudo p-value > 0.10 (H0 is not rejected)'

SIDS example replicating OpenGeoda

>>> w = libpysal.io.open(libpysal.examples.get_path("sids2.gal")).read()
>>> f = libpysal.io.open(libpysal.examples.get_path("sids2.dbf"))
>>> SIDR = numpy.array(f.by_col("SIDR74"))
>>> from esda.moran import Moran
>>> rho = Moran(SIDR, w).I
>>> n = len(y)
>>> k = int(n/2)
>>> s = Smaup(n, k, rho)
>>> round(s.smaup, 6)
np.float64(0.151768)
>>> s.critical_01
np.float64(0.38970613333333337)
>>> s.critical_05
np.float64(0.3557221333333333)
>>> s.critical_1
np.float64(0.3157950666666666)
>>> s.summary
'Pseudo p-value > 0.10 (H0 is not rejected)'