Copyright © 2007-2017 The OpenMx Project
Wiki home page 
You add and remove paths from RAM models in OpenMx using mxPath()
The mxPath function creates MxPath objects, which are lists of paths describing the relationships between variables in a model using the RAM modeling approach (McArdle and MacDonald, 1984). Variables are referenced by name. These names need to be included in either the ‘manifestVar’ or ‘latentVar’ arguments to the mxModel containing the call to mxPath
Paths are specified as going from one variable (or set of variables) to another variable (or set of variables) using the ‘from’ and ‘to’ arguments, respectively.
Sets of variables may be input as a vector of variable names. i.e., from = c("varName1","varName2") to = c("varNameA","varNameB")
If the ‘all’ argument is FALSE, then paths are created going from each entry in the ‘from’ vector to the corresponding position in the ‘to’ vector. In the example above, with all= FALSE, two paths would be created: one from varName1 to varNameA, and a second from varName2 to varNameB. If all=TRUE, then paths will be created from each from item to each to item.
nb: If the ‘to’ and ‘from’ vectors are of different lengths when the ‘all’ argument is set to FALSE, the shorter vector is repeated as required to make the vectors of equal length.
The ‘free’ argument specifies whether the paths created by the mxPath function are free or fixed parameters. This argument may take either TRUE for free parameters, FALSE for fixed parameters, or a vector of TRUEs and FALSEs to be applied in order to the created paths.
The ‘arrows’ argument specifies the type of paths created. A value of 1 indicates a one-headed arrow (regression of the ‘to’ variable on the ‘from’ variable). The arrow points to the ‘to’ variable in a path diagram. A value of 2 indicates a two-headed arrow, representing a covariance or variance. If multiple paths are created in the same mxPath function, then the ‘arrows’ argument may take a vector of 1s and 2s to be applied to the set of created paths.
‘values’ is a numeric vectors containing the starting values of the created paths. ‘values’ gives a starting value for estimation. The ‘labels’ argument specifies the names of the resulting MxPath object. The ‘lbound’ and ‘ubound’ arguments specify lower and upper bounds for the created paths.
If ‘excludeself’ is TRUE, then paths are not modified in those cases when the ‘from’ and ‘to’ field are the same. These paths are untouched independent of the value of the ‘all’ argument, and independent of whether the call to the function mxModel is adding paths or removing paths.
mxPath(from, to = NA, all = FALSE, arrows = 1, free = TRUE, values = NA, labels = NA, lbound = NA, ubound = NA, excludeself = FALSE)
|from||character vector. these are the sources of the new paths.|
|to||character vector. these are the sinks of the new paths.|
|all||boolean value. If TRUE, then connect all sources to all sinks.|
|arrows||numeric value. Must be either 1 for single-headed or 2 for double-headed arrows.|
|free||boolean vector. Indicates whether paths are free or fixed.|
|values||numeric vector. The starting values of the parameters.|
|labels||character vector. The names of the paths.|
|lbound||numeric vector. The lower bounds of free parameters.|
|ubound||numeric vector. The upper bounds of free parameters.|
|excludeself||boolean value. Exclude any self paths.|
require(OpenMx) data(demoOneFactor) manifests <- names(demoOneFactor) latents <- c("G") factorModel <- 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) ) factorFit <-mxRun(factorModel) summary(factorFit)