Skip to contents

Fit an exploratory factor analysis in each of several groups at a common number of factors and bring the per-group solutions into one shared orientation so their loadings can be compared. Each group is fitted with efa_fit(); the solutions are then aligned either to a symmetric consensus target or to a chosen reference group (see Alignment).

Usage

efa_group(
  x,
  groups = NULL,
  n_factors,
  N = NA,
  reference_group = NULL,
  b_boot = 0L,
  ci = 0.95,
  seed = NULL,
  delta = 0.1,
  invariance = FALSE,
  se = NULL,
  ...
)

Arguments

x

A data frame or matrix of raw data (with groups), or a named list of per-group data sets – either raw data frames/matrices or correlation matrices (all of one kind).

groups

A vector with one value per row of x, or the name of the column of x that holds the groups (this column is then not analysed). Only used when x is a single raw data set; leave NULL when x is a list. Rows with a missing group value are dropped with a warning.

n_factors

numeric. The common number of factors extracted in every group.

N

numeric. The number of observations per group, used only for correlation-matrix input: either a single value applied to all groups or one value per group. Ignored for raw data, where N is taken from each group's data. Default is NA.

reference_group

The group to align the others to (a group name or an integer index). If NULL (default), the groups are aligned to the symmetric consensus target.

b_boot

numeric. The number of non-parametric bootstrap replicates used for the confidence intervals of the congruences and the loading differences, and for the p-values of the loading differences. 0 (the default) skips the bootstrap. Bootstrapping requires raw data; it is skipped with a warning for correlation-matrix input.

ci

numeric. The confidence level of the bootstrap intervals, a single value in (0, 1). 1 - ci is also the significance level of the adjusted p-values that flag a loading difference. Default is 0.95.

seed

numeric or NULL. An optional seed that makes the analysis reproducible, also for rotations with random starts. With a seed, the result does not depend on the number of parallel bootstrap workers (future_lapply(), set with future::plan()). The random-number stream of the caller is restored afterwards. Default is NULL.

delta

numeric. The salience threshold of the loading-difference flags: a cell is flagged for a group pair only when the absolute difference of the aligned loadings is at least delta (pattern coefficients for an oblique rotation). 0 removes this condition. Default is 0.1. To set the geomin criterion parameter, which has the same name, use rotate_control(delta = ...).

invariance

logical. Whether to add a similarity verdict per factor and group pair from the Lorenzo-Seva and ten Berge (2006) congruence bands (see Value). Default is FALSE.

se

Not used. efa_group() sets the standard-error method of the per-group efa_fit() calls itself, so a supplied value is dropped with a warning. Use b_boot for bootstrap intervals. Default is NULL.

...

Additional arguments passed to efa_fit() for every group (for example estimator, rotation, cor_method, estimate_control, or rotate_control). A name that is not an efa_fit() argument is an error.

Value

An object of class efa_group, a list containing:

loadings

A named list of the aligned per-group loading matrices. Their columns match the columns of target in order and sign.

target

The alignment target: the symmetric consensus target, or the reference group's own loadings.

Phi

A named list of the aligned per-group factor intercorrelations for an oblique rotation; NULL otherwise.

congruence

Tucker congruence between the aligned group loadings, a list with: matrices, a nested list whose [[g]][[h]] element is the factor-by-factor congruence matrix between groups g and h; matched, a groups-by-groups-by-factors array of the matched-factor congruences (the diagonal of each pairwise matrix); and degenerate, a groups-by-groups logical matrix flagging pairs whose congruence is undefined (for example, a near-zero factor), for which the entries are NA. With a bootstrap (b_boot > 0, raw data), also: matched_se, the bootstrap standard error of each matched congruence; matched_ci, a list of lower and upper basic bootstrap confidence limits (Davison & Hinkley, 1997), each a groups-by-groups-by-factors array; and n_boot, the number of bootstrap replicates that aligned in every group. The replicate congruences are lower than the estimate, and the basic interval corrects for this. Thus, the interval can lie above the estimate, and its upper limit is often 1.

diffs

A data frame with one row per group pair summarising the differences between their aligned loadings: the mean, median, minimum, and maximum absolute difference, the root-mean-square difference (rmse), and n_flagged, the number of flagged cells.

flags

