local_morans_i¶
local_morans_i
¶
local_morans_i(info: DataFrame, value_col: str, *, k: int = 8, permutations: int = 999, seed: int = 0, fdr: bool = False) -> DataFrame
Local Moran's I (LISA): per-station spatial-autocorrelation hotspots and cold spots.
Where morans_i returns one global number ("is there a pattern?"), LISA localises it:
each station gets a local statistic, a permutation pseudo p-value, and a cluster label, so a
study can map where the low-availability cold spots or high-turnover hot spots are.
With deviations :math:z_i = x_i - \bar{x} and row-standardised k-nearest-neighbour weights,
the local statistic is :math:I_i = (z_i / m_2)\sum_j w_{ij} z_j, where
:math:m_2 = \frac{1}{n}\sum_i z_i^2. Significance is a conditional-permutation pseudo
p-value; each station is labelled HH (high value, high neighbours), LL, HL or
LH (spatial outliers) when significant, else ns. Requires scipy ([geo] weights).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
info
|
DataFrame
|
Canonical station inventory with |
required |
value_col
|
str
|
The variable to test (for example occupancy or turnover). |
required |
k
|
int
|
Number of nearest neighbours for the spatial weights. |
8
|
permutations
|
int
|
Permutations for the pseudo p-value. |
999
|
seed
|
int
|
Seed for the permutation draw (reproducible). |
0
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Aligned to |
References
Anselin, L. (1995). Local Indicators of Spatial Association (LISA). Geographical Analysis, 27(2), 93-115.
See Also
morans_i : The global Moran's I this decomposes.
fdr_adjust : Control the false-discovery rate across stations.
Source code in src/gbfs_toolkit/spatial/analytics.py
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 | |