Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small corrections and remove some unused local variables. #397

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <- [email protected]
fixed.x <- [email protected]
# fixed.x <- [email protected]
conditional.x <- [email protected]
num.idx <- [email protected]
th.idx <- [email protected]
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
Loading