@@ -90,15 +90,12 @@ def fit_qte(y, x, d, quantiles, learner_g, learner_m, all_smpls, n_rep=1,
9090
9191def boot_qte (scaled_scores , ses , quantiles , all_smpls , n_rep , bootstrap , n_rep_boot ):
9292 n_quantiles = len (quantiles )
93- boot_t_stat = np .zeros ((n_quantiles , n_rep_boot * n_rep ))
93+ boot_t_stat = np .zeros ((n_rep_boot , n_quantiles , n_rep ))
9494 for i_rep in range (n_rep ):
9595 n_obs = scaled_scores .shape [0 ]
9696 weights = draw_weights (bootstrap , n_rep_boot , n_obs )
9797 for i_quant in range (n_quantiles ):
98- i_start = i_rep * n_rep_boot
99- i_end = (i_rep + 1 ) * n_rep_boot
100-
101- boot_t_stat [i_quant , i_start :i_end ] = np .matmul (weights , scaled_scores [:, i_quant , i_rep ]) / \
98+ boot_t_stat [:, i_quant , i_rep ] = np .matmul (weights , scaled_scores [:, i_quant , i_rep ]) / \
10299 (n_obs * ses [i_quant , i_rep ])
103100
104101 return boot_t_stat
@@ -108,7 +105,8 @@ def confint_qte(coef, se, quantiles, boot_t_stat=None, joint=True, level=0.95):
108105 a = (1 - level )
109106 ab = np .array ([a / 2 , 1. - a / 2 ])
110107 if joint :
111- sim = np .amax (np .abs (boot_t_stat ), 0 )
108+ assert boot_t_stat .shape [2 ] == 1
109+ sim = np .amax (np .abs (boot_t_stat [:, :, 0 ]), 1 )
112110 hatc = np .quantile (sim , 1 - a )
113111 ci = np .vstack ((coef - se * hatc , coef + se * hatc )).T
114112 else :
0 commit comments