A data frame with one row per group pair, item, and factor giving the signed loading difference (diff), its absolute value (abs_diff), and whether it is flagged. With a bootstrap, ci_lower and ci_upper give the percentile confidence interval of the difference, ci_excludes_0 whether it excludes zero, p_value the two-sided p-value of the difference from its bootstrap standard error (normal approximation; Efron & Tibshirani, 1993), and p_adjusted the Benjamini-Hochberg adjusted p-value over all rows; otherwise these are NA. The interval and the p-value use different approximations, so near the limit they can disagree.

invariance

When invariance = TRUE, a data frame with one row per group pair and factor giving the matched Tucker congruence (phi), its bootstrap confidence limits (phi_lower, phi_upper; NA without a bootstrap), and a verdict from the Lorenzo-Seva and ten Berge (2006) bands of phi: "equal" for phi >= 0.95, "fair" for [0.85, 0.95), and "below fair" for phi < 0.85. The bands describe the size of the congruence; they are not a test. Tucker's congruence does not change when a factor's loadings are multiplied by a constant, so a factor can be "equal" even when one group's loadings on it are uniformly stronger; read the verdict together with diffs. NULL when invariance = FALSE.

efa

The named list of per-group efa_fit() objects (each keeps its own diagnostics, e.g. heywood).

alignment

The alignment result. On the consensus path, a list with converged, iterations, loss (the mean over the groups of the sum of squared differences from the consensus target), target, aligned_loadings, and start (the index of the group that started the iteration). Its target and aligned_loadings have the orientation before the rotation criterion. For an oblique rotation, its procrustes element holds the oblique Procrustes result of each group. On the reference path, this is a list with the reference group, the target, and the Procrustes result of each group. Use target and loadings above for comparisons.

settings

