Skip to contents

Identifies loading non-invariance across groups within each time point and across time points within each group, then fits a final measurement model across all group-time cells. This score-based implementation is the measurement-invariance procedure used by lmmgsem().

Usage

compute_mi_long_stepwise_score(
  data,
  model,
  group_var,
  time_var,
  method = c("group_violations", "test_statistic"),
  alpha = 0.05,
  d_cfi_threshold = 0.01,
  max_iter = 20,
  fit_indices = c("chisq", "df", "pvalue", "cfi", "rmsea", "srmr"),
  specific_noninv = FALSE,
  ...
)

Arguments

data

Data frame containing the observed variables and grouping and time identifiers.

model

Measurement model in lavaan syntax.

group_var

Name of the grouping column in data.

time_var

Name of the time column in data.

method

Selection rule for freeing a loading: "group_violations" or "test_statistic".

alpha

Significance level for the score tests.

d_cfi_threshold

Maximum configural-to-metric CFI difference.

max_iter

Maximum number of iterations per group/time slice.

fit_indices

Fit indices to return for the configural and metric models.

specific_noninv

If TRUE, allow non-invariance for specific group-time pairs; otherwise free loadings globally.

...

Additional arguments passed to lavaan's CFA fitting functions.

Value

A list containing the final lavaan measurement model, latent covariance matrices for each group-time cell, invariance results, and fit indices.

Details

Every group must have observations at each of at least two time points. Missing group or time identifiers are rejected rather than silently dropped.