How to predict factor scores in Lavaan In doing a CFA in Lavaan, I had to use the covariance matrix as an input because I was getting some errors with the original data e.g., negative variances.
I would normally have predicted factor scores using the predict() function, lavPredict functions the same, but now that I'm using the covariance matrix it's not possible to do this directly. 
Is there a way to use the information from the CFA to calculate factor scores in the same way as Lavaan does it? I believe the predict() function uses the method of regression to calculate factor scores. 
This is sample code to produce factor scores with raw data as input. 
Using this method I get an error in one of my variances:
library(lavaan)

model1 = '
Latent1 =~ X1 + X2
Latent2 =~ X3 + X4 + X5
Latent3 =~ X6 + X7
'

model1.fit = cfa(model1, data=mydata) #fit Lavaan model

predict(model1.fit) #Predict factor scores (method of regression)

This is the code to produce factor scores with covariance matrix as input. There are no error messages here, but I can't produce factor scores as there is not data to link them to:
cov = cor2cov(cor,std) #(using cor2cov function to create covariance matrix out of correlation table (cor) and standard deviations (std))

model2 = '
Latent1 =~ X1+ X2
Latent2 =~ X3 + X4 + X5
Latent3 =~ X6 + X7
'

model2.fit = cfa(model=model2, sample.cov=cov,sample.nobs=102,std.lv=FALSE)

How to proceed from here to produce factor scores using the results from Lavaan's CFA analysis?
 A: A solution to this problem, can be to use the covariance matrix together with the mean and std devitation to create a simulation of the data. Then after testing that the simulated data follows your assumptions, you could run the analysis.
I have done this, to replicate papers that did not share their data.
I would do the following...
# Set your means and stddev
mu <- c(4.23, 3.01, 2.91)
stddev <- c(1.23, 0.92, 1.32)

Then get your correlation matrix and you will be able to get your covariance.
corMat <- matrix(c(1, 0.78, 0.23,
                   0.78, 1, 0.27,
                   0.23, 0.27, 1),
                 ncol = 3)
corMat


#Create the covariance matrix:
covMat <- stddev %*% t(stddev) * corMat
covMat



Now i will use MASS library to cast the mvrnorm function...
set.seed(1)
library(MASS)
dat1 <- mvrnorm(n = 1000, mu = mu, Sigma = covMat, empirical = FALSE)

Finally, you can use this to check if what you have done makes sense
colMeans(dat1)
cor(dat1)

If you are comfortable with this synthetic data, the next step will be to run your simulation.
I hope it helps someone!
Best,
J
