diff_diff.BandwidthResult#

class diff_diff.BandwidthResult[source]#

Bases: object

MSE-optimal bandwidth selector output plus per-stage diagnostics.

Returned by mse_optimal_bandwidth(..., return_diagnostics=True). Mirrors the five-bandwidth + four-stage structure of nprobust::lpbwselect.mse.dpi; see diff_diff/_nprobust_port.py for the source mapping.

h_mse#

Final MSE-optimal bandwidth h* for local-linear estimation at boundary. The argument to pass to local_linear_fit(..., bandwidth=h_mse).

Type:

float

b_mse#

Bias-correction bandwidth. Consumed by Phase 1c for the bias-corrected confidence interval (CCF 2018 Equation 8).

Type:

float

c_bw#

Stage 1 preliminary bandwidth used as h.V in every lprobust.bw call downstream: C_kernel * min(sd(d), IQR(d)/1.349) * G^{-1/5}. Kernel constants: epa=2.34, uni=1.843, tri=2.576.

Type:

float

bw_mp2#

Stage 2 pilot bandwidth for the m^{(q+1)} derivative estimator.

Type:

float

bw_mp3#

Stage 2 pilot bandwidth for the m^{(q+2)} derivative estimator.

Type:

float

stage_d1_V, stage_d1_B1, stage_d1_B2, stage_d1_R

Variance and bias coefficients from the first Stage-2 lprobust.bw call (order q+1, reading the (q+1)-th derivative). Parity-checked to 1% against R.

Type:

float

stage_d2_V, stage_d2_B1, stage_d2_B2, stage_d2_R

Same for the second Stage-2 call (order q+2).

Type:

float

stage_b_V, stage_b_B1, stage_b_B2, stage_b_R

Same for the Stage-3 bias-bandwidth call (order q, nu p+1).

Type:

float

stage_h_V, stage_h_B1, stage_h_B2, stage_h_R

Same for the final Stage-3 main-bandwidth call (order p, nu deriv).

Type:

float

n#

Sample size.

Type:

int

kernel#

Kernel name as user supplied it (“epanechnikov” / “triangular” / “uniform”).

Type:

str

boundary#

Evaluation point d_0.

Type:

float

Methods

__init__(h_mse, b_mse, c_bw, bw_mp2, bw_mp3, ...)

Attributes

h_mse

b_mse

c_bw

bw_mp2

bw_mp3

stage_d1_V

stage_d1_B1

stage_d1_B2

stage_d1_R

stage_d2_V

stage_d2_B1

stage_d2_B2

stage_d2_R

stage_b_V

stage_b_B1

stage_b_B2

stage_b_R

stage_h_V

stage_h_B1

stage_h_B2

stage_h_R

n

kernel

boundary

__init__(h_mse, b_mse, c_bw, bw_mp2, bw_mp3, stage_d1_V, stage_d1_B1, stage_d1_B2, stage_d1_R, stage_d2_V, stage_d2_B1, stage_d2_B2, stage_d2_R, stage_b_V, stage_b_B1, stage_b_B2, stage_b_R, stage_h_V, stage_h_B1, stage_h_B2, stage_h_R, n, kernel, boundary)#
Parameters:
Return type:

None

classmethod __new__(*args, **kwargs)#