Skip to main content
Version: 7.2.0

nearestNeighborAnalysis

描述

¥Description

最近邻分析根据数据集中点之间的平均距离计算一个指数,从而推断数据在研究区域内是聚集、分散还是随机分布。

¥Nearest Neighbor Analysis calculates an index based the average distances between points in the dataset, thereby providing inference as to whether the data is clustered, dispersed, or randomly distributed within the study area.

它返回研究区域的 特性<多边形>,并将分析结果作为研究区域 propertiesnearestNeighborAnalysis 属性的一部分附加。附加的 z-score 表示数据观察到的平均距离与预期平均距离之间的标准差。负值越大,聚集度越高。正值越大,分散度越均匀。介于 -2 和 2 之间的 z 值表示看似随机的分布。也就是说,在 p 小于 0.05 的范围内,分布在统计上既不聚集也不分散,具有显著的统计学意义。

¥It returns a Feature<Polygon> of the study area, with the results of the analysis attached as part of of the nearestNeighborAnalysis property of the study area's properties. The attached z-score indicates how many standard deviations above or below the expected mean distance the data's observed mean distance is. The more negative, the more clustered. The more positive, the more evenly dispersed. A z-score between -2 and 2 indicates a seemingly random distribution. That is, within p of less than 0.05, the distribution appears statistically significantly neither clustered nor dispersed.

备注

¥Remarks

  • 虽然该分析适用于任何 FeatureCollection 类型,但最适合 集合。

    ¥Though the analysis will work on any FeatureCollection type, it works best with Point collections.

  • 此分析对所提供的研究区域非常敏感。如果没有传递 特性<多边形> 作为研究区域,则该函数会在数据周围绘制一个框,这可能会扭曲结果。此分析最适合于数据呈聚集、分散或随机分布的有限感兴趣区域。例如,如果研究区域是整个州,则城市的地铁站可能看起来非常密集。另一方面,如果研究区域仅限于市中心,它们可能看起来分布得相当均匀。

    ¥This analysis is very sensitive to the study area provided. If no Feature<Polygon> is passed as the study area, the function draws a box around the data, which may distort the findings. This analysis works best with a bounded area of interest within with the data is either clustered, dispersed, or randomly distributed. For example, a city's subway stops may look extremely clustered if the study area is an entire state. On the other hand, they may look rather evenly dispersed if the study area is limited to the city's downtown.

参数

¥Parameters

名称类型描述
datasetFeatureCollection<any>要研究的要素集合(点的首选)
options?对象可选参数(默认 {})
options.studyArea?特性<多边形>表示研究区域的多边形
options.properties?GeoJsonProperties属性(默认 {})

返回

¥Returns

NearestNeighborStudyArea 研究区域的多边形或其近似值。

¥NearestNeighborStudyArea A polygon of the study area or an approximation of one.

示例

¥Examples

var bbox = [-65, 40, -63, 42];
var dataset = turf.randomPoint(100, { bbox: bbox });
var nearestNeighborStudyArea = turf.nearestNeighborAnalysis(dataset);

安装

¥Installation

$ npm install @turf/nearest-neighbor-analysis

import { nearestNeighborAnalysis } from "@turf/nearest-neighbor-analysis";
const result = nearestNeighborAnalysis(...);
$ npm install @turf/turf

import * as turf from "@turf/turf";
const result = turf.nearestNeighborAnalysis(...);