mxStandardizeRAMpaths {OpenMx} | R Documentation |
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.
mxStandardizeRAMpaths(model,SE=FALSE)
model |
An |
SE |
Logical. Should standard errors be included with the standardized point estimates? Defaults to |
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.
Use of SE=TRUE
requires that package numDeriv
be installed. It also requires that model
contain no mxConstraint
statements, and 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.
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:
name |
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. |
label |
Character labels for those path coefficients that are labeled elements of an |
matrix |
Character strings of "A" or "S", depending on which matrix contains the given path coefficient. |
row |
Character. The rownames of the matrix containing each path coefficient; row numbers are used instead if the matrix has no rownames. |
col |
Character. The colnames of the matrix containing each path coefficient; column numbers are used instead if the matrix has no colnames. |
Raw.Value |
Numeric values of the raw (i.e., UNstandardized) path coefficients. |
Raw.SE |
Numeric values of the asymptotic standard errors of the raw path coefficients if if |
Std.Value |
Numeric values of the standardized path coefficients. |
Std.SE |
Numeric values of the asymptotic standard errors of the standardized path coefficients if |
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.
library(OpenMx) data(demoOneFactor) 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) summary(factorFit)$parameters mxStandardizeRAMpaths(model=factorFit,SE=FALSE) ## Likelihood ratio test of variable x1's factor loading: factorModelNull <- omxSetParameters(factorModel,labels="One Factor.A[1,6]", values=0,free=FALSE) factorFitNull <- mxRun(factorModelNull) mxCompare(factorFit,factorFitNull)[2,"p"] #<--p-value ## Confidence intervals for all standardized paths: factorModel2 <- mxModel(model=factorModel, mxMatrix(type="Iden",nrow=nrow(factorModel$A),name="I"), mxAlgebra( vec2diag(diag2vec( solve(I-A)%*%S%*%t(solve(I-A)) )%^%-0.5) , name="InvSD"), mxAlgebra( InvSD %*% A %*% solve(InvSD), name="Az",dimnames=dimnames(factorModel$A)), mxAlgebra( InvSD %*% S %*% InvSD, name="Sz",dimnames=dimnames(factorModel$S)), mxCI(c("Az","Sz")) ) ## Not run: factorFit2 <- mxRun(factorModel2,intervals=TRUE) ## Contains point values and confidence limits for all paths: summary(factorFit2)$CI ## End(Not run)