Skip to content

Commit fdca879

Browse files
increase tolerance for bootstrap test
1 parent aa62557 commit fdca879

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

test/examples/helper.jl

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,20 +136,27 @@ function test_estimates(
136136
end
137137
end
138138

139-
function test_bootstrap(model_fit, spec; compare_hessian = true, compare_bs = true, n_boot = 500)
139+
function test_bootstrap(
140+
model_fit,
141+
spec;
142+
compare_hessian = true,
143+
rtol_hessian = 0.2,
144+
compare_bs = true,
145+
rtol_bs = 0.1,
146+
n_boot = 500)
140147
se_bs = se_bootstrap(model_fit, spec; n_boot = n_boot)
141148
# hessian and bootstrap se are close
142149
if compare_hessian
143150
se_he = se_hessian(model_fit)
144-
@test isapprox(se_bs, se_he, rtol = 0.2)
151+
@test isapprox(se_bs, se_he, rtol = rtol_hessian)
145152
end
146153
# se_bootstrap and bootstrap |> se are close
147154
if compare_bs
148155
bs_samples = bootstrap(model_fit, spec; n_boot = n_boot)
149156
@test bs_samples[:n_converged] > 0.95*n_boot
150157
bs_samples = cat(bs_samples[:samples][BitVector(bs_samples[:converged])]..., dims = 2)
151158
se_bs_2 = sqrt.(var(bs_samples, corrected = false, dims = 2))
152-
@test isapprox(se_bs_2, se_bs, rtol = 0.1)
159+
@test isapprox(se_bs_2, se_bs, rtol = rtol_bs)
153160
end
154161
end
155162

test/examples/multigroup/build_models.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ end
8383
lav_col = :se,
8484
lav_groups = Dict(:Pasteur => 1, :Grant_White => 2),
8585
)
86-
test_bootstrap(solution_ml, partable)
86+
test_bootstrap(solution_ml, partable, rtol_hessian = 0.3)
8787
smoketest_CI_z(solution_ml, partable)
8888

8989
solution_ml = fit(model_ml_multigroup2)
@@ -412,7 +412,7 @@ if !isnothing(specification_miss_g1)
412412
lav_col = :se,
413413
lav_groups = Dict(:Pasteur => 1, :Grant_White => 2),
414414
)
415-
test_bootstrap(solution, partable_miss)
415+
test_bootstrap(solution, partable_miss, rtol_hessian = 0.3)
416416
smoketest_CI_z(solution, partable_miss)
417417

418418
solution = fit(semoptimizer, model_ml_multigroup2)

0 commit comments

Comments
 (0)