
Grad Sem
- 38 installs
- 223 repo stars
- Updated June 6, 2026
- asgard-ai-platform/skills
grad-sem is a skill that applies Structural Equation Modeling to test hypothesized causal structures by combining measurement models (CFA) and structural path analysis.
About
This skill guides an agent to apply Structural Equation Modeling (SEM) to test a theoretical model. An analyst uses it to validate latent constructs, test mediation chains, and assess whether data are consistent with a hypothesized causal structure. It outputs a measurement model (CFA), model-fit indices, and structural path results.
- Tests hypothesized causal structures by combining CFA and path analysis
- Assesses model fit with CFI, TLI, RMSEA, and SRMR
- Validates latent constructs and tests mediation/moderation paths
Grad Sem by the numbers
- 38 all-time installs (skills.sh)
- Ranked #1,016 of 2,064 Data Science & ML skills by installs in the Skillselion catalog
- Data as of Aug 2, 2026 (Skillselion catalog sync)
grad-sem capabilities & compatibility
- Capabilities
- statistical modeling · data analysis · confirmatory factor analysis
- Use cases
- data analysis · research
What grad-sem says it does
Structural Equation Modeling (SEM) simultaneously estimates measurement models (how observed indicators map to latent constructs) and structural models (directional paths among constructs).
IRON LAW: SEM does NOT prove causation — it tests whether data is CONSISTENT with a hypothesized causal structure.
npx skills add https://github.com/asgard-ai-platform/skills --skill grad-semAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 38 |
|---|---|
| repo stars | ★ 223 |
| Last updated | June 6, 2026 |
| Repository | asgard-ai-platform/skills ↗ |
What it does
Test a theoretical model with latent constructs and mediation paths and assess fit with CFI/TLI/RMSEA/SRMR.
Who is it for?
Testing full theoretical models with latent constructs and mediation using adequate samples
Skip if: Samples below 200, exploratory research with no a priori model, or simple all-observed regression
When should I use this skill?
A user asks whether variables form a causal chain, how to test a theoretical model, or whether a measurement model is valid
What you get
A SEM report with CFA measurement validity, model-fit indices, and structural path significance
- CFA measurement model table
- Model-fit index table
- Structural path table and interpretation
By the numbers
- 4-step methodology
- sample rule N at least 200
- 4 fit indices (CFI, TLI, RMSEA, SRMR)
Files
SEM 結構方程模型
Overview
Structural Equation Modeling (SEM) simultaneously estimates measurement models (how observed indicators map to latent constructs) and structural models (directional paths among constructs). It integrates confirmatory factor analysis with path analysis to test whether empirical data are consistent with a hypothesized theoretical structure.
When to Use
- Testing a full theoretical model with latent constructs and directional paths
- Evaluating mediation chains (X → M → Y) with multiple mediators
- Assessing whether survey items adequately reflect their intended constructs (CFA)
- Comparing alternative theoretical models on the same data
When NOT to Use
- Sample size below 200 (or below 10 cases per estimated parameter)
- Exploratory research with no a priori theoretical model
- All variables are observed and model is a simple regression
- Data are severely non-normal and you lack robust estimators
Assumptions
IRON LAW: SEM does NOT prove causation — it tests whether data is CONSISTENT
with a hypothesized causal structure. Good fit does NOT mean the model is
correct; it means the model cannot be rejected.Key assumptions: 1. Correct model specification — omitted paths or constructs bias estimates 2. Multivariate normality for ML estimation (or use robust estimators) 3. Sufficiently large sample size (N ≥ 200 as rule of thumb) 4. No excessive multicollinearity among indicators
Methodology
Step 1 — Specify the Measurement Model
Define latent constructs and their observed indicators. Run CFA to confirm factor loadings, assess convergent validity (AVE ≥ 0.50), and discriminant validity.
Step 2 — Assess Measurement Model Fit
Evaluate fit indices: CFI ≥ 0.90, TLI ≥ 0.90, RMSEA ≤ 0.08, SRMR ≤ 0.08. Examine modification indices cautiously — only respecify with theoretical justification.
Step 3 — Specify and Estimate the Structural Model
Add directional paths among latent constructs based on theory. Estimate path coefficients and their significance. Compare nested models using chi-square difference test.
Step 4 — Report and Interpret
Report standardized path coefficients, R² for endogenous constructs, and overall fit. Discuss indirect effects if mediation is hypothesized. See references/estimation.md for mathematical notation and estimation details.
Output Format
## SEM Analysis: [Study Title]
### Measurement Model (CFA)
| Construct | Indicator | Std. Loading | AVE | CR |
|-----------|-----------|-------------|-----|-----|
| [name] | [item] | x.xx | x.xx | x.xx |
### Model Fit
| Index | Value | Threshold | Assessment |
|-------|-------|-----------|------------|
| CFI | x.xx | ≥ 0.90 | [pass/fail] |
| TLI | x.xx | ≥ 0.90 | [pass/fail] |
| RMSEA | x.xx | ≤ 0.08 | [pass/fail] |
| SRMR | x.xx | ≤ 0.08 | [pass/fail] |
### Structural Paths
| Path | Std. β | S.E. | p-value | Supported? |
|------|--------|------|---------|------------|
| X → M | x.xx | x.xx | x.xx | [Yes/No] |
### Key Findings
- [Interpretation of results]
### Limitations
- [Note any assumption violations]Gotchas
- Equivalent models with identical fit but different causal directions always exist — SEM cannot distinguish them
- Modification indices tempt data-driven respecification that capitalizes on chance
- Parceling items masks misspecification in the measurement model
- Chi-square test is overly sensitive with N > 500; rely on approximate fit indices
- Non-normal data require MLR or bootstrapping, not default ML
- Reporting only significant paths without the full hypothesized model is selective reporting
References
- Kline, R. B. (2016). Principles and Practice of Structural Equation Modeling (4th ed.). Guilford Press.
- Hu, L., & Bentler, P. M. (1999). Cutoff criteria for fit indexes. Structural Equation Modeling, 6(1), 1-55.
- Anderson, J. C., & Gerbing, D. W. (1988). Structural equation modeling in practice. Psychological Bulletin, 103(3), 411-423.
Example: 員工數位工具採用行為的 SEM 模型驗證
Scenario
TalentSync 是一家台灣 B2B SaaS 公司,旗下 HR 平台於 2024 年導入 AI 排班助手功能。產品研究團隊在導入六個月後針對 312 名企業用戶進行問卷調查,欲驗證以下理論模型:
感知有用性(PU) 和 感知易用性(PEOU) 共同影響 使用意圖(BI),且 PEOU 同時透過 PU 間接影響 BI(TAM 架構延伸)。此外,組織支持(OS) 被假設正向影響 PU。
研究員 Wendy 的問題:「我的問卷回收了 312 份,每個構念有 3-4 題 Likert 量表,我要怎麼驗證整個理論模型?測量模型跟結構模型到底先做哪個?」
問卷題項:
- PU (4 items): PU1–PU4 — 「這個 AI 功能提升我的工作效率」等
- PEOU (3 items): PEOU1–PEOU3 — 「這個系統容易學習」等
- OS (3 items): OS1–OS3 — 「我的主管鼓勵使用此系統」等
- BI (3 items): BI1–BI3 — 「我打算在未來持續使用此功能」等
---
Analysis
Step 1 — 確認先決條件
- N = 312,估計參數約 38(13 個因素負荷 + 6 條結構路徑 + 殘差),N/param ≈ 8.2
- 邊緣通過(略低於理想的 10:1),須在限制部分中說明
- 偏態係數全在 ±1.5 內,峰度未超過 ±3;採用 MLR(Robust ML)估計以防非常態影響
- 使用 R
lavaan套件進行兩步驟分析(Anderson & Gerbing, 1988)
---
Step 2 — 測量模型(CFA)
lavaan 模型語法:
cfa_model <- '
PU =~ PU1 + PU2 + PU3 + PU4
PEOU =~ PEOU1 + PEOU2 + PEOU3
OS =~ OS1 + OS2 + OS3
BI =~ BI1 + BI2 + BI3
'
fit_cfa <- cfa(cfa_model, data = talentsync_df,
estimator = "MLR", std.lv = TRUE)標準化因素負荷(所有 p < .001):
| 構念 | 題項 | Std. Loading | AVE | CR |
|---|---|---|---|---|
| PU | PU1 | 0.78 | — | — |
| PU | PU2 | 0.82 | — | — |
| PU | PU3 | 0.75 | — | — |
| PU | PU4 | 0.80 | 0.62 | 0.87 |
| PEOU | PEOU1 | 0.71 | — | — |
| PEOU | PEOU2 | 0.84 | — | — |
| PEOU | PEOU3 | 0.79 | 0.61 | 0.82 |
| OS | OS1 | 0.68 | — | — |
| OS | OS2 | 0.76 | — | — |
| OS | OS3 | 0.73 | 0.52 | 0.77 |
| BI | BI1 | 0.86 | — | — |
| BI | BI2 | 0.88 | — | — |
| BI | BI3 | 0.83 | 0.73 | 0.89 |
收斂效度(AVE ≥ 0.50,CR ≥ 0.70)全數通過。
區別效度(Fornell-Larcker 準則): 各構念 AVE 平方根均大於其與他構念的相關係數,通過區別效度檢驗。
---
Step 3 — 測量模型配適度評估
| Index | Value | Threshold | Assessment |
|---|---|---|---|
| CFI | 0.96 | ≥ 0.90 | ✓ Pass |
| TLI | 0.95 | ≥ 0.90 | ✓ Pass |
| RMSEA | 0.051 | ≤ 0.08 | ✓ Pass |
| SRMR | 0.049 | ≤ 0.08 | ✓ Pass |
| χ²/df | 1.87 | ≤ 3.0 | ✓ Pass |
修正指標(MI): MI 最高項為 PU1 與 PU3 的殘差共變(MI = 8.4)。因兩題語意相近(皆涉及「效率」),決定不修正——修正缺乏理論依據且可能過度配適。
---
Step 4 — 結構模型估計
lavaan 結構路徑語法:
sem_model <- '
PU =~ PU1 + PU2 + PU3 + PU4
PEOU =~ PEOU1 + PEOU2 + PEOU3
OS =~ OS1 + OS2 + OS3
BI =~ BI1 + BI2 + BI3
# 結構路徑
PU ~ PEOU + OS
BI ~ PU + PEOU
'
fit_sem <- sem(sem_model, data = talentsync_df,
estimator = "MLR", std.lv = TRUE)結構路徑結果:
| Path | Std. β | S.E. | p-value | Supported? |
|---|---|---|---|---|
| PEOU → PU | 0.51 | 0.07 | < .001 | Yes |
| OS → PU | 0.34 | 0.08 | < .001 | Yes |
| PU → BI | 0.47 | 0.09 | < .001 | Yes |
| PEOU → BI | 0.22 | 0.09 | .015 | Yes |
內生構念解釋變異量:
- R²(PU) = 0.48(PEOU + OS 共解釋 48% 的 PU 變異)
- R²(BI) = 0.54
間接效果(Bootstrapping, 5,000 次抽樣):
| 間接路徑 | 間接效果 | 95% CI | 顯著? |
|---|---|---|---|
| PEOU → PU → BI | 0.24 | [0.13, 0.37] | Yes |
| OS → PU → BI | 0.16 | [0.07, 0.27] | Yes |
PEOU 對 BI 的直接效果(0.22)加上間接效果(0.24)顯示 PU 為部分中介,非完全中介。
---
Result
SEM Analysis: TalentSync AI 排班助手採用行為模型
Measurement Model (CFA)
| Construct | Indicator | Std. Loading | AVE | CR |
|---|---|---|---|---|
| PU | PU1–PU4 | 0.75–0.82 | 0.62 | 0.87 |
| PEOU | PEOU1–PEOU3 | 0.71–0.84 | 0.61 | 0.82 |
| OS | OS1–OS3 | 0.68–0.76 | 0.52 | 0.77 |
| BI | BI1–BI3 | 0.83–0.88 | 0.73 | 0.89 |
Model Fit
| Index | Value | Threshold | Assessment |
|---|---|---|---|
| CFI | 0.96 | ≥ 0.90 | Pass |
| TLI | 0.95 | ≥ 0.90 | Pass |
| RMSEA | 0.051 | ≤ 0.08 | Pass |
| SRMR | 0.049 | ≤ 0.08 | Pass |
Structural Paths
| Path | Std. β | S.E. | p-value | Supported? |
|---|---|---|---|---|
| PEOU → PU | 0.51 | 0.07 | < .001 | Yes |
| OS → PU | 0.34 | 0.08 | < .001 | Yes |
| PU → BI | 0.47 | 0.09 | < .001 | Yes |
| PEOU → BI | 0.22 | 0.09 | .015 | Yes |
Key Findings
- 整體模型配適度良好,TAM 延伸架構獲得支持
- 感知易用性(PEOU) 是影響使用意圖最重要的前因,直接效果(β = 0.22)與透過 PU 的間接效果(β = 0.24)相當,顯示 PU 為部分中介
- 組織支持(OS) 透過 PU 間接影響使用意圖(95% CI: [0.07, 0.27]),產品推廣策略應同時改善介面易用性及爭取主管背書
- R²(BI) = 0.54,模型具備良好的解釋力
Limitations
- N/parameter 比(8.2:1)略低於建議的 10:1,路徑係數標準誤可能略為低估
- 橫截面設計無法排除等效模型(例如 BI → PU 方向之反向因果)
- 共同方法變異(CMV)風險存在,建議後續研究混合客觀行為日誌數據
SEM Mathematical Notation and Estimation
Model Specification
SEM combines a measurement model (relating latent variables to observed indicators) with a structural model (relating latent variables to each other).
Measurement Model
For each latent variable η with p indicators y:
y = Λ_y × η + εwhere:
- y: p × 1 vector of observed indicators
- Λ_y: p × m matrix of factor loadings
- η: m × 1 vector of latent variables
- ε: p × 1 vector of measurement errors (E[ε] = 0, Cov(ε) = Θ_ε)
Similarly for exogenous latent variables ξ with indicators x:
x = Λ_x × ξ + δStructural Model
η = B × η + Γ × ξ + ζwhere:
- B: m × m matrix of relationships among endogenous latents
- Γ: m × n matrix of effects of exogenous on endogenous
- ζ: structural disturbances (E[ζ] = 0, Cov(ζ) = Ψ)
Model-Implied Covariance Matrix
The key insight of SEM: given the parameters (Λ, B, Γ, Θ, Ψ), we can derive the covariance matrix Σ that the model IMPLIES the data should have:
Σ(θ) = [Σ_yy Σ_yx]
[Σ_xy Σ_xx]where each block is a function of the model parameters θ = {Λ_y, Λ_x, B, Γ, Φ, Ψ, Θ_ε, Θ_δ}.
Estimation: Maximum Likelihood
Under multivariate normality, the ML fit function is:
F_ML(θ) = log|Σ(θ)| + tr(S × Σ(θ)^(-1)) - log|S| - pwhere S is the sample covariance matrix and p is the number of observed variables. Minimize F_ML over θ to get parameter estimates.
Fit Indices
Given estimated parameters, compare Σ(θ̂) to S:
| Index | Formula | Good Fit Threshold |
|---|---|---|
| Chi-square | χ² = (N-1) × F_ML(θ̂) | p > 0.05 (often fails in large samples) |
| CFI | 1 - max(χ² - df, 0) / max(χ²_null - df_null, χ² - df, 0) | ≥ 0.95 (excellent), ≥ 0.90 (acceptable) |
| TLI | (χ²_null/df_null - χ²/df) / (χ²_null/df_null - 1) | ≥ 0.95 |
| RMSEA | √(max(χ²-df, 0) / (df × (N-1))) | ≤ 0.06 (good), ≤ 0.08 (acceptable) |
| SRMR | standardized root mean squared residual | ≤ 0.08 |
Identification
A model is identified if the parameters can be uniquely solved from the population covariance matrix. Check:
- Order condition (necessary): number of free parameters ≤ number of unique elements in S = p(p+1)/2
- Rank condition (sufficient): Jacobian of Σ(θ) has full column rank
Underidentified models cannot be estimated. Just-identified models fit perfectly (no degrees of freedom to test). Overidentified models allow hypothesis testing.
Non-Normal Data
When multivariate normality fails:
- Use robust ML (Satorra-Bentler corrected χ² and standard errors)
- Use WLSMV for categorical indicators
- Bootstrap for confidence intervals on indirect effects
Sample Size Rules of Thumb
- Minimum N = 200 for simple models
- N ≥ 10 observations per estimated parameter (Bentler & Chou, 1987)
- N ≥ 20 per parameter for complex models or non-normal data
References
- Jöreskog, K. G. (1973). A general method for estimating a linear structural equation system.
- Bollen, K. A. (1989). Structural Equations with Latent Variables.
- Kline, R. B. (2015). Principles and Practice of Structural Equation Modeling (4th ed.).
Related skills
FAQ
Does SEM prove causation?
No; SEM tests whether data are consistent with a hypothesized causal structure, and good fit means the model cannot be rejected, not that it is correct.
What fit indices does SEM use?
CFI at least 0.90, TLI at least 0.90, RMSEA at most 0.08, and SRMR at most 0.08, typically with N at least 200.