Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lavPredict warning / error when no latent variables #388

Open
karchjd opened this issue Oct 9, 2024 · 1 comment
Open

lavPredict warning / error when no latent variables #388

karchjd opened this issue Oct 9, 2024 · 1 comment

Comments

@karchjd
Copy link
Contributor

karchjd commented Oct 9, 2024

Very minor, but this

library(lavaan)
model <- 'x4 ~ x1'
fit <- cfa(model, data = HolzingerSwineford1939)
fscores <- lavPredict(fit)

results in a matrix with 301 rows and 0 columns. I would suggest that this should result in an error or at least in a warning. So, error or warning for lavPredict if model contains no latent variables.

@yrosseel
Copy link
Owner

I opted for a warning:

Warning message: lavaan->lavPredict(): fitted model does not contain regular (i.e., measured) latent variables; the matrix of factor scores may contain no columns

But I would still return an empty (Nx0) matrix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants