spaghetti.Network.NetworkK

Network.NetworkK(self, pointpattern, nsteps=10, permutations=99, threshold=0.5, distribution='uniform', lowerbound=None, upperbound=None)[source]

Computes a network constrained K-Function

Parameters
pointpatternspaghetti.network.PointPattern

A spaghetti point pattern object.

nstepsint

The number of steps at which the count of the nearest neighbors is computed.

permutationsint

The number of permutations to perform. Default is 99.

thresholdfloat

The level at which significance is computed. (0.5 would be 97.5% and 2.5%).

distributionstr

The distribution from which random points are sampled Either "uniform" or "poisson".

lowerboundfloat

The lower bound at which the K-function is computed. Default is 0.

upperboundfloat

The upper bound at which the K-function is computed. Defaults to the maximum observed nearest neighbor distance.

Returns
NetworkKspaghetti.analysis.NetworkK

A network K class instance.

Notes

Based on [OY01].

Examples

>>> import spaghetti as spgh
>>> ntw = spgh.Network(in_data=examples.get_path('streets.shp'))
>>> pt_str = 'crimes'
>>> in_data = examples.get_path('{}.shp'.format(pt_str))
>>> ntw.snapobservations(in_data, pt_str, attribute=True)
>>> crimes = ntw.pointpatterns['crimes']
>>> sim = ntw.simulate_observations(crimes.npoints)
>>> kres = ntw.NetworkK(crimes, permutations=5, nsteps=10)
>>> kres.lowerenvelope.shape[0]
10