Calculates the UJIVE "signal" or cross-product term \(X' G e\) for the grouped instrument design. This function exploits the block-diagonal structure of the projection matrix implied by mutually exclusive instrument groups to compute the quadratic form via efficient group-wise summation.
GetLM_nocov(df, X, e, groupZ, noisy = FALSE)Data frame. Contains the observable variables and grouping indicator.
Column name (unquoted). The first variable (e.g., endogenous regressor).
Column name (unquoted). The second variable (e.g., outcome or residual).
Column name (unquoted). The instrument grouping variable.
Logical. If TRUE, prints progress of the group iteration.
Defaults to FALSE.
Numeric scalar. The total sum of group-specific quadratic forms.
This function computes the scalar: $$S = \sum_{g=1}^J e_g' [ (I-D_{P_g})^{-1}(P_g - D_{P_g}) ] X_g$$ where \(P_g\) is the projection matrix onto the intercept for group \(g\) (i.e., the group mean).
This calculation corresponds to the numerator components (\(P_{XY}, P_{XX}\)) of the score statistic variance estimator in designs without covariates.
Yap, L. (2025). "Inference with Many Weak Instruments and Heterogeneity". Working Paper.