# `Spatex.Regression.GMError`
[🔗](https://github.com/CountlinkX-Solutions/spatex/blob/v0.2.1/lib/spatex/regression/gm_error.ex#L1)

Result of `Spatex.Regression.gm_error/4`: a GMM spatial error model
`y = X beta + u`, `u = lambda W u + e` for any of the three estimators (`GM_Error`,
`GM_Error_Het`, `GM_Error_Hom` and their `Endog` variants with `yend` / `q`), with the
attribute names of spreg 1.9.1 in snake_case.

Matrices are lists of rows. `betas` lists the regressors and `lam` last, matching `name_x`
(whose last entry is `"lambda"`). Non-finite numbers are the atoms `:nan`, `:infinity` and
`:neg_infinity`.

## Fields

  * `n`, `k` - observations and regressors (`lam` not counted).
  * `estimator` - `:kp98`, `:het` or `:hom`.
  * `betas`, `lam`, `vm`, `std_err`, `z_stat` (`[{z, p}]`, normal). With `:kp98` the covariance
    is `k x k` and `lam` has no standard error (`std_err` and `z_stat` have `k` entries); with
    `:het` and `:hom` it is `(k + 1) x (k + 1)` including `lam`.
  * `sig2` - `nil` for `:het` (spreg reports none).
  * `u` (`y - X beta`), `predy`, `e_filtered` (`u - lam W u`), `pr2`.
  * `iteration`, `iter_stop` (spreg's message), `step1c`, `max_iter`, `epsilon`, `a1`
    (`:hom` only) - `nil` for `:kp98`, which has no iterations.
  * `lambdas` - every lambda the moment optimizer returned, in call order (first step, then each
    iteration).
  * `name_x` (coefficient names, `"lambda"` last), `name_y`, `name_yend`, `name_q`, `warnings`.

# `t`

```elixir
@type t() :: %Spatex.Regression.GMError{
  a1: :hom_sc | :hom | :het | nil,
  betas: [value()],
  e_filtered: [value()],
  epsilon: float() | nil,
  estimator: :kp98 | :het | :hom,
  iter_stop: String.t() | nil,
  iteration: pos_integer() | nil,
  k: pos_integer(),
  lam: value(),
  lambdas: [value()],
  max_iter: pos_integer() | nil,
  n: pos_integer(),
  name_q: [String.t()],
  name_x: [String.t()],
  name_y: String.t(),
  name_yend: [String.t()],
  pr2: value(),
  predy: [value()],
  sig2: value() | nil,
  std_err: [value()],
  step1c: boolean() | nil,
  u: [value()],
  vm: [[value()]],
  warnings: [String.t()],
  z_stat: [{value(), value()}]
}
```

# `value`

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

---

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