Currently if the user calls omxSetParameters on a non existent label, they get no warning.
For instance
omxSetParameters (cholFit2, labels=c("im not there"), free = F, value = 0);
It would be nice if that caused an error, as it usually means the user has made a typo (bad because they now think they have freed or reduced their model but have not) or misunderstands what their model contains (worse, I guess :-) ).
This can be done by adding the following code to the function
if(!all(labels %in% names(omxGetParameters(model, indep)))){ stop("all elements of 'labels' must be present in model") }
If people think the current behavior is OK, perhaps add a new parameter "strict=F" or similar, to request an error when a label is found non existent.
Comments
#1
edit: this (below) is a feature creep request... so ignore it: The work around reads well enough
mxRename(omxSetParameters(fit1, labels=c("quad11"), free=F, value = 0), "newName")
(Very) often when one sets parameters, it is appropriate to give the new model which is returned its own new name.
Currently this looks like
It would be nice to add a parameter to omxSetParameters() so this is a 1 liner.
added as newName=NA, nothing existing will break
#2
Oops. I forgot to add this error checking before the 0.9.2 release. We're making a concerted effort to have no more code changes before the 1.0 release on Thursday. I promise I'll add this in for Openmx 1.0.1.
#3
Fixed in version 1.0.1.
#4
Automatically closed -- issue fixed for 2 weeks with no activity.