gmm.ScalarIVCUE

Guide & worked example · Source

gmm.ScalarIVCUE(a, b, sigma)

Scalar CUE objective (a-beta*b)' Omega(beta)^-1 (a-beta*b).

Parameters

Name Type Description Default
a (array_like, shape(k)) Sample moments Z'y/sqrt(n) and Z'x/sqrt(n). required
b (array_like, shape(k)) Sample moments Z'y/sqrt(n) and Z'x/sqrt(n). required
sigma (array_like, shape(2 * k, 2 * k)) Fixed symmetric positive-definite joint moment covariance, in block order (outcome, endogenous regressor). No ridge is added automatically. required

Notes

Omega(beta) = S11 - beta*(S12+S21) + beta**2*S22. A covariance-based affine change of parameter and an invertible instrument transformation improve conditioning without changing the objective. Only the polynomial solver is capped at 12 instruments; objective evaluation has no such cap. No parameter standard errors or hypothesis-test calibration are provided.

Attributes

Name Description
A
B
C
center
k
normalized_condition
scale

Methods

Name Description
from_data Build the fixed joint covariance and scalar-IV sample moments.
minimize_polynomial Interpolate p/q, enumerate real companion roots, compare with infinity.
value Evaluate the original matrix criterion, including the common ±∞ limit.
value_derivatives Return Q, dQ/dbeta, d²Q/dbeta²; infinity has no beta derivatives.

from_data

gmm.ScalarIVCUE.from_data(
    z,
    y,
    x,
    *,
    covariance='hc0',
    weighting='reduced_form',
    demean=True,
    max_lags=0,
    clusters=None,
)

Build the fixed joint covariance and scalar-IV sample moments.

weighting='reduced_form' uses residuals from OLS of each column of (y,x) on Z, as in the paper’s setup. weighting='raw' uses (y,x) itself: with HC0 this is exactly the structural-moment CUE criterion profiled by Trex’s quadratic GEL, up to its factor 1/(2*n).

covariance is ‘hc0’, Bartlett ‘hac’, or one-way ‘cluster’ (CR0, sum of cluster-score outer products / n; no small-sample correction). demean=True removes an intercept, not arbitrary included controls. Pass one scalar endogenous regressor; do not pass an intercept in Z when demeaning. Joint covariance singularities are rejected.

minimize_polynomial

gmm.ScalarIVCUE.minimize_polynomial(validation_tol=1e-07, root_tol=1e-07)

Interpolate p/q, enumerate real companion roots, compare with infinity.

Two overlapping projective charts, t=(beta-center)/scale and 1/t, cover the entire real line with |chart coordinate|<=1. This avoids discarding remote finite roots or imposing parameter search bounds. NumPy’s Chebyshev companion eigenproblem is the basis-conditioned counterpart of the paper’s monomial companion matrix. Each candidate is polished using derivatives of the original matrix objective.

The finite-precision checks are diagnostics, not a certificate. A failed interpolation/stationarity check raises FloatingPointError. The singular and multivariate algorithms in the paper are not included.

value

gmm.ScalarIVCUE.value(beta)

Evaluate the original matrix criterion, including the common ±∞ limit.

value_derivatives

gmm.ScalarIVCUE.value_derivatives(beta)

Return Q, dQ/dbeta, d²Q/dbeta²; infinity has no beta derivatives.