The example in the ? file for omxAssignFirstParameters appears to do nothing to the values of A? Also, I wasn't quite sure what "Select one of the current values for each free parameter and use that value." meant...
A <- mxMatrix('Full', 3, 3, labels = c('a','b', NA), free = TRUE, name = 'A')
model <- mxModel(A, name = 'model')
model <- omxAssignFirstParameters(model);
model$A
@labels
[,1] [,2] [,3]
[1,] "a" "a" "a"
[2,] "b" "b" "b"
[3,] NA NA NA
@values
[,1] [,2] [,3]
[1,] 0 0 0
[2,] 0 0 0
[3,] 0 0 0
#1
A better example might be:
A <- mxMatrix('Full', 3, 1, labels = c('a','b', 'a'), values=c(1,2,3), free = TRUE, name = 'A')
model <- mxModel(A, name = 'model')
In this example, model$A[1,1] is labeled 'a' and has the starting value 1, while model$A[3,1] is labeled 'a' and has the starting value 3. If you use it like that, OpenMx will throw an error because the starting values aren't the same.
If you call:
model <- omxAssignFirstParameters(model)
it adjusts the starting values so that all values labeled 'a' have the same starting value. Free parameter 'b' is untouched, because it has starting values that are all equal.
So it selects one of the starting values assigned to a free parameter, and assigns that value to all the others occurrences of that free parameter.
Any thoughts on how to say this better?
Log in or register to post comments
#2
\description{
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.
}
and the example to:
\examples{
A <- mxMatrix('Full', 3, 3, values = c(1:9),
labels = c('a','b', NA), free = TRUE, name = 'A')
model <- mxModel(A, name = 'model')
model <- omxAssignFirstParameters(model)
}
sorry about that.
Log in or register to post comments
#3
Log in or register to post comments
#4
Log in or register to post comments
#5
Log in or register to post comments