Hi,
I'm learning to use OpenMx and have been working through some simple models. The estimates I get differ between matrix and path specification when I use the same data, and model. I also get different values for the same models depending on whether I use covariances or raw data for parameter estimates. Below are the path and matrix style specification that I have found to differ. Are the models different, or is expected that they will differ slightly? Are estimates expected to differ slightly between using covariances and raw data for estimation? Sorry if this is a really silly question.
j
p.s. what is the filter (identity?) matrix used for in the matrix model?
The models and data are straight out of OpenMx documentation;
data(myRegData)
names(myRegData)
simpleDataRaw<-myRegDataRaw[,c("x","y")]
myRegDataCov<-matrix(
c(0.808,-0.110, 0.089, 0.361,
-0.110, 1.116, 0.539, 0.289,
0.089, 0.539, 0.933, 0.312,
0.361, 0.289, 0.312, 0.836), nrow=4, dimnames=list(c("w","x","y","z"),
c("w","x","y","z"))
)
simpleDataCov<-myRegDataCov[c("x","y"),c("x","y")]
myRegDataMeans<-c(2.582, 0.054, 2.574, 4.061)
simpleDataMeans<-myRegDataMeans[c(2,3)]
## I will specify the model
require(OpenMx)
uniRegModel<-mxModel("simple regression path specification",
type="RAM",
mxData(observed=simpleDataRaw, type="raw"),
manifestVars=c("x","y"),
mxPath(from=c("x","y"), arrows=2, free=TRUE, values=c(1,1),
labels=c("varx","residual")),
mxPath(from="x", to="y", arrows=1, free=TRUE, values=1, labels="beta1"),
mxPath(from="one", to=c("x","y"), arrows=1, free=TRUE, values=c(1,1),
labels=c("meanx", "beta0"))
)
uniRegModelFit<-mxRun(uniRegModel)
uniRegModelFit@output
uniRegModelm<-mxModel("simple regression matrix specification",
mxData(observed=simpleDataRaw, type="raw"),
mxMatrix(type="Full", nrow=2, ncol=2, free=c(rep(F,4)),
values=c(0,0,1,0), labels=c(NA, NA,"beta1", NA),
byrow=TRUE, name="A"),
mxMatrix(type="Symm", nrow=2, ncol=2, values=c(1,0,0,1),
free=c(T,F,F,T), labels=c("varx", NA,NA, "residual"),
byrow=TRUE, name="S"),
mxMatrix(type="Iden", nrow=2, ncol=2, name="F", dimnames=list(
c("x","y"),c("x","y"))),
mxMatrix(type="Full", nrow=1, ncol=2, free=c(T,T), values=c(0,0),
labels=c("meanx","beta0"), name="M"),
mxRAMObjective("A","S","F","M"))
uniRegFitm<-mxRun(uniRegModelm)
uniRegFitm@output