You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just ran into some errors with the updated version of the lavScore function that sent me down a small rabbit hole :). According to the comments, the function was updated in version 0.5-17 to always use all cases - even those with missings. However, if I try to get the scores of a model with listwise deletion, I get an error:
library(lavaan)
model <- '
# latent variable definitions
ind60 =~ x1 + x2 + x3
dem60 =~ y1 + a*y2 + b*y3 + c*y4
dem65 =~ y5 + a*y6 + b*y7 + c*y8
# regressions
dem60 ~ ind60
dem65 ~ ind60 + dem60
'
PoliticalDemocracy_NA <- PoliticalDemocracy
PoliticalDemocracy_NA[1, "x3"] <- NA
# if there are missing data points, the scores function runs into errors.
fit <- sem(model,
data = PoliticalDemocracy_NA)
lavScores(fit)
# Error in t(X) - lavsamplestats@mean[[g]] %*% J : non-conformable arrays
This error occurs because all data points with missings have been removed from data X, but J is still based on the full sample size (see here).
Best,
Jannik
The text was updated successfully, but these errors were encountered:
Indeed. The code in lavScores() is very old, and needs to be revised. It did not follow up on changes that were made later. I will have a good look at this in the next days.
Hi,
I just ran into some errors with the updated version of the
lavScore
function that sent me down a small rabbit hole :). According to the comments, the function was updated in version 0.5-17 to always use all cases - even those with missings. However, if I try to get the scores of a model with listwise deletion, I get an error:This error occurs because all data points with missings have been removed from data X, but J is still based on the full sample size (see here).
Best,
Jannik
The text was updated successfully, but these errors were encountered: