Hi all,
Just chiming in a little late because I am currently experiencing the same issue, and am suspecting that it has to do with the ordered() function.
I am using the data from example 1 from the '"Structural-After-Measurement" (SAM) approach to SEM'
paper by Rosseel & Loh (2022) and their
OSF page. I used the same model as given in the example and accompanying R script, which is as follows:
model <- '
# measurement part
ost =~ y1 + y2 + y3 + y4
self =~ x1 + x2 + x3
other =~ x4 + x5 + x6
# structural part
ost ~ b1*self + b2*other + c*sol + age + gender
self ~ a1*sol + age + gender
other ~ a2*sol + age + gender
# residual correlations
self ~~ other '
I used the same syntax for fitting the model, except that I specified the indicators as ordered (and removed the 'estimator = "ML"', since I expected the estimator to become "WLSMV"):
fit.lsam_o <- sam(model, data = Data, sam.method = "local", ordered = c("x1", "x2", "x3", "x4", "x5", "x6", "y1", "y2", "y3", "y4"))
summary(fit.lsam_o)
I receive the same error as Jesse: Error in Mg %*% COV : requires numeric/complex matrix/vector arguments
Changing the variable structure in the dataset to be ordered (using as.ordered), or simply specifying "ordered = TRUE" in the syntax, did not help. Running the model without the ordered() function does work. Omitting the ordered part in the syntax but setting the estimator to "WLSMV" does work — but I am not sure whether this really treats the indicators as categorical.
Although the Rosseel & Loh (2022) paper states that "we will focus on settings where all latent variables and their indicators are continuous", I wonder whether it might still be possible to run the model with ordered indicators? The study I will be running has Likert-scale items, which are ordinal. It would be great if it were possible to respect the ordinal nature of Likert-scale items while running a SAM.
Or is there perhaps another reason for this error that has nothing to do with the ordered() function?
Thanks very much in advance,
Kind regards,
Floor Burghoorn