Learn R Programming

symSEM (version 0.4)

impliedS: Compute a Symbolic Model-Implied Covariance/Correlation Matrix

Description

It computes a symbolic model-implied covariance (or correlation) matrix in SEM using the RAM specification inputs.

Usage

impliedS(RAM, corr = FALSE, replace.constraints = FALSE, convert = TRUE)

Value

A list of object with class implieS. It stores the A, S, and F matrices and the model implied covariance (or correlation) matrix and the vector of the means.

Arguments

RAM

A RAM object including a list of matrices of the model returned from lavaan2RAM

corr

Whether the model implied matrix is covariance (default) or correlation structure.

replace.constraints

Whether to replace the parameters with the constraints in the mxalgebras slot. Suppose the formula is para1==para2+para3, para1 will be replaced by para2+para3 if this argument is TRUE.

convert

Whether to convert random strings back to parameters. For internal use only. Users unlikely need to use this argument.

Author

Mike W.-L. Cheung <mikewlcheung@nus.edu.sg>

Examples

Run this code
if (FALSE) {

#### A mediation model
model1 <- "y ~ c*x + b*m
           m ~ a*x
           ## Means
           y ~ b0*1
           m ~ m0*1
           x ~ x0*1"

RAM1 <- metaSEM::lavaan2RAM(model1)

## Model-implied covariance matrix and mean structure
impliedS(RAM1, corr=FALSE)

## Model-implied correlation matrix
impliedS(RAM1, corr=TRUE)

#### A CFA model
model2 <- "f =~ x1 + x2 + x3 + x4
           ## Mean
           f ~ fmean*1"

RAM2 <- metaSEM::lavaan2RAM(model2)

## Model-implied covariance matrix
impliedS(RAM2, corr=FALSE)

## Model-implied correlation matrix
impliedS(RAM2, corr=TRUE)
}

Run the code above in your browser using DataLab