Skip to content

Commit 4a3278c

Browse files
committed
remove boot_coefs from plm tests
1 parent 6c7e7d2 commit 4a3278c

19 files changed

+69
-166
lines changed

doubleml/plm/tests/_utils_pliv_manual.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ def pliv_orth(y_minus_l_hat, z_minus_m_hat, d_minus_r_hat, y_minus_g_hat, d, sco
149149
def boot_pliv(y, d, z, thetas, ses, all_l_hat, all_m_hat, all_r_hat, all_g_hat,
150150
all_smpls, score, bootstrap, n_rep_boot,
151151
n_rep=1, apply_cross_fitting=True):
152-
all_boot_theta = list()
153152
all_boot_t_stat = list()
154153
for i_rep in range(n_rep):
155154
smpls = all_smpls[i_rep]
@@ -159,16 +158,14 @@ def boot_pliv(y, d, z, thetas, ses, all_l_hat, all_m_hat, all_r_hat, all_g_hat,
159158
test_index = smpls[0][1]
160159
n_obs = len(test_index)
161160
weights = draw_weights(bootstrap, n_rep_boot, n_obs)
162-
boot_theta, boot_t_stat = boot_pliv_single_split(
161+
boot_t_stat = boot_pliv_single_split(
163162
thetas[i_rep], y, d, z, all_l_hat[i_rep], all_m_hat[i_rep], all_r_hat[i_rep], all_g_hat[i_rep], smpls,
164163
score, ses[i_rep], weights, n_rep_boot, apply_cross_fitting)
165-
all_boot_theta.append(boot_theta)
166164
all_boot_t_stat.append(boot_t_stat)
167165

168-
boot_theta = np.hstack(all_boot_theta)
169166
boot_t_stat = np.hstack(all_boot_t_stat)
170167

171-
return boot_theta, boot_t_stat
168+
return boot_t_stat
172169

173170

174171
def boot_pliv_single_split(theta, y, d, z, l_hat, m_hat, r_hat, g_hat,
@@ -196,6 +193,6 @@ def boot_pliv_single_split(theta, y, d, z, l_hat, m_hat, r_hat, g_hat,
196193
assert score == 'IV-type'
197194
psi = np.multiply(y_minus_g_hat - d*theta, z_minus_m_hat)
198195

199-
boot_theta, boot_t_stat = boot_manual(psi, J, smpls, se, weights, n_rep_boot, apply_cross_fitting)
196+
boot_t_stat = boot_manual(psi, J, smpls, se, weights, n_rep_boot, apply_cross_fitting)
200197

201-
return boot_theta, boot_t_stat
198+
return boot_t_stat

doubleml/plm/tests/_utils_pliv_partial_x_manual.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,21 +120,18 @@ def pliv_partial_x_orth(u_hat, w_hat, r_hat_tilde, d, score):
120120
def boot_pliv_partial_x(y, d, z, thetas, ses, all_l_hat, all_m_hat, all_r_hat,
121121
all_smpls, score, bootstrap, n_rep_boot,
122122
n_rep=1):
123-
all_boot_theta = list()
124123
all_boot_t_stat = list()
125124
for i_rep in range(n_rep):
126125
n_obs = len(y)
127126
weights = draw_weights(bootstrap, n_rep_boot, n_obs)
128-
boot_theta, boot_t_stat = boot_pliv_partial_x_single_split(
127+
boot_t_stat = boot_pliv_partial_x_single_split(
129128
thetas[i_rep], y, d, z, all_l_hat[i_rep], all_m_hat[i_rep], all_r_hat[i_rep], all_smpls[i_rep],
130129
score, ses[i_rep], weights, n_rep_boot)
131-
all_boot_theta.append(boot_theta)
132130
all_boot_t_stat.append(boot_t_stat)
133131

134-
boot_theta = np.hstack(all_boot_theta)
135132
boot_t_stat = np.hstack(all_boot_t_stat)
136133

137-
return boot_theta, boot_t_stat
134+
return boot_t_stat
138135

139136

140137
def boot_pliv_partial_x_single_split(theta, y, d, z, l_hat, r_hat, r_hat_tilde,
@@ -146,6 +143,6 @@ def boot_pliv_partial_x_single_split(theta, y, d, z, l_hat, r_hat, r_hat_tilde,
146143

147144
psi = np.multiply(u_hat - w_hat*theta, r_hat_tilde)
148145

149-
boot_theta, boot_t_stat = boot_manual(psi, J, smpls, se, weights, n_rep_boot)
146+
boot_t_stat = boot_manual(psi, J, smpls, se, weights, n_rep_boot)
150147

151-
return boot_theta, boot_t_stat
148+
return boot_t_stat

doubleml/plm/tests/_utils_pliv_partial_xz_manual.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,21 +124,18 @@ def pliv_partial_xz_orth(u_hat, v_hat, w_hat, d, score):
124124
def boot_pliv_partial_xz(y, d, z, thetas, ses, all_l_hat, all_m_hat, all_r_hat,
125125
all_smpls, score, bootstrap, n_rep_boot,
126126
n_rep=1):
127-
all_boot_theta = list()
128127
all_boot_t_stat = list()
129128
for i_rep in range(n_rep):
130129
n_obs = len(y)
131130
weights = draw_weights(bootstrap, n_rep_boot, n_obs)
132-
boot_theta, boot_t_stat = boot_pliv_partial_xz_single_split(
131+
boot_t_stat = boot_pliv_partial_xz_single_split(
133132
thetas[i_rep], y, d, z, all_l_hat[i_rep], all_m_hat[i_rep], all_r_hat[i_rep], all_smpls[i_rep],
134133
score, ses[i_rep], weights, n_rep_boot)
135-
all_boot_theta.append(boot_theta)
136134
all_boot_t_stat.append(boot_t_stat)
137135

138-
boot_theta = np.hstack(all_boot_theta)
139136
boot_t_stat = np.hstack(all_boot_t_stat)
140137

141-
return boot_theta, boot_t_stat
138+
return boot_t_stat
142139

143140

144141
def boot_pliv_partial_xz_single_split(theta, y, d, z, l_hat, m_hat, m_hat_tilde,
@@ -150,6 +147,6 @@ def boot_pliv_partial_xz_single_split(theta, y, d, z, l_hat, m_hat, m_hat_tilde,
150147

151148
psi = np.multiply(u_hat - w_hat*theta, v_hat)
152149

153-
boot_theta, boot_t_stat = boot_manual(psi, J, smpls, se, weights, n_rep_boot)
150+
boot_t_stat = boot_manual(psi, J, smpls, se, weights, n_rep_boot)
154151

155-
return boot_theta, boot_t_stat
152+
return boot_t_stat

doubleml/plm/tests/_utils_pliv_partial_z_manual.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,21 +86,18 @@ def pliv_partial_z_orth(r_hat, y, d, score):
8686
def boot_pliv_partial_z(y, d, z, thetas, ses, all_r_hat,
8787
all_smpls, score, bootstrap, n_rep_boot,
8888
n_rep=1):
89-
all_boot_theta = list()
9089
all_boot_t_stat = list()
9190
for i_rep in range(n_rep):
9291
n_obs = len(y)
9392
weights = draw_weights(bootstrap, n_rep_boot, n_obs)
94-
boot_theta, boot_t_stat = boot_pliv_partial_z_single_split(
93+
boot_t_stat = boot_pliv_partial_z_single_split(
9594
thetas[i_rep], y, d, z, all_r_hat[i_rep], all_smpls[i_rep],
9695
score, ses[i_rep], weights, n_rep_boot)
97-
all_boot_theta.append(boot_theta)
9896
all_boot_t_stat.append(boot_t_stat)
9997

100-
boot_theta = np.hstack(all_boot_theta)
10198
boot_t_stat = np.hstack(all_boot_t_stat)
10299

103-
return boot_theta, boot_t_stat
100+
return boot_t_stat
104101

105102

106103
def boot_pliv_partial_z_single_split(theta, y, d, z, r_hat,
@@ -112,6 +109,6 @@ def boot_pliv_partial_z_single_split(theta, y, d, z, r_hat,
112109

113110
psi = np.multiply(y - d*theta, r_hat_array)
114111

115-
boot_theta, boot_t_stat = boot_manual(psi, J, smpls, se, weights, n_rep_boot)
112+
boot_t_stat = boot_manual(psi, J, smpls, se, weights, n_rep_boot)
116113

117-
return boot_theta, boot_t_stat
114+
return boot_t_stat

doubleml/plm/tests/_utils_plr_manual.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ def plr_orth(y_minus_l_hat, d_minus_m_hat, y_minus_g_hat, d, score):
227227
def boot_plr(y, d, thetas, ses, all_l_hat, all_m_hat, all_g_hat,
228228
all_smpls, score, bootstrap, n_rep_boot,
229229
n_rep=1, apply_cross_fitting=True):
230-
all_boot_theta = list()
231230
all_boot_t_stat = list()
232231
for i_rep in range(n_rep):
233232
smpls = all_smpls[i_rep]
@@ -238,24 +237,21 @@ def boot_plr(y, d, thetas, ses, all_l_hat, all_m_hat, all_g_hat,
238237
n_obs = len(test_index)
239238
weights = draw_weights(bootstrap, n_rep_boot, n_obs)
240239

241-
boot_theta, boot_t_stat = boot_plr_single_split(
240+
boot_t_stat = boot_plr_single_split(
242241
thetas[i_rep], y, d, all_l_hat[i_rep], all_m_hat[i_rep], all_g_hat[i_rep], smpls,
243242
score, ses[i_rep],
244243
weights, n_rep_boot, apply_cross_fitting)
245-
all_boot_theta.append(boot_theta)
246244
all_boot_t_stat.append(boot_t_stat)
247245

248-
boot_theta = np.hstack(all_boot_theta)
249246
boot_t_stat = np.hstack(all_boot_t_stat)
250247

251-
return boot_theta, boot_t_stat
248+
return boot_t_stat
252249

253250

254251
def boot_plr_multitreat(y, d, thetas, ses, all_l_hat, all_m_hat, all_g_hat,
255252
all_smpls, score, bootstrap, n_rep_boot,
256253
n_rep=1, apply_cross_fitting=True):
257254
n_d = d.shape[1]
258-
all_boot_theta = list()
259255
all_boot_t_stat = list()
260256
for i_rep in range(n_rep):
261257
smpls = all_smpls[i_rep]
@@ -266,21 +262,18 @@ def boot_plr_multitreat(y, d, thetas, ses, all_l_hat, all_m_hat, all_g_hat,
266262
n_obs = len(test_index)
267263
weights = draw_weights(bootstrap, n_rep_boot, n_obs)
268264

269-
boot_theta = np.full((n_d, n_rep_boot), np.nan)
270265
boot_t_stat = np.full((n_d, n_rep_boot), np.nan)
271266
for i_d in range(n_d):
272-
boot_theta[i_d, :], boot_t_stat[i_d, :] = boot_plr_single_split(
267+
boot_t_stat[i_d, :] = boot_plr_single_split(
273268
thetas[i_rep][i_d], y, d[:, i_d],
274269
all_l_hat[i_rep][i_d], all_m_hat[i_rep][i_d], all_g_hat[i_rep][i_d],
275270
smpls, score, ses[i_rep][i_d],
276271
weights, n_rep_boot, apply_cross_fitting)
277-
all_boot_theta.append(boot_theta)
278272
all_boot_t_stat.append(boot_t_stat)
279273

280-
boot_theta = np.hstack(all_boot_theta)
281274
boot_t_stat = np.hstack(all_boot_t_stat)
282275

283-
return boot_theta, boot_t_stat
276+
return boot_t_stat
284277

285278

286279
def boot_plr_single_split(theta, y, d, l_hat, m_hat, g_hat,
@@ -307,9 +300,9 @@ def boot_plr_single_split(theta, y, d, l_hat, m_hat, g_hat,
307300
assert score == 'IV-type'
308301
psi = np.multiply(y_minus_g_hat - d * theta, d_minus_m_hat)
309302

310-
boot_theta, boot_t_stat = boot_manual(psi, J, smpls, se, weights, n_rep, apply_cross_fitting)
303+
boot_t_stat = boot_manual(psi, J, smpls, se, weights, n_rep, apply_cross_fitting)
311304

312-
return boot_theta, boot_t_stat
305+
return boot_t_stat
313306

314307

315308
def fit_sensitivity_elements_plr(y, d, all_coef, predictions, score, n_rep):

doubleml/plm/tests/test_pliv.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,14 @@ def dml_pliv_fixture(generate_data_iv, learner, score):
7979

8080
for bootstrap in boot_methods:
8181
np.random.seed(3141)
82-
boot_theta, boot_t_stat = boot_pliv(y, d, z, res_manual['thetas'], res_manual['ses'],
83-
res_manual['all_l_hat'], res_manual['all_m_hat'], res_manual['all_r_hat'],
84-
res_manual['all_g_hat'],
85-
all_smpls, score, bootstrap, n_rep_boot)
82+
boot_t_stat = boot_pliv(y, d, z, res_manual['thetas'], res_manual['ses'],
83+
res_manual['all_l_hat'], res_manual['all_m_hat'], res_manual['all_r_hat'],
84+
res_manual['all_g_hat'],
85+
all_smpls, score, bootstrap, n_rep_boot)
8686

8787
np.random.seed(3141)
8888
dml_pliv_obj.bootstrap(method=bootstrap, n_rep_boot=n_rep_boot)
89-
res_dict['boot_coef' + bootstrap] = dml_pliv_obj.boot_coef
9089
res_dict['boot_t_stat' + bootstrap] = dml_pliv_obj.boot_t_stat
91-
res_dict['boot_coef' + bootstrap + '_manual'] = boot_theta
9290
res_dict['boot_t_stat' + bootstrap + '_manual'] = boot_t_stat
9391

9492
return res_dict
@@ -111,9 +109,6 @@ def test_dml_pliv_se(dml_pliv_fixture):
111109
@pytest.mark.ci
112110
def test_dml_pliv_boot(dml_pliv_fixture):
113111
for bootstrap in dml_pliv_fixture['boot_methods']:
114-
assert np.allclose(dml_pliv_fixture['boot_coef' + bootstrap],
115-
dml_pliv_fixture['boot_coef' + bootstrap + '_manual'],
116-
rtol=1e-9, atol=1e-4)
117112
assert np.allclose(dml_pliv_fixture['boot_t_stat' + bootstrap],
118113
dml_pliv_fixture['boot_t_stat' + bootstrap + '_manual'],
119114
rtol=1e-9, atol=1e-4)

doubleml/plm/tests/test_pliv_partial_x.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,15 @@ def dml_pliv_partial_x_fixture(generate_data_pliv_partialX, learner, score):
6565

6666
for bootstrap in boot_methods:
6767
np.random.seed(3141)
68-
boot_theta, boot_t_stat = boot_pliv_partial_x(y, d, z, res_manual['thetas'], res_manual['ses'],
69-
res_manual['all_l_hat'], res_manual['all_m_hat'],
70-
res_manual['all_r_hat'],
71-
all_smpls, score, bootstrap, n_rep_boot)
68+
boot_t_stat = boot_pliv_partial_x(y, d, z, res_manual['thetas'], res_manual['ses'],
69+
res_manual['all_l_hat'], res_manual['all_m_hat'],
70+
res_manual['all_r_hat'],
71+
all_smpls, score, bootstrap, n_rep_boot)
7272

7373
np.random.seed(3141)
7474
dml_pliv_obj.bootstrap(method=bootstrap, n_rep_boot=n_rep_boot)
75-
res_dict['boot_coef' + bootstrap] = dml_pliv_obj.boot_coef
75+
7676
res_dict['boot_t_stat' + bootstrap] = dml_pliv_obj.boot_t_stat
77-
res_dict['boot_coef' + bootstrap + '_manual'] = boot_theta
7877
res_dict['boot_t_stat' + bootstrap + '_manual'] = boot_t_stat
7978

8079
return res_dict
@@ -94,9 +93,6 @@ def test_dml_pliv_se(dml_pliv_partial_x_fixture):
9493

9594
def test_dml_pliv_boot(dml_pliv_partial_x_fixture):
9695
for bootstrap in dml_pliv_partial_x_fixture['boot_methods']:
97-
assert np.allclose(dml_pliv_partial_x_fixture['boot_coef' + bootstrap],
98-
dml_pliv_partial_x_fixture['boot_coef' + bootstrap + '_manual'],
99-
rtol=1e-9, atol=1e-4)
10096
assert np.allclose(dml_pliv_partial_x_fixture['boot_t_stat' + bootstrap],
10197
dml_pliv_partial_x_fixture['boot_t_stat' + bootstrap + '_manual'],
10298
rtol=1e-9, atol=1e-4)

doubleml/plm/tests/test_pliv_partial_x_tune.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,16 +127,14 @@ def dml_pliv_partial_x_fixture(generate_data_pliv_partialX, learner_l, learner_m
127127

128128
for bootstrap in boot_methods:
129129
np.random.seed(3141)
130-
boot_theta, boot_t_stat = boot_pliv_partial_x(y, d, z, res_manual['thetas'], res_manual['ses'],
131-
res_manual['all_l_hat'], res_manual['all_m_hat'],
132-
res_manual['all_r_hat'],
133-
all_smpls, score, bootstrap, n_rep_boot)
130+
boot_t_stat = boot_pliv_partial_x(y, d, z, res_manual['thetas'], res_manual['ses'],
131+
res_manual['all_l_hat'], res_manual['all_m_hat'],
132+
res_manual['all_r_hat'],
133+
all_smpls, score, bootstrap, n_rep_boot)
134134

135135
np.random.seed(3141)
136136
dml_pliv_obj.bootstrap(method=bootstrap, n_rep_boot=n_rep_boot)
137-
res_dict['boot_coef' + bootstrap] = dml_pliv_obj.boot_coef
138137
res_dict['boot_t_stat' + bootstrap] = dml_pliv_obj.boot_t_stat
139-
res_dict['boot_coef' + bootstrap + '_manual'] = boot_theta
140138
res_dict['boot_t_stat' + bootstrap + '_manual'] = boot_t_stat
141139

142140
return res_dict
@@ -156,9 +154,6 @@ def test_dml_pliv_se(dml_pliv_partial_x_fixture):
156154

157155
def test_dml_pliv_boot(dml_pliv_partial_x_fixture):
158156
for bootstrap in dml_pliv_partial_x_fixture['boot_methods']:
159-
assert np.allclose(dml_pliv_partial_x_fixture['boot_coef' + bootstrap],
160-
dml_pliv_partial_x_fixture['boot_coef' + bootstrap + '_manual'],
161-
rtol=1e-9, atol=1e-4)
162157
assert np.allclose(dml_pliv_partial_x_fixture['boot_t_stat' + bootstrap],
163158
dml_pliv_partial_x_fixture['boot_t_stat' + bootstrap + '_manual'],
164159
rtol=1e-9, atol=1e-4)

doubleml/plm/tests/test_pliv_partial_xz.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,14 @@ def dml_pliv_partial_xz_fixture(generate_data_pliv_partialXZ, learner, score):
6565

6666
for bootstrap in boot_methods:
6767
np.random.seed(3141)
68-
boot_theta, boot_t_stat = boot_pliv_partial_xz(y, d, z, res_manual['thetas'], res_manual['ses'],
69-
res_manual['all_l_hat'], res_manual['all_m_hat'],
70-
res_manual['all_r_hat'],
71-
all_smpls, score, bootstrap, n_rep_boot)
68+
boot_t_stat = boot_pliv_partial_xz(y, d, z, res_manual['thetas'], res_manual['ses'],
69+
res_manual['all_l_hat'], res_manual['all_m_hat'],
70+
res_manual['all_r_hat'],
71+
all_smpls, score, bootstrap, n_rep_boot)
7272

7373
np.random.seed(3141)
7474
dml_pliv_obj.bootstrap(method=bootstrap, n_rep_boot=n_rep_boot)
75-
res_dict['boot_coef' + bootstrap] = dml_pliv_obj.boot_coef
7675
res_dict['boot_t_stat' + bootstrap] = dml_pliv_obj.boot_t_stat
77-
res_dict['boot_coef' + bootstrap + '_manual'] = boot_theta
7876
res_dict['boot_t_stat' + bootstrap + '_manual'] = boot_t_stat
7977

8078
return res_dict
@@ -94,9 +92,6 @@ def test_dml_pliv_se(dml_pliv_partial_xz_fixture):
9492

9593
def test_dml_pliv_boot(dml_pliv_partial_xz_fixture):
9694
for bootstrap in dml_pliv_partial_xz_fixture['boot_methods']:
97-
assert np.allclose(dml_pliv_partial_xz_fixture['boot_coef' + bootstrap],
98-
dml_pliv_partial_xz_fixture['boot_coef' + bootstrap + '_manual'],
99-
rtol=1e-9, atol=1e-4)
10095
assert np.allclose(dml_pliv_partial_xz_fixture['boot_t_stat' + bootstrap],
10196
dml_pliv_partial_xz_fixture['boot_t_stat' + bootstrap + '_manual'],
10297
rtol=1e-9, atol=1e-4)

doubleml/plm/tests/test_pliv_partial_xz_tune.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,16 +127,14 @@ def dml_pliv_partial_xz_fixture(generate_data_pliv_partialXZ, learner_l, learner
127127

128128
for bootstrap in boot_methods:
129129
np.random.seed(3141)
130-
boot_theta, boot_t_stat = boot_pliv_partial_xz(y, d, z, res_manual['thetas'], res_manual['ses'],
131-
res_manual['all_l_hat'], res_manual['all_m_hat'],
132-
res_manual['all_r_hat'],
133-
all_smpls, score, bootstrap, n_rep_boot)
130+
boot_t_stat = boot_pliv_partial_xz(y, d, z, res_manual['thetas'], res_manual['ses'],
131+
res_manual['all_l_hat'], res_manual['all_m_hat'],
132+
res_manual['all_r_hat'],
133+
all_smpls, score, bootstrap, n_rep_boot)
134134

135135
np.random.seed(3141)
136136
dml_pliv_obj.bootstrap(method=bootstrap, n_rep_boot=n_rep_boot)
137-
res_dict['boot_coef' + bootstrap] = dml_pliv_obj.boot_coef
138137
res_dict['boot_t_stat' + bootstrap] = dml_pliv_obj.boot_t_stat
139-
res_dict['boot_coef' + bootstrap + '_manual'] = boot_theta
140138
res_dict['boot_t_stat' + bootstrap + '_manual'] = boot_t_stat
141139

142140
return res_dict
@@ -156,9 +154,6 @@ def test_dml_pliv_se(dml_pliv_partial_xz_fixture):
156154

157155
def test_dml_pliv_boot(dml_pliv_partial_xz_fixture):
158156
for bootstrap in dml_pliv_partial_xz_fixture['boot_methods']:
159-
assert np.allclose(dml_pliv_partial_xz_fixture['boot_coef' + bootstrap],
160-
dml_pliv_partial_xz_fixture['boot_coef' + bootstrap + '_manual'],
161-
rtol=1e-9, atol=1e-4)
162157
assert np.allclose(dml_pliv_partial_xz_fixture['boot_t_stat' + bootstrap],
163158
dml_pliv_partial_xz_fixture['boot_t_stat' + bootstrap + '_manual'],
164159
rtol=1e-9, atol=1e-4)

doubleml/plm/tests/test_pliv_partial_z.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,13 @@ def dml_pliv_partial_z_fixture(generate_data_pliv_partialZ, learner, score):
6666

6767
for bootstrap in boot_methods:
6868
np.random.seed(3141)
69-
boot_theta, boot_t_stat = boot_pliv_partial_z(y, d, z, res_manual['thetas'], res_manual['ses'],
70-
res_manual['all_r_hat'],
71-
all_smpls, score, bootstrap, n_rep_boot)
69+
boot_t_stat = boot_pliv_partial_z(y, d, z, res_manual['thetas'], res_manual['ses'],
70+
res_manual['all_r_hat'],
71+
all_smpls, score, bootstrap, n_rep_boot)
7272

7373
np.random.seed(3141)
7474
dml_pliv_obj.bootstrap(method=bootstrap, n_rep_boot=n_rep_boot)
75-
res_dict['boot_coef' + bootstrap] = dml_pliv_obj.boot_coef
7675
res_dict['boot_t_stat' + bootstrap] = dml_pliv_obj.boot_t_stat
77-
res_dict['boot_coef' + bootstrap + '_manual'] = boot_theta
7876
res_dict['boot_t_stat' + bootstrap + '_manual'] = boot_t_stat
7977

8078
return res_dict
@@ -94,9 +92,6 @@ def test_dml_pliv_se(dml_pliv_partial_z_fixture):
9492

9593
def test_dml_pliv_boot(dml_pliv_partial_z_fixture):
9694
for bootstrap in dml_pliv_partial_z_fixture['boot_methods']:
97-
assert np.allclose(dml_pliv_partial_z_fixture['boot_coef' + bootstrap],
98-
dml_pliv_partial_z_fixture['boot_coef' + bootstrap + '_manual'],
99-
rtol=1e-9, atol=1e-4)
10095
assert np.allclose(dml_pliv_partial_z_fixture['boot_t_stat' + bootstrap],
10196
dml_pliv_partial_z_fixture['boot_t_stat' + bootstrap + '_manual'],
10297
rtol=1e-9, atol=1e-4)

0 commit comments

Comments
 (0)