# `Spatex.PointPats.DistanceTest`
[🔗](https://github.com/CountlinkX-Solutions/spatex/blob/v0.2.1/lib/spatex/point_pats/distance_test.ex#L1)

Result of `Spatex.PointPats.g_test/2` and its siblings: an observed distance function with a
seeded Monte Carlo test against complete spatial randomness (`pointpats.distance_statistics`
`*_test`).

  * `function` - `:f`, `:g`, `:j`, `:k` or `:l`.
  * `support` - the distances at which the statistic is evaluated.
  * `statistic` - the observed values at `support`.
  * `pvalue` - per-support pseudo p-value `min(p, 1 - p)` with
    `p = (count + 1) / (permutations + 1)`, `count` being the number of simulated values
    at least as large as the observed one, as in pointpats, so it is at most
    0.5 and can be `0.0` (for example at distance 0, where every statistic is 0). `:nan` when
    `permutations` is 0.
  * `simulations` - `permutations` curves (lists aligned with `support`) when
    `keep_simulations: true`, a `{permutations, length(support)}` `Nx.Tensor` of type
    `{:f, 64}` with `keep_simulations: :tensor`, else `nil`.
  * `envelope_low`, `envelope_high` - per-support minimum and maximum over the simulations
    (a Spatex convenience, not part of pointpats); `:nan` without simulations.

Non-finite floats are the atoms `:nan`, `:infinity` and `:neg_infinity`.

# `t`

```elixir
@type t() :: %Spatex.PointPats.DistanceTest{
  envelope_high: [value()],
  envelope_low: [value()],
  function: :f | :g | :j | :k | :l,
  permutations: non_neg_integer(),
  pvalue: [value()],
  seed: non_neg_integer(),
  simulations: [[value()]] | Nx.Tensor.t() | nil,
  statistic: [value()],
  support: [float()]
}
```

# `value`

```elixir
@type value() :: float() | :nan | :infinity | :neg_infinity
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
