compute_local_spatial_autocorrelation
The following example calculates the local Moran’s I statistic for each row
in a table from a specific column and uses the spatial weights already saved in a
datastore. It uses the median_income
column and the spatial weights
from the spatial
datastore with the object name
la_bg_knn4
, corresponding to the spatial weights calculated with
the K-nearest neighbors method with K=4.
select *
from table(
pyqEval(
'{
"oml_connect": true,
"table": "oml_user.la_block_groups",
"key_column": "geoid",
"column": "median_income",
"weights": {"ds_name":"spatial", "obj_name": "la_bg_knn4"}
}',
'{ "geoid": "VARCHAR2(50)", "I": "NUMBER", "p_value": "NUMBER", "z_value": "NUMBER", "quadrant": "NUMBER" }',
'compute_local_spatial_autocorrelation'
)
);
For each row in the table, the result contains the following:
- The local Moran’s I statistic.
- The p-value.
- The z-value.
- The belonging quadrant.
- A high value surrounded by high values.
- A low value around high values.
- A low value surrounded by low values.
- A high value around high values.