# pointpats.jacquez

pointpats.jacquez(s_coords, t_coords, k, permutations=99)

  Jacquez k nearest neighbors test for spatio-temporal interaction. [Jac96]

  Parameters:
    s_coords array

      (n, 2), spatial coordinates.

    t_coords array

      (n, 1), temporal coordinates.

    k int

      the number of nearest neighbors to be searched.

    permutations int, optional

      the number of permutations used to establish pseudo- significance (the default is 99).

  Returns:
    jacquez_result dictionary

      contains the statistic (stat) for the test and the associated p-value (pvalue).

    stat float

      value of the Jacquez k nearest neighbors test for the dataset.

    pvalue float

      p-value associated with the statistic (normally distributed with k-1 df).

  Examples

      >>> import numpy as np
      >>> import libpysal as lps
      >>> from pointpats import SpaceTimeEvents, jacquez

  Read in the example data and create an instance of SpaceTimeEvents.

      >>> path = lps.examples.get_path("burkitt.shp")
      >>> events = SpaceTimeEvents(path,'T')

  The Jacquez test counts the number of events that are k nearest neighbors in both time and space. The following runs the Jacquez test on the example data and reports the resulting statistic. In this case, there are 12 instances where events are nearest neighbors in both space and time. # turning off as kdtree changes from scipy < 0.12 return 13

      >>> np.random.seed(100)
      >>> result = jacquez(events.space, events.t ,k=3,permutations=99)
      >>> print(result['stat'])
      12

  The significance of this can be assessed by calling the p- value from the results dictionary, as shown below. Again, no space-time interaction is observed.

      >>> result['pvalue'] < 0.01
      False