
Path and Factor Analysis After Correlation Synthesis
Latent-Factor-After-Correlation-Synthesis.RmdThis workflow synthesizes participant-level study correlation
matrices, fits path/CFA models with matched sampling covariance, and
explores descriptive EFA. lavaan and metaSEM
are not required by mars.
Synthesize the study matrices
set.seed(104)
loading <- c(.7,.8,.6,.9)
population_R <- tcrossprod(loading)
diag(population_R) <- 1
variables <- paste0("x",1:4)
pairs <- combn(variables,2)
pair_names <- paste(pairs[2,],pairs[1,],sep="_")
study_correlations <- lapply(1:20,function(i) {
n <- 150+5*i
x <- matrix(rnorm(n*4),n,4) %*% chol(population_R)
values <- cor(x)[lower.tri(population_R)]
out <- data.frame(ID=paste0("s",i),N=n)
for(j in seq_along(values)) out[[pair_names[j]]] <- values[j]
out
})
study_data <- do.call(rbind,study_correlations)
synthesis <- mars(study_data,studyID="ID",effectID="numID",sample_size="N",
effectsize_type="cor",variable_names=pair_names,varcov_type="weighted",
estimation_method="FE")Each row represents an independent study correlation matrix. Pair
names identify matrix coordinates even if columns are reordered. Sample
sizes are aligned by study ID. Incomplete matrices retain observed pair
identities; completely unobserved pairs cannot be identified.
varcov_type="weighted" uses a sample-size-weighted common
correlation structure for the Olkin–Siotani sampling covariance.
average uses available-data means; simple uses
each study’s matrix with zeros for missing entries in the covariance
approximation.
This simulation has a common population matrix, so the example uses
common-effect synthesis (FE). For substantive
heterogeneity, select REML and assess the between-study
correlation covariance and the number of studies available to estimate
it. Neither raw-r means nor matrix repair guarantee a positive-definite
pooled matrix.
The joint homogeneity statistic is stored in
synthesis$QE. Its null is a common true effect for each
correlation across studies, allowing the different correlations to have
different means. synthesis$QE$components gives separate
marginal tests for each correlation. These do not generally sum to joint
Q because the correlations have dependent sampling errors.
synthesis$QE$joint_contributions gives signed allocations
that do sum to joint Q, including covariance terms; these allocations
have no individual p-values. Both data frames can be exported with
utils::write.csv().
Confirmatory factor analysis
cfa <- cfa_from_synthesis(synthesis,"F =~ x1+x2+x3+x4")
cfa$fit_method
#> [1] "wls"
summary(cfa)
#> Results generated with MARS:v 0.6.0.8
#> Friday, November 20, 2026
#>
#> Model Type:
#> multivariate
#>
#> Average Correlation Matrix:
#> x1 x2 x3 x4
#> x1 1.0000000 0.5630243 0.3925544 0.6217887
#> x2 0.5630243 1.0000000 0.4569549 0.7287359
#> x3 0.3925544 0.4569549 1.0000000 0.5303767
#> x4 0.6217887 0.7287359 0.5303767 1.0000000
#>
#> Synthesis options:
#> method: model
#> pooled coefficient covariance: gls
#> transform: none
#> missing_corr: available
#> attenuation: none
#> pd_adjust: none
#> pd_adjusted: FALSE
#> min eigen (before/after): 0.258 / 0.258
#> Fit note: Asymptotic WLS chi-square conditional on the matched estimated sampling covariance; RMSEA is unavailable.
#>
#>
#> Model Fitted:
#> F =~ x1+x2+x3+x4
#>
#> Fixed Effects:
#> predictor outcome estimate standard_errors test_statistic p_value
#> F -> x1 F x1 1.0000000 NA NA NA
#> F -> x2 F x2 1.1678547 0.01743473 66.98440 0
#> F -> x3 F x3 0.8404668 0.01879886 44.70840 0
#> F -> x4 F x4 1.3145066 0.02066765 63.60214 0
#>
#>
#> Fit Statistics:
#> Type Value
#> 1 Model Chi-Square 4.717 (2), 0.0945430583767007
#> 2 Null Model Chi-Square 11687.241 (6)
#> 3 CFI 1
#> 4 TLI 0.999
#> 5 RMSEA <NA>
#> 6 SRMR 0.006
#> 7 CFI (raw) 1
#> 8 TLI (raw) 0.999
cfa$standardized_loadings
#> factor indicator loading standardized_loading standardized_se
#> 1 F x1 1.0000000 0.6896097 0.009529765
#> 2 F x2 1.1678547 0.8053640 0.007503149
#> 3 F x3 0.8404668 0.5795941 0.011584333
#> 4 F x4 1.3145066 0.9064965 0.006225806
#> standardized_ci_lower standardized_ci_upper
#> 1 0.6709317 0.7082877
#> 2 0.7906580 0.8200699
#> 3 0.5568892 0.6022989
#> 4 0.8942942 0.9186989
cfa$factor_correlations
#> F
#> F 1CFA report plots made with plot(report, type="path"),
where report comes from
synthesis_factor_report(..., factor_method="cfa", cfa_model=...),
show raw loadings, nonzero latent covariances, observed residual
variance loops and a latent-variance caption.
path_covariances, path_residuals and
path_factor_variances control these annotations;
path_digits controls their decimal places. Fixed latent
variances are marked in the caption. Covariances equal correlations only
for factors with unit variance. For endogenous factors, the caption’s
variances describe disturbances. These options change only CFA path
displays, not estimation or other plots.
fit_method="auto" selects WLS when matched
pooled-correlation sampling covariance is available. WLS minimizes the
discrepancy between observed and model-implied correlations using the
inverse of that covariance. Observed residual variances are computed to
constrain observed variances to one. A marker loading identifies the
factor scale. Raw loadings therefore differ from standardized loadings;
a raw loading above one is not itself a Heywood case.
The global statistic has asymptotic chi-square calibration conditional on the estimated sampling covariance. Degrees of freedom equal the number of unique correlations minus the identified free parameter count. Saturated models have no global p-value. CFI/TLI use the same covariance weights for their independence model; raw and bounded values are stored. SRMR describes unweighted residuals. RMSEA is unavailable because the synthesized matrix has no single specified effective sample size. A large participant total does not remove uncertainty in estimated heterogeneity or compensate for few independent studies.
Default WLS SEs use expected information, without a residual-scale multiplier. They can differ from observed-Hessian SEs. WLS requires positive-definite matched sampling covariance and an identified admissible model; singular covariance is not silently regularized. Numeric fixed loadings, latent variances and residual covariances are supported. Equality labels, mean structures and fixed endogenous variances are outside this WLS interface.
Observed paths and indirect effects
paths <- path_model(synthesis,"x2 ~ x1\nx4 ~ x1+x2")
summary(paths)
#> Results generated with MARS:v 0.6.0.8
#> Friday, November 20, 2026
#>
#> Model Type:
#> multivariate
#>
#> Average Correlation Matrix:
#> x1 x2 x3 x4
#> x1 1.0000000 0.5630243 0.3925544 0.6217887
#> x2 0.5630243 1.0000000 0.4569549 0.7287359
#> x3 0.3925544 0.4569549 1.0000000 0.5303767
#> x4 0.6217887 0.7287359 0.5303767 1.0000000
#>
#> Synthesis options:
#> method: model
#> pooled coefficient covariance: gls
#> transform: none
#> missing_corr: available
#> attenuation: none
#> pd_adjust: none
#> pd_adjusted: FALSE
#> min eigen (before/after): 0.258 / 0.258
#> Fit note: Asymptotic WLS chi-square conditional on the matched estimated sampling covariance; RMSEA is unavailable.
#>
#>
#> Model Fitted:
#> x2 ~ x1
#> x4 ~ x1+x2
#>
#> Fixed Effects:
#> predictor outcome estimate standard_errors test_statistic
#> x1 -> x2 x1 x2 0.6816752 0.00940299 72.49558
#> x1 -> x4 x1 x4 0.4775794 0.01396694 34.19356
#> x2 -> x4 x2 x4 0.4190455 0.01383788 30.28248
#> p_value
#> x1 -> x2 0.000000e+00
#> x1 -> x4 3.013985e-256
#> x2 -> x4 1.949783e-201
#>
#>
#> Fit Statistics:
#> Type Value
#> 1 Model Chi-Square 657.324 (2), 1.83658080613235e-143
#> 2 Null Model Chi-Square 11687.241 (6)
#> 3 CFI 0.944
#> 4 TLI 0.832
#> 5 RMSEA <NA>
#> 6 SRMR 0.115
#> 7 CFI (raw) 0.944
#> 8 TLI (raw) 0.832
path_effects(paths,list(indirect=c("x1 -> x2","x2 -> x4"),direct="x1 -> x4"))
#> effect estimate std_error ci_lower ci_upper p_value
#> 1 indirect 0.2856529 0.009658208 0.2667232 0.3045827 3.025952e-192
#> 2 direct 0.4775794 0.013966939 0.4502047 0.5049541 3.013985e-256computed_vcov retains covariance across equations.
path_effects() propagates that covariance through products
of directed coefficients. Its Wald intervals are pointwise
approximations, particularly near zero. Pooled associations alone do not
establish causal mediation.
Descriptive fitting and alternative pooling
descriptive <- cfa_from_synthesis(synthesis,"F =~ x1+x2+x3+x4",
fit_method="descriptive")
descriptive$fit_note
#> [1] "Descriptive fitting of the pooled matrix; not a stage-two WLS fit. Chi-square, CFI, TLI and RMSEA are unavailable for synthesized correlations."
alternative <- cfa_from_synthesis(synthesis,"F =~ x1+x2+x3+x4",
synthesis_method="weighted",synthesis_transform="fisher_z")
alternative$fit_method
#> [1] "descriptive"
alternative$se_note
#> [1] "Pooled-correlation uncertainty is unavailable for alternative pooling or a repaired matrix; the original estimator covariance cannot be reused."Descriptive fitting uses the pooled matrix without
sampling-covariance weights. It withholds global chi-square, CFI/TLI and
RMSEA, including when num_obs is provided. Average or
sample-size-weighted pooling, reliability correction and matrix repair
do not have matched sampling covariance in this workflow; their
uncertainty is withheld. Choose repair explicitly and inspect its
eigenvalues, maximum cell change and Frobenius change.
Missing-correlation options concern alternative pooling.
available uses the model estimate for absent pairs,
pairwise fills absent pairs with a mean, and
em performs iterative matrix completion. This completion is
not likelihood EM and has no imputation uncertainty. Reliability
correction requires scientifically appropriate reliability estimates for
each variable and study. Missing values follow the explicitly selected
policy; skip leaves the entire pair uncorrected.
Exploratory factor analysis
efa <- efa_from_synthesis(synthesis,n_factors=1,se_method="simulation",
se_draws=100,se_seed=18)
efa$fit$loadings
#>
#> Loadings:
#> Factor1
#> x1 0.689
#> x2 0.805
#> x3 0.579
#> x4 0.906
#>
#> Factor1
#> SS loadings 2.279
#> Proportion Var 0.570
efa$loading_se
#> Factor1
#> x1 0.010221779
#> x2 0.008058747
#> x3 0.011105002
#> x4 0.005687919
efa$se_diagnostics
#> $method
#> [1] "simulation"
#>
#> $seed
#> [1] 18
#>
#> $attempted
#> [1] 100
#>
#> $accepted
#> [1] 100
#>
#> $rejected
#> [1] 0
#>
#> $success_rate
#> [1] 1
#>
#> $sufficient
#> [1] TRUE
#>
#> $source_bootstrap
#> NULL
#>
#> $alignment
#> [1] "Optimal permutation and sign matching"
efa$boundary
#> [1] FALSEEFA uses maximum-likelihood factanal() extraction
descriptively. No single-sample factor chi-square test is reported. For
oblique rotation, communalities and the implied matrix include factor
correlations. Loading uncertainty conditions on the factor count and
rotation; draw solutions are matched by factor permutation and sign.
Substantial rotational ambiguity needs sensitivity analysis.
retention <- efa_from_synthesis(synthesis,n_factors=1,
factor_retention="parallel",parallel_n=100,parallel_draws=100,se_seed=18)
retention$factor_retention
#> $eigenvalues
#> component observed null_95
#> 1 1 2.6631471 1.3795683
#> 2 2 0.6312714 1.1482719
#> 3 3 0.4476089 0.9977649
#> 4 4 0.2579727 0.8748429
#>
#> $suggested_components
#> [1] 1
#>
#> $note
#> [1] "Descriptive PCA parallel-analysis sensitivity using independent-unit count; not a calibrated factor-retention test for synthesized correlations."This PCA parallel analysis is descriptive sensitivity at an
explicitly chosen independent-unit count. It is not a calibrated
retention test for synthesized correlations, and does not select
n_factors automatically. Compare plausible reference
counts, alternative factor counts and substantive interpretations.
Resampling and diagnostics
simulated <- cfa_from_synthesis(synthesis,"F =~ x1+x2+x3+x4",
se_method="simulation",se_draws=50,se_seed=19)
simulated$se_diagnostics
#> $method
#> [1] "simulation"
#>
#> $requested
#> [1] 50
#>
#> $attempted
#> [1] 50
#>
#> $seed
#> [1] 19
#>
#> $source_bootstrap
#> NULL
#>
#> $accepted
#> [1] 50
#>
#> $rejected
#> [1] 0
#>
#> $repaired
#> [1] 0
#>
#> $sign_aligned
#> [1] 0
#>
#> $failure_counts
#> invalid_correlation repair_failed fit_failed
#> 0 0 0
#> nonfinite_coefficients
#> 0
#>
#> $success_rate
#> [1] 1
#>
#> $minimum_accepted
#> [1] 50
#>
#> $minimum_success_rate
#> [1] 0.8
#>
#> $sufficient
#> [1] TRUESimulation draws joint normally distributed pooled correlations using their matched covariance. Bootstrap uses named correlation draws when provided, or resamples independent studies/clusters and refits the original synthesis. Both refit the same WLS/descriptive objective as the point estimate. At least 50 admissible fits and an 80 percent success rate are needed. Inspect invalid correlations, inadmissible solutions and source-bootstrap failure counts. Seeds preserve the caller’s RNG state. Substantial rejection can make accepted-draw uncertainty sensitive to selection.
Multi-group invariance requires separately synthesized group matrices, their joint covariance and equality-constrained estimation; this interface does not provide that test. Fit groups separately for descriptive comparison.
Convergence and covariance choices
Ordinary fits accept control=list(maxit=2000);
increasing iterations permits another convergence attempt, not a
guarantee of convergence. Summaries report the optimizer code.
Factor/correlation synthesis rejects unconverged inputs.
For a converged ML fit, vcov_method="observed" selects
the coefficient block of the inverse full likelihood Hessian. The
default "gls" retains conditional GLS/expected-information
uncertainty. Both are asymptotic methods; neither is a general
small-sample correction. Observed covariance requires an interior
solution and a positive-definite full Hessian; it is not silently
regularized. It is unavailable for REML, whose restricted likelihood is
not a joint likelihood for the fixed coefficients. Supplied fixed
heterogeneity gives conditional coefficient inference under either
option.
Set vcov_method when fitting to carry the covariance
into WLS CFA, simulations and independent-study bootstrap refits.
summary(fit, vcov_method="observed"),
vcov(fit, vcov_method="observed") and
confint(fit, vcov_method="observed") override that
individual output only. The native CFA output identifies its pooled
coefficient covariance source; its own default WLS parameter SEs still
use expected WLS information. Cluster-robust inference remains a
separately requested covariance source. The GLS residual-scaled F
component is withheld for observed-information fits; their joint
coefficient test is the model-based Wald chi-square.
For supported ML fits (currently excluding location-scale and
fixed-heterogeneity fits), confint(fit, method="profile")
re-estimates nuisance parameters along each profile. Inspect convergence
and expand grids if endpoints are not bracketed. A symmetric Wald
interval and a profile interval need not agree; variance-boundary
inference is nonstandard.