factor-decomposition-analysis

Factor Decomposition Analysis Tool (Finance): Decomposes financial metrics (e.g., revenue, cost, profit, ROE) into multiple contributing factors and quantifies each factor’s impact size and direction, and provides a standardized data-entry template. Supports chain-replacement and difference methods, works with multiplicative models (R=a×b×c) and additive models (R=a+b+c), and outputs factor impacts, impact shares, directions of change, analysis conclusions, and multi-period trend charts, with built-in data validation. Suitable for factor decomposition, chain-replacement, difference methods, indicator breakdowns, DuPont analysis, etc.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "factor-decomposition-analysis" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-c1f460e2283c360b5ddd850b8740c33725d7168ec31a9a0a62740e55d77e90c1. Verify the upstream source and version against https://skillhub.cn/skills/user_cd97370d/factor-decomposition-analysis before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Factor Decomposition Analysis Tool (Finance): Decomposes financial metrics (e.g., revenue, cost, profit, ROE) into multiple contributing factors and quantifies each factor’s impact size and direction, and provides a standardized data-entry template. Supports chain-replacement and difference methods, works with multiplicative models (R=a×b×c) and additive models (R=a+b+c), and outputs factor impacts, impact shares, directions of change, analysis conclusions, and multi-period trend charts, with built-in data validation. Suitable for factor decomposition, chain-replacement, difference methods, indicator breakdowns, DuPont analysis, etc.

0 Downloads

Introduction source: third_party · user_cd97370d · 1.0.0 Reference

SkillPi interpretation

Tasks
Translation pending; see source documentation.
Audience
Translation pending; see source documentation.
Limits and differences
Translation pending; see source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: factor-decomposition-analysis
description: 财务分析中的「因素分解法」自动化工具。当用户需要把某个财务指标(收入、成本、利润、ROE 等)拆分为多个因素,量化每个因素变动对总指标的影响程度与方向,或需要一份规范的 Excel 数据录入模板时使用。支持连环替代法、差额计算法,支持乘法模型(R=a×b×c)与加法模型(R=a+b+c),自动输出影响值/影响占比/方向/分析结论/多期趋势图,并内置数据校验。触发词:因素分解、连环替代法、差额计算法、因素分析法、指标拆解、多因素影响、杜邦分析、敏感度分析、财务因素模板。
agent_created: true

财务因素分解法自动化分析

把目标财务指标按定义式拆成多个驱动因素,自动计算每个因素变动对总指标的影响值、影响占比、影响方向,并给出综合分析结论与多期趋势。

适用场景

  • 用户说:"分析一下 ROE 为什么变了""成本上升是哪个因素导致的""把这个指标拆开看看各因素影响""做因素分析 / 连环替代"。
  • 用户需要一份可直接填写的 Excel 数据模板来规范底稿。
  • 用户要做杜邦分析、收入/利润动因分析、成本构成分析等多因素影响分析。

两种模型(先判断是哪种)

模型 定义式 典型指标 因素顺序是否影响结果
乘法模型 R = 因素1 × 因素2 × … 收入=销量×单价;ROE=净利率×周转率×权益乘数;材料成本=产量×单耗×单价 是(连环替代法受顺序影响)
加法模型 R = 因素1 + 因素2 + … 总成本=材料+人工+制造费用;期间费用=销售+管理+财务 否(顺序无关,影响值=差额)

顺序依据(仅乘法模型):按经济因果 量 → 价/效率 → 结构/杠杆(如 销量→单价→单位成本)。顺序即模板里因素从左到右的列顺序。

交付物(本技能自带,开箱即用)

  • assets/因素分解法_数据模板.xlsx —— 4 个工作表:使用说明 / 数据录入(空白,含下拉+数值校验+计算R与偏差校验公式+条件格式)/ 示例-乘法模型(杜邦ROE 4期)/ 示例-加法模型(总成本 3期)。
  • references/factors_analysis.html —— 单文件分析工具,浏览器直接打开。支持:
    1. 连环替代法 / 差额计算法 / 两者对比 三种模式;乘法 + 加法模型;2~N 因素。
    2. 自动计算各因素影响值、影响占比、方向(有利↑/不利↓)。
    3. 结果表 + 自动生成综合分析结论(最大有利/不利因素、正负抵消)。
    4. 多期相邻期对比 + 累计对比 + 内联 SVG 趋势图。
    5. 数据校验(空值/非数字/因素数不匹配/目标与计算值偏差>0.5% 告警/乘法 0 值告警)。
    6. 一键导入 Excel 模板:点「📥 导入 Excel 模板」选 xlsx,自动还原模型/方法/因素名/各期数据并执行分析(用 SheetJS CDN,离线优雅降级)。

工作流

路径 A — 直接用现成工具(最快)

  1. 打开 references/factors_analysis.html(双击或浏览器打开)。
  2. 点「加载示例数据」体验;或点「📥 导入 Excel 模板」导入 assets/因素分解法_数据模板.xlsx(或用户自己填好的同结构文件)。
  3. 也可在页面表格手动录入:选模型/方法 → 填因素名 → 填各期数值 → 点「开始分析」。
  4. 看结果表、结论、趋势图;可「导出结果 CSV」「打印 / 另存 PDF」。

