From 010b6da1b2a7490a57b234ab283f9dbbbdce62a4 Mon Sep 17 00:00:00 2001 From: Yves Rosseel Date: Thu, 14 Nov 2024 22:44:14 +0100 Subject: [PATCH] [SAM] se = "local" now also works with exogenous covariates/outcomes --- DESCRIPTION | 2 +- R/lav_sam_step1.R | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 6380ea08..02297b5c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: lavaan Title: Latent Variable Analysis -Version: 0.6-20.2231 +Version: 0.6-20.2232 Authors@R: c(person(given = "Yves", family = "Rosseel", role = c("aut", "cre"), email = "Yves.Rosseel@UGent.be", diff --git a/R/lav_sam_step1.R b/R/lav_sam_step1.R index 4a467196..cf6cff23 100644 --- a/R/lav_sam_step1.R +++ b/R/lav_sam_step1.R @@ -831,7 +831,8 @@ lav_sam_step1_local_jac <- function(STEP1 = NULL, FIT = NULL, } # keep only 'LAMBDA/THETA' parameters PT <- FIT@ParTable - ov.names <- lavdata@ov.names[[g]] + # only ov.names that are actually used in the measurement models + ov.names <- unique(unlist(lapply(STEP1$MM.FIT, lavNames, "ov"))) lambda.idx <- which(PT$op == "=~" & PT$free > 0L) theta.idx <- which(PT$op == "~~" & PT$free > 0L & PT$lhs %in% ov.names & PT$rhs %in% ov.names)