Skip to content

Commit 1adb1fa

Browse files
fix bootstrap
1 parent ccf8c0d commit 1adb1fa

1 file changed

Lines changed: 15 additions & 18 deletions

File tree

src/frontend/fit/standard_errors/bootstrap.jl

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -160,27 +160,24 @@ function se_bootstrap(
160160
# pre-allocations
161161
total_sum = zero(start)
162162
total_squared_sum = zero(start)
163+
n_conv = Ref(0)
163164
# fit to bootstrap samples
164165
if !parallel
165166
for _ in 1:n_boot
166-
try
167-
sample_data = bootstrap_sample(data)
168-
new_model = replace_observed(
169-
fitted.model;
170-
data = sample_data,
171-
specification = specification,
172-
replace_kwargs...,
173-
)
174-
new_fit = fit(new_model; start_val = start, engine = engine, fit_kwargs...)
175-
sol = solution(new_fit)
176-
conv = converged(new_fit)
177-
if conv
178-
n_conv[] += 1
179-
@. total_sum += sol
180-
@. total_squared_sum += sol^2
181-
end
182-
catch
183-
n_failed[] += 1
167+
sample_data = bootstrap_sample(data)
168+
new_model = replace_observed(
169+
fitted.model;
170+
data = sample_data,
171+
specification = specification,
172+
replace_kwargs...,
173+
)
174+
new_fit = fit(new_model; start_val = start, engine = engine, fit_kwargs...)
175+
sol = solution(new_fit)
176+
conv = converged(new_fit)
177+
if conv
178+
n_conv[] += 1
179+
@. total_sum += sol
180+
@. total_squared_sum += sol^2
184181
end
185182
end
186183
else

0 commit comments

Comments
 (0)