| Title: | Methods to Assess Generalized Latent Variable Model Fit |
|---|---|
| Description: | Provides residual global fit indices for generalized latent variable models. |
| Authors: | Tyler Matta [aut, cre], Daniel McNeish [aut] |
| Maintainer: | Tyler Matta <[email protected]> |
| License: | GPL-3 |
| Version: | 0.1.0 |
| Built: | 2026-05-16 05:49:04 UTC |
| Source: | https://github.com/cran/glvmfit |
Provides residual global fit indices for generalized latent variable models.
These data are wave-based such that each child’s Peabody Individual Assessment Test (PIAT) reading and antisocial behavior scores were measured at four waves in two-year intervals.
nlsynlsy
A data frame with 221 rows and 14 variables:
Unique identifier
Mother’s age when the child was born
Measure of cognitive stimulation provided at home
Measure of emotional support provided at home
PIAT reading score at wave 1
PIAT reading score at wave 2
PIAT reading score at wave 3
PIAT reading score at wave 4
Antisocial behavior score at wave 1
Antisocial behavior score at wave 2
Antisocial behavior score at wave 3
Antisocial behavior score at wave 4
Computes the RMR, SRMR, and CRMR.
resid_fit( S = NULL, Sigma = NULL, ybar = NULL, mu = NULL, lavaan_object = NULL, exo = TRUE )resid_fit( S = NULL, Sigma = NULL, ybar = NULL, mu = NULL, lavaan_object = NULL, exo = TRUE )
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 |
exo |
boolean argument indicating if model has exogenous covariates |
An S4 object
S, Sigma, ybar, and mu must be of the same dimensions.
If the sum of the diagonal elements of S equals the sum of the diagonal elements of Sigma
the variance component of SRMR is not included
If the sum of the sample means yhat equals the sum of the model-implied means mu
the mean component of SRMR is not included
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) resid_fit(S = S, Sigma = Sigma, ybar = ybar, mu = mu)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) resid_fit(S = S, Sigma = Sigma, ybar = ybar, mu = mu)
An S4 class to represent a residual fit indices.
typeA length-one numeric vector
residA length-one numeric vector
ssrA length-one numeric vector
sizeA length-one numeric vector
indexAn S4 class to represent the set of residual fit indices
details(object, comp = c("Total", "Covariance", "Variance", "Mean", "Total")) ## S4 method for signature 'ResidualFitIndices' details(object, comp = c("Total", "Covariance", "Variance", "Mean", "Total"))details(object, comp = c("Total", "Covariance", "Variance", "Mean", "Total")) ## S4 method for signature 'ResidualFitIndices' details(object, comp = c("Total", "Covariance", "Variance", "Mean", "Total"))
object |
R object of type |
comp |
Character indicating the components to include. |
sampleMomentsimpliedMomentsRMRSRMRCRMRcomp can be "Total" for overall fit indices, "Cov" for
covariance elements (off diagonals), "Var" for variance components (diagonal), and "Mean"
means.