esda.Smaup

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

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

Parameters:
nint

number of spatial units

kint

number of regions

rhofloat

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

Notes

Technical details and derivations can be found in [DLP18].

Examples

>>> import libpysal
>>> import numpy as np
>>> from esda.moran import Moran
>>> from esda.smaup import Smaup
>>> w = libpysal.io.open(libpysal.examples.get_path("stl.gal")).read()
>>> f = libpysal.io.open(libpysal.examples.get_path("stl_hom.txt"))
>>> y = np.array(f.by_col['HR8893'])
>>> rho = Moran(y,  w).I
>>> n = len(y)
>>> k = int(n/2)
>>> s = Smaup(n,k,rho)
>>> s.smaup
0.15221341690376405
>>> s.critical_01
0.38970613333333337
>>> s.critical_05
0.3557221333333333
>>> s.critical_1
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 = np.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)
>>> s.smaup
0.15176796553181948
>>> s.critical_01
0.38970613333333337
>>> s.critical_05
0.3557221333333333
>>> s.critical_1
0.3157950666666666
>>> s.summary
'Pseudo p-value > 0.10 (H0 is not rejected)'
Attributes:
nint

number of spatial units

kint

number of regions

rhofloat

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

smaupfloat

: S-maup statistic (M)

critical_01float

: critical value at 0.99 confidence level

critical_05float

: critical value at 0.95 confidence level

critical_1float

: critical value at 0.90 confidence level

summarystr

: message with interpretation of results

__init__(n, k, rho)[source]

Methods

__init__(n, k, rho)