> For the complete documentation index, see [llms.txt](https://xunli.gitbook.io/jsgeoda/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://xunli.gitbook.io/jsgeoda/local-spatial-autocorrelation-multivariate/local-neighbor-match-test.md).

# Local Neighbor Match Test

The local neighbor match test ([2020](https://geodacenter.github.io/workbook/6c_local_multi/lab6c.html#ref-AnselinLi:20)) is a method to identify significant locations by assessing the extent of overlap between k-nearest neighbors in geographical space and k-nearest neighbors in multi-attribute space. For more information, please read <https://geodacenter.github.io/workbook/6c_local_multi/lab6c.html#local-neighbor-match-test>

## neighborMatchTest()

```sql
function neighborMatchTest(
    String map_uid,
    Number knn,
    Array val,
    String scale_method, 
    String distance_method,
    Number power, 
    Boolean is_inverse,
    Boolean is_arc,
    Boolean is_mile)
```

### Arguments

| Name             | Type    | Description                                                                                                                                          |
| ---------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| map\_uid         | String  | the unique map id                                                                                                                                    |
| k                | Number  | k nearest neighbor for both attribute and geographical space                                                                                         |
| vals             | *Array* | an array of numeric columns that contains the values for neighbor match test                                                                         |
| scale\_method    | String  | the scaling method. Options are {'*raw*', '*standardize*', '*demean*', '*mad*', '*range\_standardize*', '*range\_adjust*'}. Default: '*standardize*' |
| distance\_method | String  | the distance method. Options are {'*euclidean*', '*manhattan*'. Default: '*euclidean*'.                                                              |
| power            | Number  | the power/exponent corresponds to the number of times the base (dist\_band) is used as a factor. Default: 1.                                         |
| is\_inverse      | Boolean | if apply inverse on distance value. Default: False.                                                                                                  |
| is\_arc          | Boolean | if compute arc distance between two observations. Default: FALSE.                                                                                    |
| is\_mile         | Boolean | if convert distance unit from mile to kilometer(KM). Default: TRUE.                                                                                  |

### Return

| Type   | Description                                                 |
| ------ | ----------------------------------------------------------- |
| Object | An object with two keys: {'*cardinality*', '*probability*'} |

**Try it yourself in the playground (jsgeoda + deck.gl):**

{% embed url="<https://codesandbox.io/s/6lisamultivariate-4w3hk>" %}
