Learn R Programming

metaSEM (version 1.5.0)

create.modMatrix: Create a moderator matrix used in OSMASEM

Description

It creates a moderator matrix used in OSMASEM.

Usage

create.modMatrix(RAM, output=c("A", "S"), mod)

Value

A character matrix.

Arguments

RAM

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

output

Whether the output is an "A" or "S" matrix.

mod

A string of moderator in the dataset.

Author

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

Examples

Run this code
## A multiple regression model
model <- "y ~ x1 + x2
          x1 ~~ 1*x1
          x2 ~~ 1*x2
          x1 ~~ x2"

## RAM specification
RAM <- lavaan2RAM(model, obs.variables=c("y", "x1", "x2"))

## Create a moderator matrix on A with "meanAge as the moderator.
A1 <-  create.modMatrix(RAM=RAM, output="A", mod="meanAge")
A1

## Create a moderator matrix on S with "meanAge as the moderator.
S1 <-  create.modMatrix(RAM=RAM, output="S", mod="meanAge")
S1

Run the code above in your browser using DataLab