# 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>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://xunli.gitbook.io/jsgeoda/local-spatial-autocorrelation-multivariate/local-neighbor-match-test.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
