Correlated residuals of manifest variables

Posted on
No user picture. krzysiek Joined: 09/05/2013

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

Replied on Thu, 09/05/2013 - 09:21
Picture of user. mhunter Joined: Jul 31, 2009

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))

Replied on Thu, 09/05/2013 - 09:23
Picture of user. tbates Joined: Jul 31, 2009

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
1 correlated_X2_X3 12 -3649.803 3 -0.1389409 NA NA NA
2 correlated_X2_X3 One Factor 11 -3648.281 4 -0.6159977 1.522943 1 0.2171746