Closed LeonieHagitte closed 9 months ago
So, we have 12 observed variables in the measurement model, 4 latent variables, and 2 predictors, that is, matE should be 12x12 but it is 13x13. There seems to be an error when computing the number of manifest variables.
In your code,
manVars <- colnames(df4[,-c(2)])
nv <- length(manVars)
this removes only the second column of the dataset instead of removing the last two columns (which is the number of predictors). So this really should be:
manVars <- colnames(df4[,-c(13:14)])
nv <- length(manVars)
This is assuming that the predictors are really the last columns. If they are the first, then it should be -c(1:2)
, of course.
I hope this solves the problem :-)
Hm this doesnt solve the problem I think - but I will look into this today further.
It worked for me with simulated data. Could you please send me the real df4
data via a secure connection?
Of course - what would be a good way? Either way it should be the columns 2 and 3 that get excluded - because column 2 is the column for the mergeid and the third is the year of birth, which i already switched into an extra column( the first) displaying the age
maybe send via https://mpibox.mpib-berlin.mpg.de/accounts/login/?next=/ ?
I think it's best to not assume certain position of columns but really use their names to find them. I modified the code, such that the manifest names are hard-coded: https://github.com/LeonieHagitte/ShareSEM/commit/6079cae82b471e5a2c903aa475df1d8e23903f60
Fehler: The following error occurred while evaluating the subexpression 'Configural.matL %% Configural.matP %% t(Configural.matL) + Configural.matE' during the evaluation of 'matC' in model 'Configural' : nicht passende Arrays