You are here

Set starting values

4 posts / 0 new
Last post
icha's picture
Offline
Joined: 03/13/2014 - 03:54
Set starting values

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.

tbates's picture
Offline
Joined: 07/31/2009 - 14:25
how to set starting values

hi icha,

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)
icha's picture
Offline
Joined: 03/13/2014 - 03:54
umx error

I've installed devtools package and also umx package but when I run help(umxSetValues) I've got an error,why? And I want to ask what makes the standar error NaN? Is it just based on the starting values? I've tried some starting values and it always result the NaN values in my standar error.Thankyou

tbates's picture
Offline
Joined: 07/31/2009 - 14:25
umxStart()

Sorry, spoke without code :-) Here's a working example from the umx help

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)