You are here

omxAssignFirstParameters

Primary tabs

Wiki home page

Usage

omxAssignFirstParameters(model, indep=F)

Arguments

model a MxModel object.
indep assign parameters to independent submodels.

Sometimes you may have a free parameter with two different starting values in your model, and it may be sufficient to arbitrarily select one of those starting values for optimization. OpenMx will not run a model until all instances of a free parameter have the same starting value. This function will assign starting values to the free parameters of a model. It will select an arbitrary current value (the "first" value it finds, where "first" is not defined) for each free parameter and use that value.

Basic Examples

require(OpenMx)
A     <- mxMatrix('Full', 3, 3, values = c(1:9), labels = c('a','b', NA), free = T, name = 'A')

A
# @labels
#      [,1] [,2] [,3]
# [1,] "a"  "a"  "a" 
# [2,] "b"  "b"  "b" 
# [3,] NA   NA   NA

# @values
#      [,1] [,2] [,3]
# [1,]    1    4    7
# [2,]    2    5    8
# [3,]    3    6    9

model <- mxModel(A, name = 'model')
model <- omxAssignFirstParameters(model)

# Note that all cells with the same label now have the same start value.

model@matrices$A

# @labels
#      [,1] [,2] [,3]
# [1,] "a"  "a"  "a" 
# [2,] "b"  "b"  "b" 
# [3,] NA   NA   NA  
# 
# @values
#      [,1] [,2] [,3]
# [1,]    1    1    1
# [2,]    2    2    2
# [3,]    3    6    9

See Also

omxGetParameters, omxSetParameters

Please add material here as you learn... If you have questions not answers, then add those here: That's how a wiki works.