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

Result of `Spatex.Regression.ml_lag/4`: the maximum-likelihood spatial lag model
`y = rho W y + X beta + e`, with the attribute names of `spreg.ML_Lag` (spreg 1.9.1) in
snake_case.

Matrices (`vm`, `vm1`) are lists of rows. `betas`, `std_err` and `z_stat` list the regressors
first and `rho` last, matching `name_x` (whose last entry is `"W_<name_y>"`). Non-finite numbers
are the atoms `:nan`, `:infinity` and `:neg_infinity`.

## Fields

  * `n`, `k` - observations and coefficients; like spreg, `k` counts `rho`.
  * `betas`, `rho`, `vm` (covariance of `betas`), `vm1` (covariance of `betas`, `rho` and
    `sigma^2`), `std_err`, `z_stat` (`[{z, p}]`).
  * `logll`, `aic`, `schwarz`, `sig2` (`u'u / n`), `utu`.
  * `u` residuals, `predy` (`X beta + rho W y`), `predy_e` (the reduced-form prediction
    `(I - rho W)^-1 X beta` by power expansion, truncated at `epsilon`), `e_pred` (`y - predy_e`).
  * `pr2` (squared correlation of `y` and `predy`), `pr2_e` (same with `predy_e`).
  * `mean_y`, `std_y` (sample standard deviation).
  * `sp_multipliers` - `%{simple: {adi, aii, ati}, full: ..., power: ...}` for the requested
    `spat_impacts`; `impacts` - the same keys mapping to a list of
    `%{name, direct, indirect, total}` per non-constant regressor; `power_terms` - powers used by
    the power approximation. All `nil` with `spat_impacts: nil`.
  * `method`, `epsilon`, `iterations` (objective evaluations), `converged`, `name_x`, `name_y`,
    `warnings`.

# `multipliers`

```elixir
@type multipliers() :: {value(), value(), value()}
```

# `pair`

```elixir
@type pair() :: {value(), value()}
```

# `t`

```elixir
@type t() :: %Spatex.Regression.MLLag{
  aic: value(),
  betas: [value()],
  converged: boolean(),
  e_pred: [value()],
  epsilon: float(),
  impacts: %{optional(atom()) =&gt; [map()]} | nil,
  iterations: pos_integer(),
  k: pos_integer(),
  logll: value(),
  mean_y: value(),
  method: :full | :ord | :lu,
  n: pos_integer(),
  name_x: [String.t()],
  name_y: String.t(),
  power_terms: pos_integer() | nil,
  pr2: value(),
  pr2_e: value() | nil,
  predy: [value()],
  predy_e: [value()],
  rho: value(),
  schwarz: value(),
  sig2: value(),
  sp_multipliers: %{optional(atom()) =&gt; multipliers()} | nil,
  std_err: [value()],
  std_y: value(),
  u: [value()],
  utu: value(),
  vm: [[value()]],
  vm1: [[value()]],
  warnings: [String.t()],
  z_stat: [pair()]
}
```

# `value`

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

---

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