Skip to content

Instantly share code, notes, and snippets.

@tbates
Created June 27, 2014 14:12
Show Gist options
  • Save tbates/e62c6a53943a69f2a5ea to your computer and use it in GitHub Desktop.
Save tbates/e62c6a53943a69f2a5ea to your computer and use it in GitHub Desktop.
lbound = hard value?
data(myFADataRaw, package = "OpenMx")
latents = c("G")
manifests = names(myFADataRaw)
myFADataRaw = myFADataRaw[, manifests]
m1 <- mxModel("m1", type="RAM", manifestVars = manifests, latentVars = latents,
mxPath(from = latents, to = manifests, values = 0),
mxPath(from = manifests, arrows = 2), # manifest residuals
mxPath(from = latents, arrows = 2, free = F, values = 1), # latents fixed@1
mxData(cov(myFADataRaw, use = "complete"), type = "cov", numObs = nrow(myFADataRaw))
)
m1 = mxRun(m1)
summary(m1)$parameters[ ,c(1,5)]
m2 = mxModel(m1, name="bounded", mxPath(from = latents, to = manifests, values = 0, lbound = .1))
m2 = mxRun(m2)
summary(m2)$parameters[ ,c(1,5)]
@tbates
Copy link
Author

tbates commented Jun 27, 2014

just CSOLNP ignore

@mhunter1
Copy link

This is a CSOLNP bug.

add

cbind(summary(m2)$parameters[ ,c(1,5)], summary(m1)$parameters[ ,c(1,5)])

to the end

And try re-running with

mxOption(NULL, "Default optimizer", "NPSOL")

CSOLNP apparently does not yet move parameters inside their bounds before starting.

Cheers,
Mike Hunter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment