simsem (version 0.2-8)

simSetCFA: Create a set of matrices of parameter and parameter values to generate and analyze data that belongs to CFA model.


This function will create set of matrices of free parameters and parameter values that belongs to confirmatory factor analysis. The requirement is to specify factor loading matrix, factor correlation (or covariance) matrix, and error correlation (or covariance) matrix.




Each element of model specification, as described in Details


  • SimSet object that represents the CFA object. This will be used for specifying data or analysis models later.


NOTE: CFA object can be either specified in X or Y side.
  • LXorLYfor factor loading matrix (need to beSimMatrixobject).
  • TDorTEfor measurement error covariance matrix (need to beSymMatrixobject).
  • RTDorRTEfor measurement error correlation matrix (need to beSymMatrixobject).
  • PHorPSfor factor covariance matrix (need to beSymMatrixobject).
  • RPHorRPSfor factor correlation matrix (need to beSymMatrixobject).
  • VTDorVTEfor measurement error variance (need to beSimVectorobject).
  • VXorVYfor total indicator variance (need to beSimVectorobject). NOTE: Either measurement error variance or indicator variance is specified. Both cannot be simultaneously specified.
  • VPH,VPS,VK, orVEfor factor total variance (need to beSimVectorobject). NOTE: These four objects will have different meanings insimSetSEMfunction.
  • TXorTYfor measurement intercepts (need to beSimVectorobject).
  • MXorMYfor overall indicator means (need to beSimVectorobject). NOTE: Either measurement intercept of indicator mean can be specified. Both cannot be specified simultaneously.
  • KA,AL,MK, orMEfor factor means (need to beSimVectorobject).
There are three required matrices: LY (or LX), RTE (RTD, TD, or TE), and RPS (RPH, PH, or PS). If users specify the correlation/variance format (instead of the covariance format), the default specifications are
  1. All indicator variances are equal to 1. Measurement error variances are automatically implied from total indicator variances.
  2. All measurement error variances are free parameters.
  3. All indicator means are equal to 0. Indicator intercepts are automatically implied from indicator means.
  4. All indicator intercepts are free parameters.
  5. All factor variances are equal to 1.
  6. All factor variances are fixed.
  7. All factor means are equal to 0.
  8. All factor means are fixed.

See Also

  • See classSimSetfor the set of matrices object details.
  • SeeSimMatrix,SymMatrix, orSimVectorfor input details.
  • UsesimSetPathto specify path analysis model and usesimSetSEMto specify full structural equation modeling.


Run this code
loading <- matrix(0, 6, 2)
loading[1:3, 1] <- NA
loading[4:6, 2] <- NA
loadingValues <- matrix(0, 6, 2)
loadingValues[1:3, 1] <- 0.7
loadingValues[4:6, 2] <- 0.7
LX <- simMatrix(loading, loadingValues)

latent.cor <- matrix(NA, 2, 2)
diag(latent.cor) <- 1
RPH <- symMatrix(latent.cor, 0.5)

error.cor <- matrix(0, 6, 6)
diag(error.cor) <- 1
RTD <- symMatrix(error.cor)

CFA.Model <- simSetCFA(LX = LX, RPH = RPH, RTD = RTD)

Run the code above in your browser using DataCamp Workspace