mxStandardizeRAMpaths {OpenMx}R Documentation

Standardize RAM models' path coefficients


Provides a dataframe containing the standardized values of all nonzero path coefficients appearing in the A and S matrices of models that use RAM expectation (either of type="RAM" or containing an explicit mxExpectationRAM() statement). These standardized values are what the path coefficients would be if all variables in the analysis–both manifest and latent–were standardized to unit variance. Can optionally include asymptotic standard errors for those standardized coefficients, computed via the delta method. Not intended for use with models that contain definition variables.





An mxModel object, that either uses RAM expectation or contains at least one submodel that does.


Logical. Should standard errors be included with the standardized point estimates? Defaults to FALSE. Certain conditions are required for use of SE=TRUE; see "Details" below.


A repeated-sampling covariance matrix for the free-parameter estimates–say, from the robust "sandwich estimator," or from bootstrapping–used to calculate SEs for the standardized path coefficients. Defaults to NULL, in which case twice the inverse of the Hessian matrix at the ML solution is used. See below for details concerning concerning cases when model contains independent RAM submodels.


Matrix A contains the Asymmetric paths, i.e. the single-headed arrows. Matrix S contains the Symmetric paths, i.e. the double-headed arrows. The function will work even if mxMatrix objects named "A" and "S" are absent from the model, since it identifies which matrices in the model have been assigned the roles of A and S in the mxExpectationRAM statement. Note that, in models of type="RAM", the necessary matrices and expectation statement are automatically assembled from the mxPath objects.

If model contains any submodels with independent=TRUE that use RAM expectation, mxStandardizeRAMpaths() automatically applies itself recursively over those submodels. However, if a non-NULL matrix has been supplied for argument cov, that matrix is only used for the "container" model, and is not passed as argument to the recursive calls of the function. To provide a covariance matrix for calculating SEs in an independent submodel, use mxStandardizeRAMpaths() directly on that submodel.

Use of SE=TRUE requires that package numDeriv be installed. It also requires that model contain no mxConstraint statements. Finally, if cov=NULL, it requires model to have a nonempty hessian element in its output slot. There are three common reasons why the latter condition may not be met. First, the model may not have been run yet, i.e. it was not output by mxRun(). Second, mxOption "Hessian" might be set to "No". Third, computing the Hessian matrix might possibly have been skipped per a user-defined mxCompute* statement (if any are present in the model). If model contains RAM-expectation submodels with independent=TRUE, these conditions are checked separately for each such submodel.

In any event, using these standard errors for hypothesis-testing or forming confidence intervals is not generally advised. Instead, it is considered best practice to conduct likelihood-ratio tests or compute likelihood-based confidence intervals (from mxCI()), as in examples below.

The user should note that mxStandardizeRAMpaths() only cares whether an element of A or S is nonzero, and not whether it is a fixed or free parameter. So, for instance, if the function is used on a model not yet run, any free parameters in A or S initialized at zero will not appear in the function's output.

The user is warned to interpret the output of mxStandardizeRAMpaths() cautiously if any elements of A or S depend upon "definition variables" (you have definition variables in your model if the labels of any MxPath or MxMatrix begin with "data."). Typically, either mxStandardizeRAMpaths()'s results will be valid only for the first row of the raw dataset (and any rows identical to it), or some of the standardized coefficients will be incorrectly reported as zero.


If argument model is a single-group model that uses RAM expecation, then mxStandardizeRAMpaths() returns a dataframe, with one row for each nonzero path coefficient in A and S, and with the following columns:


Character strings that uniquely identify each nonzero path coefficient in terms of the model name, the matrix ("A" or "S"), the row number, and the column number.


Character labels for those path coefficients that are labeled elements of an mxMatrix object, and NA for those that are not. Note that path coefficients having the same label (and therefore the same UNstandardized value) can have different standardized values, and therefore the same label may appear more than once in this dataframe.


Character strings of "A" or "S", depending on which matrix contains the given path coefficient.


Character. The rownames of the matrix containing each path coefficient; row numbers are used instead if the matrix has no rownames.


Character. The colnames of the matrix containing each path coefficient; column numbers are used instead if the matrix has no colnames.


Numeric values of the raw (i.e., UNstandardized) path coefficients.


Numeric values of the asymptotic standard errors of the raw path coefficients if if SE=TRUE, or NA otherwise.


Numeric values of the standardized path coefficients.


Numeric values of the asymptotic standard errors of the standardized path coefficients if SE=TRUE, or NA otherwise.

If model is a multi-group model containing at least one submodel with RAM expectation, then mxStandardizeRAMpaths() returns a list. The list has a number of elements equal to the number of submodels that either have RAM expectation or contain a submodel that does. List elements corresponding to RAM-expectation submodels contain a dataframe, as described above. List elements corresponding to "container" submodels are themselves lists, of the kind described here.

See Also



manifests <- names(demoOneFactor)
latents   <- c("G")
factorModel <- mxModel(model="One Factor", type="RAM",
      manifestVars = manifests,
      latentVars   = latents,
      mxPath(from=latents, to=manifests),
      mxPath(from=manifests, arrows=2, values=0.1),
      mxPath(from=latents, arrows=2,free=FALSE, values=1.0),
      mxData(cov(demoOneFactor), type="cov",numObs=500)
factorFit <-mxRun(factorModel)

## Likelihood ratio test of variable x1's factor loading:
factorModelNull <- omxSetParameters(factorModel,labels="One Factor.A[1,6]",
factorFitNull <- mxRun(factorModelNull)
mxCompare(factorFit,factorFitNull)[2,"p"] #<--p-value

## Confidence intervals for all standardized paths:
factorModel2 <- mxModel(model=factorModel,
                        mxAlgebra( vec2diag(diag2vec( solve(I-A)%*%S%*%t(solve(I-A)) )%^%-0.5) ,
                        mxAlgebra( InvSD %*% A %*% solve(InvSD),
                        mxAlgebra( InvSD %*% S %*% InvSD, 
## Not run: 
factorFit2 <- mxRun(factorModel2,intervals=TRUE)
## Contains point values and confidence limits for all paths:

## End(Not run)

[Package OpenMx version 2.7.16 Index]