File tree Expand file tree Collapse file tree
frontend/fit/standard_errors Expand file tree Collapse file tree Original file line number Diff line number Diff line change 251251# Fit one bootstrap replicate: resample, replace observed data, fit.
252252function _fit_bootstrap_sample (sem_model, data, start; engine, fit_kwargs)
253253 boot_data = resample_with_replacement (data)
254- boot_model = replace_observed (sem_model, boot_data)
254+ # we replace the observed data with the bootstrapped one,
255+ # but preserve any internal state that is associated with the original data
256+ boot_model = replace_observed (sem_model, boot_data; recompute_observed_state = true )
255257 return fit (boot_model; start_val = start, engine = engine, fit_kwargs... )
256258end
Original file line number Diff line number Diff line change @@ -185,13 +185,13 @@ end
185185function replace_observed (
186186 loss:: SemWLS ,
187187 new_observed:: SemObserved ;
188- update_internal_state :: Bool = true ,
188+ recompute_observed_state :: Bool = true ,
189189)
190- # recompute weight matrices only if update_internal_state =true
190+ # recompute weight matrices only if recompute_observed_state =true
191191 return SemWLS (
192192 new_observed,
193193 SEM. implied (loss);
194- wls_weight_matrix = update_internal_state ? nothing : loss. V,
195- wls_weight_matrix_mean = update_internal_state ? nothing : loss. V_μ,
194+ wls_weight_matrix = recompute_observed_state ? nothing : loss. V,
195+ wls_weight_matrix_mean = recompute_observed_state ? nothing : loss. V_μ,
196196 )
197197end
Original file line number Diff line number Diff line change 8989 new_data = randn (nsamples (obs), nobserved_vars (obs))
9090
9191 findiff_model_oldstate =
92- replace_observed (findiff_model, new_data; update_internal_state = false )
92+ replace_observed (findiff_model, new_data; recompute_observed_state = false )
9393 findiff_model_newstate =
94- replace_observed (findiff_model, new_data; update_internal_state = true )
94+ replace_observed (findiff_model, new_data; recompute_observed_state = true )
9595
9696 loss_orig = SEM. _unwrap (sem_term (findiff_model))
9797 loss_oldstate = SEM. _unwrap (sem_term (findiff_model_oldstate))
You can’t perform that action at this time.
0 commit comments