Skip to content

Commit d0b4722

Browse files
committed
remove boot_coef from qte
1 parent d033d86 commit d0b4722

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

doubleml/irm/tests/_utils_qte_manual.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ def fit_qte(y, x, d, quantiles, learner_g, learner_m, all_smpls, n_rep=1,
9090

9191
def boot_qte(scaled_scores, ses, quantiles, all_smpls, n_rep, bootstrap, n_rep_boot):
9292
n_quantiles = len(quantiles)
93-
boot_qte = np.zeros((n_quantiles, n_rep_boot * n_rep))
9493
boot_t_stat = np.zeros((n_quantiles, n_rep_boot * n_rep))
9594
for i_rep in range(n_rep):
9695
n_obs = scaled_scores.shape[0]
@@ -99,11 +98,10 @@ def boot_qte(scaled_scores, ses, quantiles, all_smpls, n_rep, bootstrap, n_rep_b
9998
i_start = i_rep * n_rep_boot
10099
i_end = (i_rep + 1) * n_rep_boot
101100

102-
boot_qte[i_quant, i_start:i_end] = np.matmul(weights, scaled_scores[:, i_quant, i_rep]) / n_obs
103101
boot_t_stat[i_quant, i_start:i_end] = np.matmul(weights, scaled_scores[:, i_quant, i_rep]) / \
104102
(n_obs * ses[i_quant, i_rep])
105103

106-
return boot_qte, boot_t_stat
104+
return boot_t_stat
107105

108106

109107
def confint_qte(coef, se, quantiles, boot_t_stat=None, joint=True, level=0.95):

doubleml/irm/tests/test_qte.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,13 @@ def dml_qte_fixture(generate_data_quantiles, learner, normalize_ipw, kde):
9090

9191
for bootstrap in boot_methods:
9292
np.random.seed(42)
93-
boot_qte_coef, boot_t_stat = boot_qte(res_manual['scaled_scores'], res_manual['ses'], quantiles,
94-
all_smpls, n_rep, bootstrap, n_rep_boot)
93+
boot_t_stat = boot_qte(res_manual['scaled_scores'], res_manual['ses'], quantiles,
94+
all_smpls, n_rep, bootstrap, n_rep_boot)
9595

9696
np.random.seed(42)
9797
dml_qte_obj.bootstrap(method=bootstrap, n_rep_boot=n_rep_boot)
9898

99-
res_dict['boot_qte_' + bootstrap] = dml_qte_obj.boot_coef
10099
res_dict['boot_t_stat_' + bootstrap] = dml_qte_obj.boot_t_stat
101-
res_dict['boot_qte_' + bootstrap + '_manual'] = boot_qte_coef
102100
res_dict['boot_t_stat_' + bootstrap + '_manual'] = boot_t_stat
103101

104102
ci = dml_qte_obj.confint(joint=True, level=0.95)
@@ -126,9 +124,6 @@ def test_dml_qte_se(dml_qte_fixture):
126124
@pytest.mark.ci
127125
def test_dml_qte_boot(dml_qte_fixture):
128126
for bootstrap in dml_qte_fixture['boot_methods']:
129-
assert np.allclose(dml_qte_fixture['boot_qte_' + bootstrap],
130-
dml_qte_fixture['boot_qte_' + bootstrap + '_manual'],
131-
rtol=1e-9, atol=1e-4)
132127
assert np.allclose(dml_qte_fixture['boot_t_stat_' + bootstrap],
133128
dml_qte_fixture['boot_t_stat_' + bootstrap + '_manual'],
134129
rtol=1e-9, atol=1e-4)

0 commit comments

Comments
 (0)