Skip to content

Commit

Permalink
clean data earlier in qml and lms
Browse files Browse the repository at this point in the history
  • Loading branch information
Kss2k committed Jan 10, 2025
1 parent 4b03e57 commit ef8b3b2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions R/model_da.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ specifyModelDA <- function(syntax = NULL,
allIndsXis <- unique(unlist(indsXis))
numAllIndsXis <- length(allIndsXis)

# clean data
data <- cleanAndSortData(data, allIndsXis, allIndsEtas)

# measurement model x
listLambdaX <- constructLambda(xis, indsXis, parTable = parTable,
auto.constraints = auto.constraints)
Expand Down Expand Up @@ -222,6 +225,7 @@ specifyModelDA <- function(syntax = NULL,

model <- list(
info = list(
N = NROW(data),
xis = xis,
etas = etas,
numXis = numXis,
Expand All @@ -237,6 +241,7 @@ specifyModelDA <- function(syntax = NULL,
lavOptimizerSyntaxAdditions = lavOptimizerSyntaxAdditions
),

data = data,
quad = quad,
matrices = matrices,
labelMatrices = labelMatrices,
Expand All @@ -255,10 +260,8 @@ specifyModelDA <- function(syntax = NULL,
model$info$bounds <- getParamBounds(model, varParams=listTheta$diagFreeParams)
}

model$data <- cleanAndSortData(data, allIndsXis, allIndsEtas)
model$info$N <- NROW(model$data)

if (checkModel) checkModel(model = model, covModel = covModel, method = method)
if (checkModel)
checkModel(model = model, covModel = covModel, method = method)

model
}
Expand Down

0 comments on commit ef8b3b2

Please sign in to comment.