You are here

Confidence Interval Reference search broken

See this minimal working example.

library(OpenMx)
data(demoOneFactor)
# ===============================
# = Make and run a 1-factor CFA =
# ===============================
 
latents  = c("G") # the latent factor
manifests = names(demoOneFactor) # manifest variables to be modeled
# ====================
# = Make the MxModel =
# ====================
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, free = FALSE, values = 1.0),
    mxData(cov(demoOneFactor), type = "cov", numObs = 500),
    mxCI("bob") # reference to entity not in model!
)
 
# ===============================
# = mxRun it and get a summary! =
# ===============================
 
m1 = mxRun(m1)
# Error in free[i, j] : subscript out of bounds
# should be unknown reference detected

See also, https://openmx.ssri.psu.edu/thread/4109

Reporter: 
Created: 
Tue, 03/08/2016 - 01:43
Updated: 
Tue, 03/08/2016 - 02:16

Comments

Fixed with https://github.com/OpenMx/OpenMx/commit/e5ac735731df7ea5b249b2734f22d895b2da2930

The memory-saving @free and @labels being 1x1 matrices broke the search for references in the confidence interval helper. It would try to search all the rows and columns of the full object even when the free and labels were only 1x1.

Instead of using the $, I could use the nrow and ncol of free. This would search faster.

Now using the non-$ search.

https://github.com/OpenMx/OpenMx/commit/9149eafaee070924102865ff31f6ceeeafee42a7