Set starting values
Posted on

Forums
I want to ask what exactly the purpose of setting the starting value in mxPath codes? And what the basic can we use to set it? Is it like trial and error? I set some values but it always generate the NaN value in standard error, so what should I do then? Thank you.
how to set starting values
This thread will likely help with explanations and some practical advice.
http://openmx.psyc.virginia.edu/thread/1366
you might want to explore the umx library, which has a umxSetValues() function which takes some "usually good enough" guesses at start values.
it's on github rather than cran at present so installing means
install.packages("devtools")
library("devtools")
devtools::install_github("tbates/umx")
library("umx")
# then have a look at
help(umxStart)
Log in or register to post comments
In reply to how to set starting values by tbates
umx error
Log in or register to post comments
In reply to umx error by icha
umxStart()
In general, I'd recommend reading Ryne's post on setting values and learning to do that directly as well as using utility helpers like this one...
require(OpenMx)
data(demoOneFactor)
require(OpenMx)
data(demoOneFactor)
latents = c("G")
manifests = names(demoOneFactor)
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 = F, values = 1.0),
mxData(cov(demoOneFactor), type = "cov", numObs = 500)
)
m1 = umxStart(m1) # some likely guess entered for model means, variances and covariances
# You can also set labels automatically:
umxGetParameters(m1) # Only "matrix address" labels: "One Factor.S[2,2]" "One Factor.S[3,3]"
m1 = umxLabel(m1)
umxGetParameters(m1, free = T) # now all labeled regularly "G_to_x1", "x4_with_x4", etc.
This is a shortcut to both using umxRun()
m1 = umxRun(m1, setLabels= T, setValues=T)
Log in or register to post comments