路径 B — 先发 Excel 模板给用户填写,再分析

  1. 把 assets/因素分解法_数据模板.xlsx 发给用户,让其按「使用说明」填「数据录入」表(因素名第4行从左到右连续填,未用列留空;各期数值与名称列对齐)。
  2. 回收 xlsx 后,用路径 A 第 2 步导入即可自动出结果。

路径 C — 重新生成/定制模板

  • 改 references/build_template.py 里的示例数据、因素数或样式,重跑:
    python references/build_template.py          # 输出到 assets/
    python references/build_template.py 自定义路径.xlsx   # 自定义输出
  • 依赖 openpyxl(pip install openpyxl)。脚本输出路径已改为相对技能目录,打包后自包含。

算法要点(务必保持一致)

  • 连环替代法:基期值逐个替换为报告期值,相邻两次结果之差即该因素影响值;所有因素影响值之和 = 总变动(R1−R0)。
  • 差额计算法:乘法模型第 i 因素影响 = (cᵢ−bᵢ) × ∏前序当期 × ∏后序基期;加法模型 = (cᵢ−bᵢ)。与连环替代法数值严格一致。
  • 校验规则(已在工具内实现,改算法时必须保留):
    • Σ影响值 == 总变动(容差 1e-6)
    • 连环替代法影响值 与 差额计算法影响值 逐项一致(容差 1e-9)

验证方法

  • 改完算法后,用 Node 跑一致性校验(连环替代 vs 差额,2/3 因素乘法 + 加法),确认 Σ影响值==总变动 且两法逐项一致:
    function decompose(base,cur,model){
      const calc=a=> model==="mul"?a.reduce((x,y)=>x*y,1):a.reduce((x,y)=>x+y,0);
      const R0=calc(base),R1=calc(cur);
      const n=base.length,seq=[base.slice()]; let step=base.slice();
      for(let i=0;i<n;i++){step=step.slice();step[i]=cur[i];seq.push(step.slice());}
      const seqV=seq.map(calc),chain=[],diff=[];
      for(let i=0;i<n;i++) chain.push(seqV[i+1]-seqV[i]);
      if(model==="mul"){for(let i=0;i<n;i++){let b=1,a=1;for(let j=0;j<i;j++)b*=cur[j];for(let j=i+1;j<n;j++)a*=base[j];diff.push((cur[i]-base[i])*b*a);}}
      else for(let i=0;i<n;i++) diff.push(cur[i]-base[i]);
      return {chain,diff,delta:R1-R0};
    }
  • Excel 模板:用 openpyxl 回读,确认公式、数据验证、条件格式就位;用 Python 模拟导入解析(坐标映射 r,c 0-indexed,第4行取因素名、第6行起取期间)验证能正确还原状态。

注意事项

  • 乘法模型避免填 0(会使目标为 0、占比无意义)。
  • 连环替代法结果依赖因素列顺序,务必按业务逻辑排(量→价→结构)。
  • 目标 R 应等于各因素运算结果;模板"偏差校验"列会在偏差>0.5% 时报橙。导入 HTML 时若目标格是公式(未缓存值),工具会自动按因素计算值回填。
  • 离线打开 HTML 时,若无法加载 SheetJS CDN,导入按钮会提示改用手动录入,不影响其他功能。

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value92/100

Areas to improve

  • 缺少 When to Use 显式章节 Reported severity: Minor

    适用场景描述充分但未使用标准章节名 When to Use

    Recommendation: 建议将「适用场景」改为「When to Use」以符合规范

Highlights

  • 提供财务因素分解法自动化工具,支持连环替代法与差额计算法
  • 覆盖乘法模型与加法模型,适用于收入、成本、利润、ROE 等多因素分析
  • 内置 Excel 模板与 HTML 分析工具,开箱即用,满足财务分析高频刚需
Trigger Precision95/100

Highlights

  • 触发词完整覆盖因素分解、连环替代法、差额计算法、杜邦分析等核心术语
  • 边界清晰,不易与其他财务分析 Skill 混淆
Structure and Standards93/100

Areas to improve

  • 文档较长 Reported severity: Minor

    内容详尽但接近 500 行限制

    Recommendation: 可考虑将部分算法细节移至附录或引用文件

Highlights

  • 结构完整,包含模型说明、工作流、算法要点、验证方法等关键章节
  • frontmatter 完整,单文件未超限,有端到端示例
Execution Reliability94/100

Highlights

  • 提供 Excel 模板与 HTML 分析工具,支持一键导入与数据校验
  • 算法逻辑严谨,内置一致性校验,异常处理完善
  • 支持离线使用与优雅降级,工具来源明确
Evidence Verifiability (mean of the first four)94/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

  • Install or fetch external dependencies

    Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.

    Mentioned in main document · lines 51

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.