Learn R Programming

DMAR (version 1.0.0)

cfa_2: Two Factor Confirmatory Factor Analysis Model

Description

Fits a two factor confirmatory factor analysis model to raw item data or a sample covariance matrix. This is the two factor special case of cfa_k: the function is a convenience wrapper that only requires the items of each factor, builds the two factor specification, and forwards everything else to cfa_k(). The factors are named f1 and f2, so the rows of the returned table are lambda_f1_1, lambda_f2_1, phi_f1_f2 (the factor correlation), omega_f1, omega_f2, and so on, exactly as a two factor cfa_k() call would report them (the syntax column names the item behind each number). To name the factors substantively, or for three or more factors, call cfa_k directly.

Usage

cfa_2(
  data = NULL,
  factor_1,
  factor_2,
  S = NULL,
  N = NULL,
  equal_loading = FALSE,
  equal_error = FALSE,
  correlated_factors = TRUE,
  estimator = "ML",
  missing = "listwise",
  se = "standard",
  conf_level = 0.95,
  output = c("verbose", "measurement", "summary", "standardized", "fit"),
  ...
)

Value

The value of the corresponding cfa_k call: a

data.frame (classes dmar_cfa_k, dmar_tbl) with one row per parameter (estimate, se, z_value,

p_value, ci_lower, ci_upper) followed by the fit rows, or the alternative shapes selected by output

(see ?cfa_k).

Arguments

data

A raw data matrix or data frame, rows are respondents and columns include the items named in factor_1 and factor_2. Supply exactly one of data or S.

factor_1

Character vector naming the items of the first factor (two or more).

factor_2

Character vector naming the items of the second factor (two or more). No item may appear in both factors.

S

A symmetric covariance matrix of the items, with dimnames naming the items; N is then required. Supply exactly one of data or S.

N

Total sample size. Required with S; ignored (inferred from the rows) with data.

equal_loading

Logical, or a named logical vector with one element per factor. TRUE constrains the loadings within a factor to a single value (across factors nothing is equated). Defaults to FALSE.

equal_error

Logical, or a named logical vector with one element per factor. TRUE constrains the error variances within a factor to a single value. Defaults to FALSE.

correlated_factors

Logical. If TRUE (default) the factors covary freely; because each factor variance is fixed to 1, the phi terms for factor pairs are the latent correlations. If FALSE the factor covariances are fixed to zero.

estimator

Character; estimator passed to lavaan. Must be one of "ML" (default; maximum likelihood, fully efficient under multivariate normality), "MLR" (robust maximum likelihood: maximum likelihood estimates with standard errors and test statistic corrected for nonnormality; Satorra & Bentler, 1994), "WLS" (the asymptotic distribution free estimator of Browne, 1984; raw data and a large sample required), "WLSMV" (diagonally weighted least squares with mean- and variance-adjusted test statistic; Muthén, 1984; Muthén, du Toit, & Spisic, 1997; the standard choice for ordered categorical items, and what ordered switches to), or "GLS" (generalized least squares; Browne, 1974). With a robust estimator the reported fit indices are the robust versions.

missing

Character; missing-data handling passed to lavaan when raw data are supplied. Common values are "listwise" (default, listwise deletion) and "ml" (full information maximum likelihood). Ignored with S. With ordered items, "ml"/"fiml" are not available; use "pairwise" or "listwise".

se

Standard error type passed to lavaan; see cfa. Common values are "standard" (default), "robust.sem" (with estimator = "MLR"), and "none" (point estimates only; fastest).

conf_level

Confidence level for the parameter confidence intervals, including the delta method intervals for omega, AVE, and H. Defaults to 0.95. The RMSEA interval is a separate convention (see Details).

output

Format of the returned object:

"verbose"

(default) Parameter estimates with confidence intervals, the per-factor defined parameters (loading_sum, error_sum, omega, ave, H), and fit information.

"measurement"

The measurement-property rows only: per factor omega, ave, and H (with delta method standard errors and confidence intervals), the latent correlation phi for every factor pair (with its confidence interval), and, for raw data, the heterotrait-monotrait ratio htmt for every factor pair via htmt.

"summary"

The raw summary() output from lavaan (not a data frame).

"standardized"

The standardized parameter estimates from lavaan::standardizedSolution().

"fit"

The raw lavaan fit object. Escape hatch for direct lavaan access, including likelihood ratio tests between two cfa_k() fits via lavaan::lavTestLRT().

...

Additional arguments forwarded to cfa_k and, through it, to lavaan (for example ordered, equal_intercept, or M).

Author

Ken Kelley [email protected]

Details

Each factor is identified by fixing its variance to 1 and estimating every loading; each item loads on exactly one factor (simple structure). The factor correlation is estimated by default and correlated_factors = FALSE fixes it to zero. Per-factor constraint vectors use the factor names, for example equal_loading = c(f1 = TRUE, f2 = FALSE).

See Also

cfa_k for the general function this wraps; cfa_1 for the one factor wrapper; htmt and average_variance_extracted for the discriminant and convergent validity summaries the output = "measurement" table reports alongside omega.

Other multivariate and latent variable methods: average_variance_extracted(), bifactor_indices(), cfa_1(), cfa_k(), ci_eigenvalue(), common_method_marker(), common_method_single_factor(), dmacs(), ecvi(), htmt(), irt_grm(), irt_information(), measurement_alignment(), measurement_invariance(), procrustes_phi(), simple_structure()

Examples

Run this code
data(holzinger_swineford)

# Two factors, each named by its items.
cfa_2(holzinger_swineford,
      factor_1 = c("t6_paragraph_comprehension", "t7_sentence",
                   "t9_word_meaning"),
      factor_2 = c("t20_deduction", "t22_problem_reasoning",
                   "t23_series_completion"))

# The measurement properties: omega, ave, and H per factor, the
# factor correlation, and the htmt ratio.
cfa_2(holzinger_swineford,
      factor_1 = c("t6_paragraph_comprehension", "t7_sentence",
                   "t9_word_meaning"),
      factor_2 = c("t20_deduction", "t22_problem_reasoning",
                   "t23_series_completion"),
      output = "measurement")

Run the code above in your browser using DataLab