Thank you very much for your answers, Terrence and Stas.
Terrence, for your strategy I would naively try the following syntax (minimal working example below):
fit <- sem(path.model.structure,
sample.cov = cov.matrix,
NACOV=sample.size*acov.matrix
sample.nobs = sample.size)
summary(fit)
Here acov.matrix is the square of the matrix of estimated standard errors from the external model (I think this makes sense?)
Unfortunately it doesn't seem to matter what the value of acov.matrix is - lavaan's estimates of the standard errors remain the same. Am I making a very basic error? I'm not sure what format the ACOV matrix is meant to be in. I couldn't understand the lavaan documentation on this point.
Minimal working example:
library(lavaan)
lower <-'
1
0.02195847 0.106496
0.02449926 0.05205956 0.151877'
cov.matrix <-
getCov(lower, names = c("Z","M","R"))
acov.matrix.lower <-'
0.067
0.0036 0.00076
0.0051 0.00063 0.0015'
acov.matrix <-
getCov(acov.matrix.lower, names = c("Z","M","R"))
pathmodel <- 'Z~~varZ*Z
M~bMZ*Z
R~bRZ*Z+bRM*M'
fit <- sem(pathmodel,
sample.cov = cov.matrix,
NACOV=100*acov.matrix, #changing this does not change the output
sample.nobs = 100)
summary(fit)