Learn R Programming

metaSEM (version 1.4.0)

checkRAM: Check the correctness of the RAM formulation

Description

It provides simple checks on the correctness of the RAM formulation.

Usage

checkRAM(Amatrix, Smatrix, cor.analysis=TRUE)

Value

It returns silently if no error has been detected; otherwise, it returns a warning message.

Arguments

Amatrix

An asymmetric matrix in the RAM specification with MxMatrix-class. If it is a matrix, it will be converted into MxMatrix-class by the as.mxMatrix function.

Smatrix

A symmetric matrix in the RAM specification with MxMatrix-class. If it is a matrix, it will be converted into MxMatrix-class by the as.mxMatrix function.

cor.analysis

Logical. Analysis of correlation or covariance structure. There are additional checks for cor.analysis=TRUE.

Author

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

See Also

as.mxMatrix, lavaan2RAM

Examples

Run this code
# \donttest{ 
## Digman97 example
model1 <- "## Factor loadings
           Alpha=~A+C+ES
           Beta=~E+I
           ## Factor correlation
           Alpha~~Beta"

RAM1 <- lavaan2RAM(model1, obs.variables=c("A","C","ES","E","I"),
                   A.notation="on", S.notation="with")
RAM1

## The model is okay.    
checkRAM(Amatrix=RAM1$A, Smatrix=RAM1$S)

## Hunter83 example    
model2 <- "## Regression paths
           Job_knowledge ~ A2J*Ability
           Work_sample ~ A2W*Ability + J2W*Job_knowledge
           Supervisor ~ J2S*Job_knowledge + W2S*Work_sample

           ## Fix the variance of Ability at 1
           Ability ~~ 1*Ability

           ## Label the error variances of the dependent variables
           Job_knowledge ~~ VarE_J*Job_knowledge
           Work_sample ~~ VarE_W*Work_sample
           Supervisor ~~ VarE_S*Supervisor"

RAM2 <- lavaan2RAM(model2, obs.variables=c("Ability","Job_knowledge",
                   "Work_sample","Supervisor"))

## The model is okay.     
checkRAM(Amatrix=RAM2$A, Smatrix=RAM2$S)   
# }

Run the code above in your browser using DataLab