Learn R Programming

glvmfit (version 0.0.0)

srmr: Standardized Root Mean Residual

Description

Computes the square root of the discrepancy between the sample covariance and mean and the model-implied covariance and mean.

Usage

srmr(
  S = NULL,
  Sigma = NULL,
  ybar = NULL,
  mu = NULL,
  lavaan_object = NULL,
  exo = TRUE
)

Arguments

S

sample covariance matrix

Sigma

model-implied covariance matrix

ybar

sample mean vector

mu

model-implied mean vector

lavaan_object

is a fitted model of class lavaan

exo

boolean argument indicating if model has exogenous covariates

Value

A list including the SRMR component names, sum of squared resdiauls for each component, and the SRMR for each component.

Details

S, Sigma, ybar, and mu must be of the same dimensions.

If the sum of the diagonal elements of S equal 1 such that S is a correlation matrix, the variance component of SRMR is not included

Examples

Run this code
# NOT RUN {
Sigma <- matrix(c(1.022, .550,  .622, .550, .928, .783, .622, .783, 1.150), 
                    nrow = 3)
S <- matrix(c(.770, .545, .515, .545, 1.003, .890, .515, .890, 1.211), 
            nrow = 3)
ybar <- c(2.516, 4.041, 5.021)
mu <- c(2.825, 3.877, 4.929)

srmr(S = S,  Sigma = Sigma, ybar = ybar, mu = mu)

# }

Run the code above in your browser using DataLab