esda.Smaup

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

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

Parameters:
npython:int

number of spatial units

kpython:int

number of regions

rhopython:float

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

Notes

Technical details and derivations can be found in [].

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:
npython:int

number of spatial units

kpython:int

number of regions

rhopython:float

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

smauppython:float

: S-maup statistic (M)

critical_01python:float

: critical value at 0.99 confidence level

critical_05python:float

: critical value at 0.95 confidence level

critical_1python:float

: critical value at 0.90 confidence level

summarypython:str

: message with interpretation of results

__init__(n, k, rho)[source]

Methods

__init__(n, k, rho)