Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/src/tutorials/constraints/constraints.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ As you can see, the optimizer converged (`:XTOL_REACHED`) and investigating the
update_partable!(
partable,
:estimate_constr,
param_labels(model_fit_constrained),
model_fit_constrained,
solution(model_fit_constrained),
)

Expand Down
4 changes: 2 additions & 2 deletions docs/src/tutorials/inspection/inspection.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ We can also update the `ParameterTable` object with other information via [`upda
se_bs = se_bootstrap(model_fit; n_boot = 20)
se_he = se_hessian(model_fit)

update_partable!(partable, :se_hessian, param_labels(model_fit), se_he)
update_partable!(partable, :se_bootstrap, param_labels(model_fit), se_bs)
update_partable!(partable, :se_hessian, model_fit, se_he)
update_partable!(partable, :se_bootstrap, model_fit, se_bs)

details(partable)
```
Expand Down
4 changes: 2 additions & 2 deletions docs/src/tutorials/regularization/regularization.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ sem_fit = fit(model)

update_estimate!(partable, sem_fit)

update_partable!(partable, :estimate_lasso, param_labels(fit_lasso), solution(fit_lasso))
update_partable!(partable, :estimate_lasso, fit_lasso, solution(fit_lasso))

details(partable)
```
Expand Down Expand Up @@ -167,7 +167,7 @@ fit_mixed = fit(model_mixed; engine = :Proximal, operator_g = prox_operator)
Let's again compare the different results:

```@example reg
update_partable!(partable, :estimate_mixed, param_labels(fit_mixed), solution(fit_mixed))
update_partable!(partable, :estimate_mixed, fit_mixed, solution(fit_mixed))

details(partable)
```
25 changes: 18 additions & 7 deletions src/frontend/specification/ParameterTable.jl
Original file line number Diff line number Diff line change
Expand Up @@ -288,14 +288,25 @@ function update_partable!(
end

"""
update_partable!(partable::AbstractParameterTable, param_labels::Vector{Symbol}, params, column)

Write parameter `values` into `column` of `partable`.

The `param_labels` and `params` vectors define the pairs of
parameters, which are being matched to the `:param` column
of the `partable`.
(1) update_partable!(partable::AbstractParameterTable, column, fitted:SemFit, params, default = nothing)

(2) update_partable!(partable::AbstractParameterTable, column, param_labels::Vector{Symbol}, params, default = nothing)

Add a new column to a parameter table.
`column` is the name of the column, `params` contains the values of the new column,
and `fitted` or `param_labels` is used to match the values to the correct parameter labels.
The `default` value is used if a parameter in `partable` does not occur in `param_labels`.
"""
function update_partable!(
partable::AbstractParameterTable,
column::Symbol,
fitted::SemFit,
params::AbstractVector,
default::Any = nothing,
)
update_partable!(partable, column, param_labels(fitted), params, default)
end

function update_partable!(
partable::ParameterTable,
column::Symbol,
Expand Down
Loading