There's been some discussion among the beta testers to support setting a free parameter to a fixed parameter across an entire model, or setting a fixed parameter to a free parameter across an entire model. Here's a function in R that will accomplish the transformation. The 'model argument is a MxModel object. The 'labels' argument is a vector of parameter names. The 'free' argument is either a NA or a single TRUE or FALSE. The 'value' argument is either a NA or a single numeric value. If 'free' is not NA, then all the parameters with name 'labels' will have their free/fixed status changed to 'free'. If 'value' is not NA, then all the parameters with name 'labels' with have their starting values changed to 'value'.
setParameters <- function(model, labels, free = NA, value = NA) { if(missing(model) || !is(model, "MxModel")) { stop("The 'model' argument must be a MxModel object") } if(missing(labels) || typeof(labels) != "character") { stop("The 'labels' argument must be a vector of characters") } if(!is.na(free) && (typeof(free) != "logical" || length(free) != 1)) { stop("The 'free' argument must be a single boolean value") } if(!is.na(value) && (!is.numeric(value) || length(value) != 1)) { stop("The 'value' argument must be a single numeric value") } return(setParametersHelper(model, labels, free, value)) } setParametersHelper <- function(model, labels, free, value) { model@matrices <- lapply(model@matrices, setParametersMatrix, labels, free, value) model@submodels <- lapply(model@submodels, setParametersHelper, labels, free, value) return(model) } setParametersMatrix <- function(matrix, labels, free, value) { select <- apply(matrix@labels, c(1,2), function(x) {!is.na(x) && x %in% labels}) if (!is.na(free)) { matrix@free[select] <- free } if (!is.na(value)) { matrix@values[select] <- value } return(matrix) }