create.modMatrix: Create a moderator matrix used in OSMASEM

View source: R/create.modMatrix.R

create.modMatrixR Documentation

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)

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.

Value

A character matrix.

Author(s)

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

Examples

## 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

metaSEM documentation built on Sept. 30, 2024, 9:21 a.m.