Title: | Methods to Assess Generalized Latent Variable Model Fit |
Version: | 0.1.0 |
Description: | Provides residual global fit indices for generalized latent variable models. |
Encoding: | UTF-8 |
LazyData: | true |
License: | GPL-3 |
RoxygenNote: | 7.1.1 |
Imports: | methods |
Depends: | R (≥ 2.10) |
NeedsCompilation: | no |
Packaged: | 2021-08-05 01:37:59 UTC; tmatta |
Author: | Tyler Matta [aut, cre], Daniel McNeish [aut] |
Maintainer: | Tyler Matta <tyler.matta@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2021-08-06 05:00:19 UTC |
An S4 class to represent a residual fit indices.
Description
An S4 class to represent a residual fit indices.
Slots
type
A length-one numeric vector
resid
A length-one numeric vector
ssr
A length-one numeric vector
size
A length-one numeric vector
index
An S4 class to represent the set of residual fit indices
Description
An S4 class to represent the set of residual fit indices
Usage
details(object, comp = c("Total", "Covariance", "Variance", "Mean", "Total"))
## S4 method for signature 'ResidualFitIndices'
details(object, comp = c("Total", "Covariance", "Variance", "Mean", "Total"))
Arguments
object |
R object of type |
comp |
Character indicating the components to include. |
Slots
sampleMoments
impliedMoments
RMR
SRMR
CRMR
Note
comp
can be "Total" for overall fit indices, "Cov" for
covariance elements (off diagonals), "Var" for variance components (diagonal), and "Mean"
means.
glvmfit: Methods to Assess Generalized Latent Variable Model Fit
Description
Provides residual global fit indices for generalized latent variable models.
Subset of 221 children from the 1979 National Longitudinal Survey of Youth
Description
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.
Usage
nlsy
Format
A data frame with 221 rows and 14 variables:
- id
Unique identifier
- mom_age
Mother’s age when the child was born
- home_cog
Measure of cognitive stimulation provided at home
- home_emo
Measure of emotional support provided at home
- read0
PIAT reading score at wave 1
- read1
PIAT reading score at wave 2
- read2
PIAT reading score at wave 3
- read3
PIAT reading score at wave 4
- anti0
Antisocial behavior score at wave 1
- anti1
Antisocial behavior score at wave 2
- anti2
Antisocial behavior score at wave 3
- anti3
Antisocial behavior score at wave 4
Source
Residual fit indices
Description
Computes the RMR, SRMR, and CRMR.
Usage
resid_fit(
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 |
exo |
boolean argument indicating if model has exogenous covariates |
Value
An S4 object
Details
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
Examples
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)