If I add a newdata to get the predicted response variables from different values of my explanatory variables it gives me the exact same results as when I don't use a new dataset.
Can you provide a reproducible example?
The example on the package documentation uses latent variables but I don't have any, I don't know if it works only for them.
It does:
set.seed(123)
x <- rnorm(15)
dat <- data.frame(x = x, y = x + rnorm(15))
newdat <- data.frame(x = seq(-1, 1, 0.5), y = NA)
fit <- sem("y ~ x", data = dat)
lavPredictY(fit) # predictions for observed data
lavPredictY(fit, # predictions for new data
newdata = newdat)
Terrence D. Jorgensen
Assistant Professor, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam