# pointpats.modified_knox

pointpats.modified_knox(s_coords, t_coords, delta, tau, permutations=99)

  Baker’s modified Knox test for spatio-temporal interaction. [Bak04]

  Parameters:
    s_coords array

      (n, 2), spatial coordinates.

    t_coords array

      (n, 1), temporal coordinates.

    delta float

      threshold for proximity in space.

    tau float

      threshold for proximity in time.

    permutations int, optional

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

  Returns:
    modknox_result dictionary

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

    stat float

      value of the modified knox test for the dataset.

    pvalue float

      pseudo p-value associated with the statistic.

  Examples

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

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

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

  Set the random seed generator. This is used by the permutation based inference to replicate the pseudo-significance of our example results - the end-user will normally omit this step.

      >>> np.random.seed(100)

  Run the modified Knox test with distance and time thresholds of 20 and 5, respectively. This counts the events that are closer than 20 units in space, and 5 units in time.

      >>> result = modified_knox(events.space, events.t, delta=20, tau=5, permutations=99)

  Next, we examine the results. First, we call the statistic from the results dictionary. This reports the difference between the observed and expected Knox statistic.

      >>> print("%2.8f" % result['stat'])
      2.81016043

  Next, we look at the pseudo-significance of this value, calculated by permuting the timestamps and rerunning the statistics. In this case, the results indicate there is likely no space-time interaction.

      >>> print("%2.2f" % result['pvalue'])
      0.11