estimate_cfa: seminr estimate_cfa() function

View source: R/estimate_cbsem.R

estimate_cfaR Documentation

seminr estimate_cfa() function


Estimates a Confirmatory Factor Analysis (CFA) model


estimate_cfa(data, measurement_model = NULL, item_associations=NULL,
             model = NULL, lavaan_model = NULL, estimator="MLR", ...)



A dataframe containing the indicator measurement data.

The entire CBSEM model can be specified in one of three ways:

The pair of measurement and structural models, along associated items, can optionally be specified as separate model components


An optional measurement_model object representing the outer/measurement model, as generated by constructs. Note that only reflective constructs are supported for CBSEM models, though a composite measurement model can be converted into a reflective one using as.reflective.


An item-to-item matrix representing error covariances that are freed for estimation. This matrix is created by associations(), or defaults to NULL (no inter-item associations).

The combination of measurement and structural models and inter-item associations can also be specified as a single specified_model object Note that any given model components (measurement_model, structural_model, item_associations) will override components in the fully specified model


An optional specified_model object containing both the the outer/measurement and inner/structural models, along with any inter-item associations, as generated by specify_model.

The entire model can also be specified in Lavaan syntax (this overrides any other specifications)


Optionally, a single character string containing the relevant model specification in lavaan syntax.

Any further optional parameters to alter the estimation method:


A character string indicating which estimation method to use in Lavaan. It defaults to "MLR" for robust estimation. See the Lavaan documentation for other supported estimators.


Any other parameters to pass to lavaan::sem during estimation.


A list of the estimated parameters for the CFA model including:


A matrix of the data upon which the model was estimated.


The SEMinR measurement model specification.

construct scores

A matrix of the estimated construct scores for the CB-SEM model.


A matrix of the estimated CFA item weights.


The lavaan model syntax equivalent of the SEMinR model.


The raw lavaan output generated after model estimation.


Jöreskog, K.G. (1969) A general approach to confirmatory maximum likelihood factor analysis. Psychometrika, 34, 183-202.

See Also

constructs reflective associations item_errors as.reflective

#' @examples mobi <- mobi

#seminr syntax for creating measurement model mobi_mm <- constructs( reflective("Image", multi_items("IMAG", 1:5)), reflective("Expectation", multi_items("CUEX", 1:3)), reflective("Quality", multi_items("PERQ", 1:7)) )

#seminr syntax for freeing up item-item covariances mobi_am <- associations( item_errors(c("PERQ1", "PERQ2"), "CUEX3"), item_errors("IMAG1", "CUEX2") )

mobi_cfa <- estimate_cfa(mobi, mobi_mm, mobi_am)

seminr documentation built on Oct. 13, 2022, 1:05 a.m.