Spatex.Regression.GMLag (Spatex v0.2.1)

Copy Markdown View Source

Result of Spatex.Regression.gm_lag/4: the spatial two-stage least squares model y = rho W y + X beta + e (spreg.GM_Lag, spreg 1.9.1) in snake_case.

Matrices are lists of rows. betas, std_err and z_stat list the constant, the exogenous and ordinary endogenous regressors, and rho last, matching name_x. Non-finite numbers are the atoms :nan, :infinity and :neg_infinity.

Fields

  • n, k - observations and coefficients (rho included).
  • betas, rho, vm (sig2 * varb, or the White / HAC covariance), varb ((Z'H (H'H)^-1 H'Z)^-1), std_err, z_stat ([{z, p}], normal).
  • sig2 (u'u / n, or u'u / (n - k) with sig2n_k: true), u (structural residuals, y - Z betas), predy (Z betas), predy_e (reduced-form prediction (I - rho W)^-1 X beta, zeros when |rho| >= 1), e_pred (y - predy_e).
  • pr2, pr2_e - squared correlations of y with predy and predy_e (pr2_e is nil when |rho| >= 1).
  • ak_test - Anselin-Kelejian test {statistic, p} for residual spatial dependence (nil with spat_diag: false or robust: :hac).
  • 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 exogenous non-constant regressor; power_terms.
  • robust, w_lags, lag_q, name_x, name_y, name_yend (ordinary endogenous regressors), name_q (user instruments), warnings.

The instrument matrix h and regressor matrix z spreg stores are not returned.

Summary

Types

multipliers()

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

t()

@type t() :: %Spatex.Regression.GMLag{
  ak_test: {value(), value()} | nil,
  betas: [value()],
  e_pred: [value()],
  impacts: %{optional(atom()) => [map()]} | nil,
  k: pos_integer(),
  lag_q: boolean(),
  n: pos_integer(),
  name_q: [String.t()],
  name_x: [String.t()],
  name_y: String.t(),
  name_yend: [String.t()],
  power_terms: pos_integer() | nil,
  pr2: value(),
  pr2_e: value() | nil,
  predy: [value()],
  predy_e: [value()],
  rho: value(),
  robust: nil | :white | :hac,
  sig2: value(),
  sp_multipliers: %{optional(atom()) => multipliers()} | nil,
  std_err: [value()],
  u: [value()],
  varb: [[value()]],
  vm: [[value()]],
  w_lags: pos_integer(),
  warnings: [String.t()],
  z_stat: [{value(), value()}]
}

value()

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