Skip to content

Commit

Permalink
Merge pull request #397 from lucdw/master
Browse files Browse the repository at this point in the history
Small corrections and remove some unused local variables.
  • Loading branch information
yrosseel authored Nov 26, 2024
2 parents f496be9 + 5d5dc02 commit 4e01549
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 17 deletions.
1 change: 0 additions & 1 deletion R/lav_lavaan_step01_ovnames.R
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ lav_lavaan_step01_ovnames_initflat <- function(slotParTable = NULL, # nolint
} else {
bare.minimum <- c("lhs", "op", "rhs", "free")
missing.idx <- is.na(match(bare.minimum, names(model)))
missing.txt <- paste(bare.minimum[missing.idx], collapse = ", ")
lav_msg_stop(
gettextf("model is a list, but not a parameterTable?
missing column(s) in parameter table: [%s]",
Expand Down
2 changes: 1 addition & 1 deletion R/lav_lavaan_step02_options.R
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ lav_lavaan_step02_options <- function(slotOptions = NULL, # nolint
# clustered?
if (length(cluster) > 0L) {
opt$.clustered <- TRUE
if (opt$.categorical & opt$estimator != "PML") {
if (opt$.categorical && opt$estimator != "PML") {
lav_msg_stop(gettext("categorical + clustered is not supported yet."))
}
} else {
Expand Down
4 changes: 1 addition & 3 deletions R/lav_model_compute.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ computeSigmaHat <- function(lavmodel = NULL, GLIST = NULL, extra = FALSE,
if (is.null(GLIST)) GLIST <- lavmodel@GLIST

nmat <- lavmodel@nmat
nvar <- lavmodel@nvar
nblocks <- lavmodel@nblocks
representation <- lavmodel@representation

Expand Down Expand Up @@ -77,7 +76,6 @@ computeSigmaHatJoint <- function(lavmodel = NULL, GLIST = NULL, extra = FALSE,
if (is.null(GLIST)) GLIST <- lavmodel@GLIST

nmat <- lavmodel@nmat
nvar <- lavmodel@nvar
nblocks <- lavmodel@nblocks
representation <- lavmodel@representation

Expand All @@ -91,7 +89,7 @@ computeSigmaHatJoint <- function(lavmodel = NULL, GLIST = NULL, extra = FALSE,

if (representation == "LISREL") {
res.Sigma <- computeSigmaHat.LISREL(MLIST = MLIST, delta = delta)
res.int <- computeMuHat.LISREL(MLIST = MLIST)
# res.int <- computeMuHat.LISREL(MLIST = MLIST)
res.slopes <- computePI.LISREL(MLIST = MLIST)
S.xx <- MLIST$cov.x

Expand Down
10 changes: 5 additions & 5 deletions R/lav_model_information.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ lav_model_information <- function(lavmodel = NULL,
augmented = FALSE,
inverted = FALSE,
use.ginv = FALSE) {
if (.hasSlot(lavmodel, "estimator")) {
estimator <- lavmodel@estimator
} else {
estmator <- lavoptions$estimator
}
# if (.hasSlot(lavmodel, "estimator")) {
# estimator <- lavmodel@estimator
# } else {
# estmator <- lavoptions$estimator
# }
information <- lavoptions$information[1] # ALWAYS used the first one
# called can control it

Expand Down
8 changes: 4 additions & 4 deletions R/lav_model_objective.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ lav_model_objective <- function(lavmodel = NULL,
correlation <- FALSE
}
group.w.free <- lavmodel@group.w.free
fixed.x <- lavmodel@fixed.x
# fixed.x <- [email protected]
conditional.x <- lavmodel@conditional.x
num.idx <- lavmodel@num.idx
th.idx <- lavmodel@th.idx
Expand Down Expand Up @@ -90,9 +90,9 @@ lav_model_objective <- function(lavmodel = NULL,
)
# }

if (estimator == "REML") {
LAMBDA <- computeLAMBDA(lavmodel = lavmodel, GLIST = GLIST)
}
# if (estimator == "REML") {
# LAMBDA <- computeLAMBDA(lavmodel = lavmodel, GLIST = GLIST)
# }

# ridge?
if (lavsamplestats@ridge > 0.0) {
Expand Down
4 changes: 2 additions & 2 deletions R/lav_model_vcov.R
Original file line number Diff line number Diff line change
Expand Up @@ -434,9 +434,9 @@ lav_model_vcov <- function(lavmodel = NULL,
lavh1 = NULL,
use.ginv = FALSE) {
likelihood <- lavoptions$likelihood
information <- lavoptions$information[1] # first one is for vcov
# information <- lavoptions$information[1] # first one is for vcov
se <- lavoptions$se
mimic <- lavoptions$mimic
# mimic <- lavoptions$mimic

# special cases
if (se == "none" || se == "external" || se == "twostep") {
Expand Down
10 changes: 9 additions & 1 deletion R/xxx_lavaan.R
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,18 @@ lavaan <- function(
timing <- ldw_add_timing(timing, "init")

# ------------ ov.names 1 ----- initial flat model --------------------
# if parser not specified, take default one
if (is.null(dotdotdot$parser)) {
opt.default <- lav_options_default()
useparser <- opt.default$parser
} else {
useparser <- dotdotdot$parser
}

flat.model <- lav_lavaan_step01_ovnames_initflat(
slotParTable = slotParTable,
model = model,
dotdotdot.parser = dotdotdot$parser
dotdotdot.parser = useparser
)

# ------------ ov.names 2 ------ handle ov.order -----------------------
Expand Down

0 comments on commit 4e01549

Please sign in to comment.