JacobianRAM {symSEM}R Documentation

Compute a Jacobian Matrix of the Implied Covariance/Correlation Matrix based on a RAM model.

Description

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

Usage

JacobianRAM(RAM, vars, corr = FALSE)

Arguments

RAM

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

vars

A vector of characters of the random variables. If the random variables are not listed in 'vars', they are treated as constants. If 'vars' is missing, all names in 'RAM' are treated as random variables.

corr

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

Value

A Jacobian matrix.

Author(s)

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

Examples

## Not run: 

#### 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
JacobianRAM(RAM1, corr=FALSE)

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

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

RAM2 <- metaSEM::lavaan2RAM(model2)

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

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

## End(Not run)

[Package symSEM version 0.4 Index]