esda.Smaup¶
- class esda.Smaup(n, k, rho)[source]¶
S-maup: Statistical Test to Measure the Sensitivity to the Modifiable Areal Unit Problem.
- Parameters:
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:
- n
int
number of spatial units
- k
int
number of regions
- rho
float
rho value (level of spatial autocorrelation) ranges from -1 to 1
- smaup
float
: S-maup statistic (M)
- critical_01
float
: critical value at 0.99 confidence level
- critical_05
float
: critical value at 0.95 confidence level
- critical_1
float
: critical value at 0.90 confidence level
- summary
str
: message with interpretation of results
- n
Methods
__init__
(n, k, rho)