Skip to content

Removed duplicate parameters of lavaan models with equality constraints from plot.semtree - #97

Closed
manuelarnold wants to merge 2 commits into
brandmaier:masterfrom
manuelarnold:master
Closed

Removed duplicate parameters of lavaan models with equality constraints from plot.semtree#97
manuelarnold wants to merge 2 commits into
brandmaier:masterfrom
manuelarnold:master

Conversation

@manuelarnold

Copy link
Copy Markdown
Contributor

No description provided.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 722f9f1d27

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread R/plot.semtree.R
Comment on lines +33 to +36
if (inherits(x$model, "lavaan")) {
param <- x$params[!duplicated(names(x$params))]
param_names <- names(param)
param_values <- round(unique(param), digits = 3)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep parameter values aligned with names

Using unique(param) deduplicates by value, not by name, so in lavaan models where different parameters share the same estimate, param_values becomes shorter than param_names. This misaligns or drops entries in leaf_text because paste(param_names, "=", param_values) will recycle or truncate values, producing incorrect parameter/value pairs for terminal nodes. Using the already name-deduped param (e.g., unname(param)) avoids collapsing equal-valued parameters.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant