File tree Expand file tree Collapse file tree
src/frontend/fit/standard_errors Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ Return bootstrap samples for `statistic`.
1919- `n_boot`: number of boostrap samples
2020- `data`: data to sample from. Only needed if different than the data from `sem_fit`
2121- `specification`: a `ParameterTable` or `RAMMatrices` object passed to `replace_observed`.
22- Necessary for FIML models.
22+ Necessary for FIML / WLS models.
2323- `engine`: optimizer engine, passed to `fit`.
2424- `parallel`: if `true`, run bootstrap samples in parallel on all available threads.
2525 The number of threads is controlled by the `JULIA_NUM_THREADS` environment variable or
@@ -143,7 +143,7 @@ Return bootstrap standard errors.
143143- `n_boot`: number of boostrap samples
144144- `data`: data to sample from. Only needed if different than the data from `sem_fit`
145145- `specification`: a `ParameterTable` or `RAMMatrices` object passed to `replace_observed`.
146- Necessary for FIML models.
146+ Necessary for FIML / WLS models.
147147- `engine`: optimizer engine, passed to `fit`.
148148- `parallel`: if `true`, run bootstrap samples in parallel on all available threads.
149149 The number of threads is controlled by the `JULIA_NUM_THREADS` environment variable or
Original file line number Diff line number Diff line change @@ -136,13 +136,13 @@ function test_estimates(
136136 end
137137end
138138
139- function test_bootstrap (model_fit; n_boot = 500 )
139+ function test_bootstrap (model_fit, spec ; n_boot = 500 )
140140 # hessian and bootstrap se are close
141141 se_he = se_hessian (model_fit)
142- se_bs = se_bootstrap (model_fit; n_boot = n_boot)
142+ se_bs = se_bootstrap (model_fit; specification = spec, n_boot = n_boot)
143143 @test isapprox (se_bs, se_he, rtol = 0.2 )
144144 # se_bootstrap and bootstrap |> se are close
145- bs_samples = bootstrap (model_fit; n_boot = n_boot)
145+ bs_samples = bootstrap (model_fit; specification = spec, n_boot = n_boot)
146146 @test bs_samples[:n_converged ] > 0.95 * n_boot
147147 bs_samples = cat (bs_samples[:samples ][BitVector (bs_samples[:converged ])]. .. , dims = 2 )
148148 se_bs_2 = sqrt .(var (bs_samples, corrected = false , dims = 2 ))
Original file line number Diff line number Diff line change 8383 lav_col = :se ,
8484 lav_groups = Dict (:Pasteur => 1 , :Grant_White => 2 ),
8585 )
86- test_bootstrap (solution_ml)
86+ test_bootstrap (solution_ml, partable )
8787 smoketest_CI_z (solution_ml, partable)
8888
8989 solution_ml = fit (model_ml_multigroup2)
293293 lav_col = :se ,
294294 lav_groups = Dict (:Pasteur => 1 , :Grant_White => 2 ),
295295 )
296- test_bootstrap (solution_ls)
296+ test_bootstrap (solution_ls, partable )
297297 smoketest_CI_z (solution_ls, partable)
298298end
299299
@@ -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; n_boot = 500 )
415+ test_bootstrap (solution, partable_miss )
416416 smoketest_CI_z (solution, partable_miss)
417417
418418 solution = fit (semoptimizer, model_ml_multigroup2)
Original file line number Diff line number Diff line change 131131 lav_col = :se ,
132132 )
133133
134- test_bootstrap (solution_ml)
134+ test_bootstrap (solution_ml, partable )
135135 smoketest_CI_z (solution_ml, partable)
136136end
137137
161161 lav_col = :se ,
162162 )
163163
164- test_bootstrap (solution_ls)
164+ test_bootstrap (solution_ls, partable )
165165 smoketest_CI_z (solution_ls, partable)
166166end
167167
344344 lav_col = :se ,
345345 )
346346
347- test_bootstrap (solution_ml)
347+ test_bootstrap (solution_ml, partable_mean )
348348 smoketest_CI_z (solution_ml, partable_mean)
349349end
350350
373373 lav_col = :se ,
374374 )
375375
376- test_bootstrap (solution_ls)
376+ test_bootstrap (solution_ls, partable_mean )
377377 smoketest_CI_z (solution_ls, partable_mean)
378378end
379379
507507 lav_col = :se ,
508508 )
509509
510- test_bootstrap (solution_ml)
510+ test_bootstrap (solution_ml, partable_mean )
511511 smoketest_CI_z (solution_ml, partable_mean)
512512end
You can’t perform that action at this time.
0 commit comments