# `Spatex.ESDA.GLocal`
[🔗](https://github.com/CountlinkX-Solutions/spatex/blob/v0.2.1/lib/spatex/esda/g_local.ex#L1)

Result of `Spatex.ESDA.g_local/3`: the local Getis-Ord statistics `G_i` and `G*_i`
(`esda.G_Local`).

Every per-site field is a list aligned with the graph's node order (`ids`). Field names are
esda's attributes in snake_case (`Gs` is `gs`, `EGs` is `egs`, `seG_sim` is `se_g_sim`);
`sim` is esda's `rGs`, one list of `permutations` values per site.

With `keep_simulations: :tensor`, `sim` is an `Nx.Tensor` of type `{:f, 64}` and shape
`{n, permutations}` instead of nested lists.

  * `gs` - local statistic. `G_i` excludes the focal value (`star: false`), `G*_i` includes it.
  * `egs`, `vgs`, `zs`, `p_norm` - expectation, variance and z-score under the normality
    assumption and its one-tailed p-value `sf(|zs|)`. Islands have `zs` and `p_norm` of
    `:nan`.
  * `p_sim` - pseudo p-value of the conditional randomization (see the `:alternative` option
    of `Spatex.ESDA.g_local/3`), `sim` - the simulated statistics, `eg_sim`, `se_g_sim`,
    `vg_sim`, `z_sim`, `p_z_sim` - their moments and the one-tailed normal p-value of
    `z_sim`. All are `nil` with `permutations: 0`; with `keep_simulations: false`, `sim` and
    the moments are `nil` (as in esda) and only `p_sim` remains.
  * `star` - whether `G*` was computed (the prepared weights have a positive diagonal),
    `star_arg` - the `:star` option as given, `w_transform` - `:r` or `:b`, `y_sum` - `sum(y)`.

Islands: the statistic is `0`, and (as in esda) their `p_sim` is the smallest possible
`1 / (permutations + 1)`. esda's `G_Local` has no cluster labels, so there is no
`hot_cold` helper; combine `p_sim` with `zs` (positive: hot spot, negative: cold spot) and,
to control for multiple testing, `Spatex.ESDA.fdr/2`.

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

# `t`

```elixir
@type t() :: %Spatex.ESDA.GLocal{
  alternative: atom(),
  eg_sim: [value()] | nil,
  egs: [value()],
  gs: [value()],
  ids: [term()] | nil,
  island_weight: number(),
  n: pos_integer(),
  p_norm: [value()],
  p_sim: [float()] | nil,
  p_z_sim: [value()] | nil,
  permutations: non_neg_integer(),
  se_g_sim: [value()] | nil,
  seed: non_neg_integer() | nil,
  sim: [[float()]] | Nx.Tensor.t() | nil,
  star: boolean(),
  star_arg: boolean() | nil | number(),
  vg_sim: [value()] | nil,
  vgs: [value()],
  w_transform: :r | :b,
  y_sum: float(),
  z_sim: [value()] | nil,
  zs: [value()]
}
```

# `value`

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

---

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