Skip to content

Commit 71bd3ba

Browse files
author
Alexey Stukalov
committed
param_indices(spec) method
1 parent 6c623ab commit 71bd3ba

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/frontend/specification/documentation.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ Return the vector of parameter labels (in the same order as [`params`](@ref)).
3737
"""
3838
param_labels(spec::SemSpecification) = spec.param_labels
3939

40+
"""
41+
param_indices(spec::SemSpecification, params::AbstractVector{Symbol}) -> Vector{Int}
42+
43+
Convert parameter labels to their indices in the SEM specification.
44+
"""
45+
function param_indices(spec::SemSpecification, params::AbstractVector{Symbol})
46+
param_map = Dict(param => i for (i, param) in enumerate(SEM.params(spec)))
47+
return [param_map[param] for param in params]
48+
end
49+
4050
"""
4151
`ParameterTable`s contain the specification of a structural equation model.
4252

0 commit comments

Comments
 (0)