From ef8b3b234c05255bbfaba8b12e1ece8c460f463d Mon Sep 17 00:00:00 2001 From: kss2k Date: Fri, 10 Jan 2025 17:53:47 +0100 Subject: [PATCH] clean data earlier in qml and lms --- R/model_da.R | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/R/model_da.R b/R/model_da.R index d0e1b0b..75461a7 100644 --- a/R/model_da.R +++ b/R/model_da.R @@ -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) @@ -222,6 +225,7 @@ specifyModelDA <- function(syntax = NULL, model <- list( info = list( + N = NROW(data), xis = xis, etas = etas, numXis = numXis, @@ -237,6 +241,7 @@ specifyModelDA <- function(syntax = NULL, lavOptimizerSyntaxAdditions = lavOptimizerSyntaxAdditions ), + data = data, quad = quad, matrices = matrices, labelMatrices = labelMatrices, @@ -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 }