Convergence, bootstrap, p-values#316
Conversation
|
@alyst this is a relatively big PR - would you like to review it before I merge? |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
|
@Maximilian-Stefan-Ernst Please proceed as you planned, I think these are nice changes. As I have mentioned before, I am finishing preparing the PR that potentially enhances the support for multi-group and "multi-regularization" SEMs. Because of those changes, I also have to update |
…bserved, fix bs + tests
| ) | ||
| ``` | ||
| """ | ||
| function se_bootstrap( |
There was a problem hiding this comment.
It should be possible to make se_bootstrap() a wrapper around bootstrap()
| put!(model_pool, thread_model) | ||
| end | ||
| end | ||
| return Dict( |
There was a problem hiding this comment.
I think it's better to use NamedTuple here.
Also, while it might be fragile to use Base.return_types() to infer the result of statistic() before it is called, here it should be in principle possible to use T = mapreduce(typeof, promote_type, out) and Vector{T}(out) to help with the type inference and faster code generation downstream.
There was a problem hiding this comment.
I agree in principle that the NamedTuple is better, but I will keep the Dict for now because it has a much nicer console output that is actually humanly readable. Nice idea to fix the type, curiously collect(a for a in out) seems to be faster by quite a margin.
There was a problem hiding this comment.
Since bootstrap() will be the generic method to calculate different statistics, it would be nice to make its result play nicely with the type inference in its callers. NamedTuple is just an ad hoc way to achieve it. If pretty printing is a concern, it could be its own type SemBootstrapResult{T}, and SEM.jl may rely on e.g. PrettyPrinting.jl to quickly implement Base.show(io, bootstrap::SemBootstrapResult) = pprint(bootstrap)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
convergedforSemFitobjectsconvergedreturns whether the model is converged in generalconvergencereturns the convergence flags and can be used to inspect why the model converged (or not)parallel = truebootstrapfunction that can be used to boostrap any statistic that can be extracted from a fitted modelz_testto compute p-values for individual parametersnormal_CIto compute a normal theory confidence interval