moderndid.npiv_jhat_max#

moderndid.npiv_jhat_max(x, w, j_x_degree=3, k_w_degree=4, k_w_smooth=2, knots='uniform', basis='tensor', x_min=None, x_max=None, w_min=None, w_max=None)[source]#

Determine the upper limit of the sieve dimension grid.

Computes the maximum feasible number of B-spline basis functions, \(\hat{J}_{\max}\), based on the sample size and an estimate of the sieve measure of ill-posedness, \(\hat{s}_J\). This serves as the upper bound for the grid of dimensions searched over in the Lepski-style selection procedure.

\(\hat{J}_{\max}\) is defined as the largest \(J\) in a dyadic grid \(\mathcal{T}\) that satisfies

\[J \sqrt{\log J} \hat{s}_{J}^{-1} \leq c \sqrt{n}\]

for a constant \(c\) (here, 10). The term \(\hat{s}_J\) is the smallest singular value of a matrix related to the instrumented basis functions, which captures the degree of ill-posedness.

Parameters:
xnumpy.ndarray

Endogenous regressor matrix.

wnumpy.ndarray

Instrument matrix.

j_x_degreeint, default=3

Degree of B-spline basis for X.

k_w_degreeint, default=4

Degree of B-spline basis for W.

k_w_smoothint, default=2

Smoothness parameter for K selection.

knots{“uniform”, “quantiles”}, default=”uniform”

Knot placement method.

basis{“tensor”, “additive”, “glp”}, default=”tensor”

Type of basis.

x_min, x_max, w_min, w_maxfloat, optional

Range limits for basis construction.

Returns:
dict

Dictionary containing:

  • j_x_segments_set: Array of J values to test

  • k_w_segments_set: Corresponding K values

  • j_hat_max: Maximum feasible dimension

  • alpha_hat: Recommended alpha for testing

See also

npiv_choose_j

Full data-driven selection procedure

npiv_j

Lepski-style selection procedure

References

[1]

Chen, X., Christensen, T. M., & Kankanala, S. (2024). Adaptive Estimation and Uniform Confidence Bands for Nonparametric Structural Functions and Elasticities. https://arxiv.org/abs/2107.11869.