Calculates the Leave-Three-Out (L3O) variance estimator (\(\hat{V}_{LM}\)) for the score statistic in the "No Covariates" setting. Unlike the group-optimized functions, this implementation loops over every observation \(i\), making it suitable for any design where the weighting matrix is symmetric (\(G = P\)), even if it lacks a strict block-diagonal structure.

L3Ovar_iloop_nocov(X, e, P)

Arguments

X

Numeric vector of length n. The endogenous regressor.

e

Numeric vector of length n. Residuals under the null hypothesis.

P

Matrix of dimension n x n. The projection matrix (must be symmetric).

Value

Scalar. The estimated variance \(\hat{V}_{LM}\).

Details

This function implements the variance estimator \(\hat{V}_{LM}\) under the assumption that there are no covariates, implying \(G = P\) and \(P\) is symmetric.

Specifically: The function iterates through each observation \(i\) (1 to \(N\)). Inside the loop, it:

  1. Extracts the \(i\)-th column of \(P\) and \(M\).

  2. Computes the L3O determinant adjustments \(D_{ijk}\) for all \(k\).

  3. Calculates all five variance components (\(A_1 \dots A_5\)) simultaneously using pre-computed vector products to maximize efficiency.

This implementation is slower than L3Ovar_gloop_nocov for simple grouped designs but is more general.