You are here

mxRefModels does not work with inherited data

OpenMx models support inheriting data from a parent, but the mxRefModels function chokes on this.

require(OpenMx)
 
data(demoOneFactor)
latents  = c("G")
manifests = names(demoOneFactor)
 
m1 <- mxModel("model1", type = "RAM",
        manifestVars = manifests, latentVars = latents,
        mxPath(from = latents, to = manifests),
        mxPath(from = manifests, arrows = 2),
        mxPath(from = latents, arrows = 2, free = F, values = 1.0)
)
m2 <- mxModel("model2", type = "RAM",
        manifestVars = manifests, latentVars = latents,
        mxPath(from = latents, to = manifests),
        mxPath(from = manifests, arrows = 2),
        mxPath(from = latents, arrows = 2, free = F, values = 1.0)
)
 
m3 = mxModel("bob", m1, m2,
    mxData(cov(demoOneFactor), type = "cov", numObs = 500),
    mxFitFunctionMultigroup(c("model1.fitfunction","model2.fitfunction"))
)
 
m3r = mxRun(m3)
ref <- mxRefModels(m3r, run=TRUE)
#Error in generateReferenceModels(x$fitfunction, x) : 
#  Model 'model1' does not contain any data
Reporter: 
Created: 
Thu, 12/04/2014 - 13:09
Updated: 
Thu, 12/10/2015 - 17:25

Comments

Does anyone have a plausible use-case for this scenario? I thought it should work initially, but now it seems like nonsense. Multigroup models need their own data, and should not inherit it.

I convinced the team that this is nonsense. We're leaving it as is.