A list of the settings used, including the per-group N, the alignment method, the group that started the consensus iteration (alignment_start, NULL on the reference path), the orientation of the consensus target (gauge: the rotation's own name, "principal_axes", or "identity" for a single factor; NULL on the reference path), the rotation, the estimator, the input type, whether a bootstrap is available (can_bootstrap), and seed.

Details

Input

Groups can be supplied in two ways: raw data together with a grouping vector or column name (x a data frame or matrix, groups one value per row or the name of a column of x), or a named list of per-group data sets in x (with groups left NULL). The list may hold raw data frames or correlation matrices (supply N), but not a mix of the two. All groups must contain the same items in the same order; a different item set or order is an error.

Every group is fitted at the same n_factors. Extra arguments in ... (for example estimator, rotation, cor_method, or an estimate_control() / rotate_control()) are given unchanged to each efa_fit() call, so the estimator and rotation are common to all groups. The n_factors-factor model must be identified (non-negative degrees of freedom) for the shared items; otherwise efa_group() gives an error.

Alignment

A factor solution is identified only up to a rotation of its factors, so the per-group solutions must be brought into a common orientation before their loadings can be compared. Two strategies are available:

  • Consensus (the default): efa_group() builds a symmetric target from all groups by Generalized Procrustes Analysis of their unrotated loadings (Gower, 1975). Then it applies the requested rotation criterion to this target (Lorenzo-Seva et al., 2002). For an orthogonal rotation, every group gets the same orthogonal transform. For an oblique rotation, every group gets an oblique Procrustes rotation to the target (Browne, 1972), so each group keeps its own factor intercorrelations. An unrotated solution, and a two-factor bifactor rotation, use the principal axes of the target. The result does not depend on the order of the groups.

  • Reference: when reference_group is given, every group's loadings are aligned by Procrustes rotation to the loadings of that group, which are kept fixed.

In both cases the returned per-group loadings share the column order and sign of the returned target.

Comparing the aligned loadings

Because the per-group loadings share one orientation, they can be compared cell by cell. diffs summarises the differences per group pair and flags gives them per item and factor. A cell is flagged when its absolute difference is at least delta. With a bootstrap (b_boot > 0), a flagged cell must also have a significant difference. Its p-value comes from the bootstrap standard error. After the Benjamini-Hochberg (1995) adjustment over all cells, it must be below 1 - ci. The adjustment is necessary because many cells are tested at the same time. With invariance = TRUE, each factor and group pair also gets a similarity verdict from the matched Tucker congruence (see Value).

References

Benjamini, Y., & Hochberg, Y. (1995). Controlling the false discovery rate: A practical and powerful approach to multiple testing. Journal of the Royal Statistical Society: Series B, 57, 289-300. doi: 10.1111/j.2517-6161.1995.tb02031.x

Browne, M. W. (1972). Oblique rotation to a partially specified target. British Journal of Mathematical and Statistical Psychology, 25, 207-212. doi: 10.1111/j.2044-8317.1972.tb00492.x

Davison, A. C., & Hinkley, D. V. (1997). Bootstrap Methods and Their Application. Cambridge University Press.

Efron, B., & Tibshirani, R. J. (1993). An Introduction to the Bootstrap. Chapman & Hall.

Gower, J. C. (1975). Generalized Procrustes analysis. Psychometrika, 40, 33-51. doi: 10.1007/BF02291478

Lorenzo-Seva, U., Kiers, H. A. L., & ten Berge, J. M. F. (2002). Techniques for oblique factor rotation of two or more loading matrices to a mixture of simple structure and optimal agreement. British Journal of Mathematical and Statistical Psychology, 55, 337-360. doi: 10.1348/000711002760554624

Lorenzo-Seva, U., and ten Berge, J. M. F. (2006). Tucker's congruence coefficient as a meaningful index of factor similarity. Methodology, 2, 57-64. doi: 10.1027/1614-2241.2.2.57

See also

Examples

# Raw data split by a grouping vector
g <- rep(c("g1", "g2"), length.out = nrow(GRiPS_raw))
mg <- efa_group(GRiPS_raw, groups = g, n_factors = 1)
mg
#> ── Multigroup exploratory factor analysis ──────────────────────────────────────
#> 
#> 2 groups (g1, g2) · 1 factor · PAF extraction · unrotated
#> Aligned to a symmetric consensus target.
#> N: g1 = 405, g2 = 405
#> 
#> ── Factor congruence ───────────────────────────────────────────────────────────
#> 
#> Tucker's congruence between the aligned group loadings (matched factors):
#> 
#>            F1
#> g1 vs g2  .999
#> 
#> ── Loading differences ─────────────────────────────────────────────────────────
#> 
#> Absolute loading differences by group pair:
#> 
#>           mean   max  rmse  flagged
#> g1 vs g2  .025  .075  .033      0/8
#> 
#> No cell is flagged (|Δ| ≥ .1).

# Per-pair difference summary and the per-item flag table
mg$diffs
#>   group_1 group_2 mean_abs_diff median_abs_diff min_abs_diff max_abs_diff
#> 1      g1      g2    0.02499828      0.01697205  0.002185992   0.07487899
#>         rmse n_flagged
#> 1 0.03309813         0
head(mg$flags)
#>   group_1 group_2 indicator factor         diff    abs_diff flagged ci_lower
#> 1      g1      g2       fun     F1 -0.041410308 0.041410308   FALSE       NA
#> 2      g1      g2   friends     F1  0.012407057 0.012407057   FALSE       NA
#> 3      g1      g2     enjoy     F1 -0.020747446 0.020747446   FALSE       NA
#> 4      g1      g2      hurt     F1 -0.074878986 0.074878986   FALSE       NA
#> 5      g1      g2      part     F1  0.002185992 0.002185992   FALSE       NA
#> 6      g1      g2  commonly     F1  0.013196661 0.013196661   FALSE       NA
#>   ci_upper ci_excludes_0 p_value p_adjusted
#> 1       NA            NA      NA         NA
#> 2       NA            NA      NA         NA
#> 3       NA            NA      NA         NA
#> 4       NA            NA      NA         NA
#> 5       NA            NA      NA         NA
#> 6       NA            NA      NA         NA

# \donttest{
# Bootstrap confidence intervals and adjusted p-values, with a similarity verdict
mg_ci <- efa_group(GRiPS_raw, groups = g, n_factors = 1, b_boot = 100, seed = 42,
                   invariance = TRUE)
mg_ci
#> ── Multigroup exploratory factor analysis ──────────────────────────────────────
#> 
#> 2 groups (g1, g2) · 1 factor · PAF extraction · unrotated
#> Aligned to a symmetric consensus target.
#> N: g1 = 405, g2 = 405
#> 
#> ── Factor congruence ───────────────────────────────────────────────────────────
#> 
#> Tucker's congruence between the aligned group loadings (matched factors), with
#> 95% bootstrap confidence intervals (100 replicates):
#> 
#>                   F1
#> g1 vs g2  .999 [.999, 1.000]
#> 
#> ── Loading differences ─────────────────────────────────────────────────────────
#> 
#> Absolute loading differences by group pair:
#> 
#>           mean   max  rmse  flagged
#> g1 vs g2  .025  .075  .033      0/8
#> 
#> No cell is flagged (|Δ| ≥ .1 and Benjamini-Hochberg adjusted bootstrap p <
#> .05).
#> 
#> ── Factor similarity ───────────────────────────────────────────────────────────
#> 
#> Congruence bands (Lorenzo-Seva & ten Berge, 2006: ≥ .95 equal, ≥ .85 fair):
#> 
#>             F1
#> g1 vs g2  equal

# A named list of correlation matrices sharing the same items, with the default
# oblique rotation
bands <- list(age_6_8 = WJIV_ages_6_8$cormat, age_14_19 = WJIV_ages_14_19$cormat)
Ns <- c(WJIV_ages_6_8$N, WJIV_ages_14_19$N)
efa_group(bands, n_factors = 3, N = Ns)
#> ── Multigroup exploratory factor analysis ──────────────────────────────────────
#> 
#> 2 groups (age_6_8, age_14_19) · 3 factors · PAF extraction · oblimin rotation
#> Aligned to a symmetric consensus target.
#> N: age_6_8 = 825, age_14_19 = 1685
#> 
#> ── Factor congruence ───────────────────────────────────────────────────────────
#> 
#> Tucker's congruence between the aligned group loadings (matched factors):
#> 
#>                        F1    F2    F3
#> age_6_8 vs age_14_19  .979  .990  .971
#> 
#> ── Loading differences ─────────────────────────────────────────────────────────
#> 
#> Absolute loading differences by group pair:
#> 
#>                       mean   max  rmse  flagged
#> age_6_8 vs age_14_19  .058  .188  .073   26/141
#> 
#> Flagged cells (|Δ| ≥ .1), the 10 largest of 26 (all in `$flags`):
#> 
#>                        item   factor   diff
#> age_6_8 vs age_14_19  PICREC      F1   .188
#> age_6_8 vs age_14_19  PAIRCN      F1  -.179
#> age_6_8 vs age_14_19  GENINF      F1  -.173
#> age_6_8 vs age_14_19  WRDATK      F1   .168
#> age_6_8 vs age_14_19  SEGMNT      F1   .159
#> age_6_8 vs age_14_19     HUM      F1  -.159
#> age_6_8 vs age_14_19  WRTSMP      F1   .151
#> age_6_8 vs age_14_19  PSGCMP      F1   .144
#> age_6_8 vs age_14_19  PICVOC      F1  -.144
#> age_6_8 vs age_14_19  SNDAWR      F1   .140

# Align to a reference group instead
efa_group(bands, n_factors = 3, N = Ns, reference_group = "age_6_8")
#> ── Multigroup exploratory factor analysis ──────────────────────────────────────
#> 
#> 2 groups (age_6_8, age_14_19) · 3 factors · PAF extraction · oblimin rotation
#> Aligned to reference group age_6_8.
#> N: age_6_8 = 825, age_14_19 = 1685
#> 
#> ── Factor congruence ───────────────────────────────────────────────────────────
#> 
#> Tucker's congruence between the aligned group loadings (matched factors):
#> 
#>                        F1    F2    F3
#> age_6_8 vs age_14_19  .979  .989  .971
#> 
#> ── Loading differences ─────────────────────────────────────────────────────────
#> 
#> Absolute loading differences by group pair:
#> 
#>                       mean   max  rmse  flagged
#> age_6_8 vs age_14_19  .060  .199  .075   26/141
#> 
#> Flagged cells (|Δ| ≥ .1), the 10 largest of 26 (all in `$flags`):
#> 
#>                        item   factor   diff
#> age_6_8 vs age_14_19  PICREC      F1   .199
#> age_6_8 vs age_14_19  PAIRCN      F1  -.193
#> age_6_8 vs age_14_19  WRDATK      F1   .179
#> age_6_8 vs age_14_19  GENINF      F1  -.178
#> age_6_8 vs age_14_19     HUM      F1  -.166
#> age_6_8 vs age_14_19  WRTSMP      F1   .161
#> age_6_8 vs age_14_19  RDGREC      F1   .153
#> age_6_8 vs age_14_19  PSGCMP      F1   .152
#> age_6_8 vs age_14_19  SEGMNT      F1   .149
#> age_6_8 vs age_14_19  SNDAWR      F1   .136
# }