Correlated residuals of manifest variables
Posted on

Hi,
Is anybody knows how to model correlated residuals of some manifest variables in OpenMx? Can you give me any example of mxPath()
application to this issue?
best regards,
Krzysztof
Here is something modified
Here is something modified from the Home page
require(OpenMx)
data(demoOneFactor)
manifests <- names(demoOneFactor)
latents <- c("G")
factorModel <- mxModel("One Factor",
type="RAM",
manifestVars = manifests,
latentVars = latents,
mxPath(from=latents, to=manifests),
mxPath(from=manifests, arrows=2, values=.4),
mxPath(from=latents, arrows=2,
free=FALSE, values=1.0),
mxPath(from=manifests[1], to=manifests[2],
free=TRUE, arrows=2, values=.3), # Added covariance between manifests[1] and manifests[2]
mxData(cov(demoOneFactor), type="cov",
numObs=500))
summary(mxRun(factorModel))
Log in or register to post comments
In reply to Here is something modified by mhunter
snap
☺
Log in or register to post comments
In reply to Here is something modified by mhunter
Still some doubts
Thank you very much! It seems to me, however, that the specified method reflects correlated manifest variables, not correlated error variance of manifests. Am I right?
Krzysiek
Log in or register to post comments
In reply to Still some doubts by krzysiek
see thread 1399 to see equivalence of manifest and residuals
HI Krzysiek,
This thread answers your question: It's an illuminating read about how identical functional specifications can nevertheless require different work for the optimiser
http://openmx.psyc.virginia.edu/thread/1399
Log in or register to post comments
In reply to see thread 1399 to see equivalence of manifest and residuals by tbates
Thank you!
Thank you for explanation!
Krzysiek
Log in or register to post comments
correlated residuals = mxPath(from = "var1", to = "var2")
This is easy in OpenMx: You just add paths between the variables you think have correlated residuals...
e.g., Here I add a correlation between x2 and x3 in the front-page example. it turns out to be a non-significant correlation:
require(OpenMx)
data(demoOneFactor)
manifests <- names(demoOneFactor)
latents <- c("G")
m1 <- mxModel("One Factor", type="RAM",
manifestVars = manifests,
latentVars = latents,
mxPath(from = latents, to = manifests),
mxPath(from = manifests, arrows = 2),
mxPath(from = latents, arrows = 2, values = 1),
mxData(cov(demoOneFactor), type = "cov", numObs = nrow(demoOneFactor))
)
m1 = mxRun(m1)
m2 = mxRun(mxModel(m1, mxPath("x2", "x3", arrows = 2, values=.01), name="correlated_X2_X3"))
mxCompare(m2, m1)
base comparison ep minus2LL df AIC diffLL diffdf p 12 -3649.803 3 -0.1389409 NA NA NA
1 correlated_X2_X3
2 correlated_X2_X3 One Factor 11 -3648.281 4 -0.6159977 1.522943 1 0.2171746
Log in or register to post comments