Skip to content

Commit

Permalink
[SAM] if orthogonal = TRUE, given warning (if sam.method = "local") a…
Browse files Browse the repository at this point in the history
…nd switch to global SAM
  • Loading branch information
yrosseel committed Oct 22, 2024
1 parent 503a1c5 commit b1f6c3e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: lavaan
Title: Latent Variable Analysis
Version: 0.6-20.2218
Version: 0.6-20.2219
Authors@R: c(person(given = "Yves", family = "Rosseel",
role = c("aut", "cre"),
email = "[email protected]",
Expand Down
6 changes: 3 additions & 3 deletions R/lav_syntax_parser_r.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ lav_local_msgcode <- function(isError, msgcode, msgpos, msgenv) {
assign("error", c(msgcode, msgpos), msgenv)
} else {
wrnnum <- 1L + get0("warncount", envir = msgenv, ifnotfound = 0L)
assign(paste0("warn", sprintf("%03d", wrnnum)),
assign(paste0("warn", sprintf("%03d", wrnnum)),
c(msgcode, msgpos - 1L), msgenv) # msgpos - 1L to align with C
assign("warncount", wrnnum, msgenv)
}
Expand Down Expand Up @@ -1042,9 +1042,9 @@ lav_parse_model_string_r <- function(model.syntax = "", as.data.frame. = FALSE)
warns <- list();
warncount <- get("warncount", envir = msgenv)
for (jj in seq.int(warncount)) {
warns = c(warns,
warns = c(warns,
list(get(paste0("warn", sprintf("%03d", jj)), envir = msgenv)))
}
}
attr(flat, "warns") <- warns
}
attr(flat, "modifiers") <- mod
Expand Down
11 changes: 11 additions & 0 deletions R/xxx_sam.R
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,24 @@ sam <- function(model = NULL,
"se= argument must be twostep, bootstrap, naive, standard or none."))
}

# check conditional.x= argument
if (!is.null(dotdotdot$conditional.x)) {
lav_msg_warn(gettext(
"sam() does not support conditional.x = TRUE (yet) -> switching to
conditional.x = FALSE"))
dotdotdot$conditional.x <- FALSE
}

# check orthogonal= argument
if (!is.null(dotdotdot$orthogonal) &&
dotdotdot$orthogonal &&
sam.method == "local") {
lav_msg_warn(gettext(
"local sam does not support orthogonal = TRUE -> switching to
global sam"))
sam.method <- "global"
}

###############################################
# STEP 0: process full model, without fitting #
###############################################
Expand Down

0 comments on commit b1f6c3e

Please sign in to comment.