Skip to content

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

Merged
brandmaier merged 6 commits into
brandmaier:masterfrom
manuelarnold:master
Feb 16, 2026
Merged

Removed duplicate parameters of lavaan models with equality constraints from plot.semtree#98
brandmaier merged 6 commits into
brandmaier:masterfrom
manuelarnold:master

Conversation

@manuelarnold

Copy link
Copy Markdown
Contributor

Previously, plot.semtree showed duplicate parameters when used with lavaan models that include equality constraints. This patch removes those duplicates.

@manuelarnold

Copy link
Copy Markdown
Contributor Author

Here is a minimal example. The parameter rvar should appear three times in the plot, and this patch fixes that.

`
library(lavaan)
library(semtree)

d <- HolzingerSwineford1939
d$sex <- factor(d$sex)
d <- d[complete.cases(d), ]

m <- '
f =~ 1x1 + l2x2 + l3*x3

f ~~ f
x1 ~~ rvarx1
x2 ~~ rvar
x2
x3 ~~ rvar*x3

f ~ 0*1
x1 ~ 1
x2 ~ 1
x3 ~ 1
'

fit <- lavaan(model = m, data = d)

predictors <- c("sex")

ctrl <- semtree_control(method = "score")

tree <- semtree(model = fit, data = d, predictors = predictors, control = ctrl)

plot(tree)
`

…lihood estimation for handling missing data in lavaan models.
@brandmaier

Copy link
Copy Markdown
Owner

Thanks @manuelarnold , this is great!

@brandmaier
brandmaier merged commit ece1c6e into brandmaier:master Feb 16, 2026
2 of 3 checks passed
@brandmaier

Copy link
Copy Markdown
Owner

Also, for future PRs, please run a package check first to see whether the changes break CRAN-compatibility. I fixed the "lavaan:::coef" part to "lavaan::coef" because it created a warning.

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.

2 participants