Learn R Programming

TAM (version 1.6-0)

cfa.extract.itempars: Extracting Item Parameters from a Fitted cfa Object

Description

This function extract item parameters from a fitted cfa (lavaan) object. It extract item loadings, item intercepts and the mean and covariance matrix of latent variables in a confirmatory factor analysis model.

Usage

cfa.extract.itempars(object)

Arguments

object
Fitted cfa object

Value

  • List with following entries
  • LMatrix of item loadings
  • nuVector of item intercepts
  • psiResidual covariance matrix
  • SigmaCovariance matrix of latent variables
  • nuVcetor of means of latent variables
  • ...Further values

See Also

See IRTLikelihood.cfa for extracting the individual likelihood from fitted confirmatory factor analyses. cfa (lavaan)

Examples

Run this code
#############################################################################
# EXAMPLE 1: CFA data.Students
#############################################################################

library(lavaan)
library(CDM)

data(data.Students, package="CDM")
dat <- data.Students

dat1 <- dat[ , paste0( "mj" , 1:4 ) ]

#*** Model 1: Unidimensional model scale mj
lavmodel <- "mj =~ mj1 + mj2 + mj3 + mj4
   mj ~~ mj
     "
mod1 <- lavaan::cfa( lavmodel , data=dat1 , std.lv=TRUE )
summary(mod1, standardized=TRUE , rsquare=TRUE )
# extract parameters
res1 <- cfa.extract.itempars( mod1 )

#*** Model 2: Scale mj - explicit modelling of item intercepts
lavmodel <- "mj =~ mj1 + mj2 + mj3 + mj4
   mj ~~ mj
   mj1 ~ 1
     "
mod2 <- lavaan::cfa( lavmodel , data=dat1 , std.lv=TRUE )
summary(mod2, standardized=TRUE , rsquare=TRUE )
res2 <- cfa.extract.itempars( mod2 )

#*** Model 3: Tau-parallel measurements scale mj
lavmodel <- "mj =~ a*mj1 + a*mj2 + a*mj3 + a*mj4
   mj ~~ 1*mj
   mj1 ~ b*1
   mj2 ~ b*1
   mj3 ~ b*1
   mj4 ~ b*1
     "
mod3 <- lavaan::cfa( lavmodel , data=dat1 , std.lv=TRUE )
summary(mod3, standardized=TRUE , rsquare=TRUE )
res3 <- cfa.extract.itempars( mod3 )

#*** Model 4: Two-dimensional CFA with scales mj and sc
dat2 <- dat[ , c(paste0("mj",1:4), paste0("sc",1:4)) ] 
# lavaan model with shortage "__" operator
lavmodel <- "mj =~ mj1__mj4
   sc =~ sc1__sc4
   mj ~~ sc
   mj ~~ 1*mj
   sc ~~ 1*sc
     "
lavmodel <- lavaanify.IRT( lavmodel , data=dat2 )$lavaan.syntax
cat(lavmodel)
mod4 <- lavaan::cfa( lavmodel , data=dat2 , std.lv=TRUE )
summary(mod4, standardized=TRUE , rsquare=TRUE )
res4 <- cfa.extract.itempars( mod4 )

Run the code above in your browser using DataLab