Multigroup Models with Summary Data

Author

Ty Partridge

library(lavaan)
This is lavaan 0.6-19
lavaan is FREE software! Please report any bugs.
# Example covariance matrices for two groups
group1_cov <- matrix(c(
  1.0, 0.5, 0.3,
  0.5, 1.0, 0.4,
  0.3, 0.4, 1.0
), nrow = 3, byrow = TRUE)

group2_cov <- matrix(c(
  1.2, 0.6, 0.4,
  0.6, 1.1, 0.5,
  0.4, 0.5, 1.3
), nrow = 3, byrow = TRUE)

# Add row and column names to match variable names in the model
var_names <- c("y1", "y2", "y3")
colnames(group1_cov) <- var_names
rownames(group1_cov) <- var_names
colnames(group2_cov) <- var_names
rownames(group2_cov) <- var_names

# Example means for each group
group1_means <- c(2.5, 3.0, 2.8)
group2_means <- c(2.7, 3.1, 2.9)
names(group1_means) <- var_names
names(group2_means) <- var_names

# Sample sizes for each group
group1_n <- 100
group2_n <- 150

# Model specification
model <- '
  factor1 =~ y1 + y2 + y3
'

# Fit the model using summary data and include group means
fit_configural <- sem(model,
                      sample.cov = list(group1_cov, group2_cov),
                      sample.mean = list(group1_means, group2_means),  # Add group means
                      sample.nobs = list(group1_n, group2_n),
                      group.equal = NULL)

# Summary of the results
summary(fit_configural, fit.measures = TRUE)
lavaan 0.6-19 ended normally after 38 iterations

  Estimator                                         ML
  Optimization method                           NLMINB
  Number of model parameters                        18

  Number of observations per group:                   
    Group 1                                        100
    Group 2                                        150

Model Test User Model:
                                                      
  Test statistic                                 0.000
  Degrees of freedom                                 0
  Test statistic for each group:
    Group 1                                      0.000
    Group 2                                      0.000

Model Test Baseline Model:

  Test statistic                               127.014
  Degrees of freedom                                 6
  P-value                                        0.000

User Model versus Baseline Model:

  Comparative Fit Index (CFI)                    1.000
  Tucker-Lewis Index (TLI)                       1.000

Loglikelihood and Information Criteria:

  Loglikelihood user model (H0)              -1038.184
  Loglikelihood unrestricted model (H1)      -1038.184
                                                      
  Akaike (AIC)                                2112.368
  Bayesian (BIC)                              2175.755
  Sample-size adjusted Bayesian (SABIC)       2118.693

Root Mean Square Error of Approximation:

  RMSEA                                          0.000
  90 Percent confidence interval - lower         0.000
  90 Percent confidence interval - upper         0.000
  P-value H_0: RMSEA <= 0.050                       NA
  P-value H_0: RMSEA >= 0.080                       NA

Standardized Root Mean Square Residual:

  SRMR                                           0.000

Parameter Estimates:

  Standard errors                             Standard
  Information                                 Expected
  Information saturated (h1) model          Structured


Group 1 [Group 1]:

Latent Variables:
                   Estimate  Std.Err  z-value  P(>|z|)
  factor1 =~                                          
    y1                1.000                           
    y2                1.333    0.401    3.328    0.001
    y3                0.800    0.215    3.714    0.000

Intercepts:
                   Estimate  Std.Err  z-value  P(>|z|)
   .y1                2.500    0.099   25.126    0.000
   .y2                3.000    0.099   30.151    0.000
   .y3                2.800    0.099   28.141    0.000

Variances:
                   Estimate  Std.Err  z-value  P(>|z|)
   .y1                0.619    0.135    4.579    0.000
   .y2                0.330    0.189    1.747    0.081
   .y3                0.752    0.125    6.011    0.000
    factor1           0.371    0.150    2.472    0.013


Group 2 [Group 2]:

Latent Variables:
                   Estimate  Std.Err  z-value  P(>|z|)
  factor1 =~                                          
    y1                1.000                           
    y2                1.250    0.283    4.422    0.000
    y3                0.833    0.173    4.821    0.000

Intercepts:
                   Estimate  Std.Err  z-value  P(>|z|)
   .y1                2.700    0.089   30.288    0.000
   .y2                3.100    0.085   36.321    0.000
   .y3                2.900    0.093   31.255    0.000

Variances:
                   Estimate  Std.Err  z-value  P(>|z|)
   .y1                0.715    0.129    5.564    0.000
   .y2                0.348    0.159    2.186    0.029
   .y3                0.960    0.130    7.370    0.000
    factor1           0.477    0.148    3.227    0.001