Community研究&データ分析github.com

JiamingShi-JsPhys/agent-skills

縦断統計解析パイプライン。被験者ごとに1回以上のセッションがあり、被験者間条件が設定されたパネルデータ/反復測定データに対して、記述統計、操作チェック、線形混合モデル、ラグ付きメディエーター、ランダム効果/共分散構造の感度分析などの再現可能な解析を実行します。

agent-skills とは?

このエージェントスキルは、縦断的または反復測定データ(被験者ごとに複数のセッションがあり、被験者間条件を含む)に対して、再現可能で監査可能な統計解析パイプラインを提供します。ユーザーが「LMM」「mixed model」「repeated measures」「longitudinal analysis」「mediation over time」「lagged mediator」「sensitivity analysis of RE structure」といったフレーズを発言すると起動し、YAML設定ファイルを読み込んで、記述統計、操作チェック(ANOVA)、線形混合モデル(LMM)、ラグ付きメディエーション分析、ランダム効果構造の感度分析など、有効化されたステップを順次実行します。Pythonがオーケストレーションを担当し、統計計算の大部分はR(lme4、lavaan、emmeans)に依存します。Rが利用できない場合は、該当ステップをスキップし、その理由を監査ログに記録します。最終的に、各ステップの結果と生成されたCSVファイルを報告します。対応プラットフォームはWindows、macOS、Linuxで、Python 3.9以上が必要です。このスキルは、一回限りの計算ではなく、監査証跡付きの再現可能な解析を求める研究者やデータ分析者に特に有用です。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/JiamingShi-JsPhys/agent-skills/tree/HEAD/skills/longitudinal-analysis

Installed? Explore more 研究&データ分析 skills: affaan-m/uspto-database, affaan-m/scholar-evaluation, affaan-m/literature-review · View all 6 →

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

longitudinal-analysis

縦断的/パネルデータに対して、再現可能なマルチステップ解析を実行する自己完結型スキルです。各ステップは独立して有効化・監査可能。統計的な負荷の高い処理はR(lme4 / lavaan)が担当し、Python側はオーケストレーションとR不在時のグレースフルデグラデーションを行います。

必須ワークフロー

依存関係のブートストラップ(初回使用時に実行)

初回実行前に、このスキルのランタイム依存関係を確認します。

  • 必須(Python): pandas、PyYAML。
  • オプション(Python): statsmodels、scipy(操作チェックステップ用)。
  • 必須(外部): R >= 4.0 と lme4、lavaan、emmeans、jsonlite が PATH 上にあること — lmm、mediation、sensitivity ステップに必要。

動作:

  • Python の依存関係が不足している場合 -> どのパッケージが不足しているかをユーザーに伝え、python -m pip install pandas pyyaml(操作チェックの場合は statsmodels scipy を追加)を実行するかどうかを確認します。確認後にのみインストールし、可能な限りプロジェクトローカルの仮想環境を使用します。
  • R または R パッケージが不足している場合 -> R のインストールを試みないでください。不足している R パッケージを列挙し、R に依存するステップをスキップし、その理由を監査ログに記録し、Python のみのステップを実行して結果を提供します。
  1. YAML 設定ファイルをロードします(config/examples/behavior_2x2x2.yaml を参考)。
  2. data.input が存在し、id_column / time_column が存在することを確認します。
  3. python -m src.cli run --config <path> [--step <name>] を実行します。
  4. 各ステップのステータスを報告します。スキップされた R ステップがある場合は R がインストールされていないことを意味します — 不足パッケージを列挙して停止します(インストールを試みないでください)。
  5. results/tables/*.csv と results/logs/analysis_log.jsonl をユーザーに示します。

使用タイミング

  • ユーザーがパネル/反復測定データ(被験者ごとに1回以上のセッション、被験者間条件あり)を持ち、一回限りの計算ではなく再現可能な解析を希望する場合。
  • リクエストに「LMM」「mixed model」「repeated measures」「longitudinal analysis」「mediation over time」「lagged mediator」「sensitivity analysis of RE structure」といった手法が明示されている場合。
  • 記述統計、操作チェック、またはランダム効果/共分散構造の感度分析を、監査証跡付きで生成する必要がある場合。

使用例

# 設定ファイルを検証し、有効化されているステップを一覧表示
python -m src.cli validate --config config/examples/behavior_2x2x2.yaml
python -m src.cli list-steps --config config/examples/behavior_2x2x2.yaml

# パイプライン全体、または特定のステップを実行
python -m src.cli run --config config/examples/behavior_2x2x2.yaml
python -m src.cli run --config config/examples/behavior_2x2x2.yaml --step lmm

# 生成されたテーブルをエクスポート(csv または docx)
python -m src.cli export --config config/examples/behavior_2x2x2.yaml --format csv

結果は results/tables/*.csv に保存され、各ステップの監査証跡は results/logs/analysis_log.jsonl に記録されます。

障害処理

  • ステップが skipped と報告 - R または R パッケージが不足しています。不足パッケージを列挙して停止し、インストールを試みたり手動計算で代用したりしないでください。
  • 設定ファイルが無効(validate が非ゼロ終了) - 報告されたフィールド(通常は data.input、id_column、time_column)を修正し、再検証してください。
  • パイプライン実行中にステップでエラーが発生 - それより前のステップの出力は保持され監査されます。エラーが発生したステップをそのまま報告して停止し、盲目的に再実行しないでください。
  • 予期しない終了コード - メッセージをそのまま報告してください。

パイプラインステップ

タイプモジュールR 依存性
descriptivesrc/steps/descriptive.pyなし
anova (操作チェック)src/steps/manipulation.pyなし (statsmodels を使用)
lmmsrc/steps/lmm.pyR/lmm.R (lme4 + emmeans)
mediation (ラグ付き)src/steps/mediation.pyR/mediation.R (lavaan)
sensitivitysrc/steps/sensitivity.pyR/lmm.R

制限事項

  • R パッケージ(lme4、lavaan、emmeans、jsonlite)はローカルにインストールされている必要があります。Rscript が PATH 上にない場合、パイプラインは R に依存するステップをスキップし、監査ログにその理由を記録します。
  • メディエーションのブートストラップはユーザーが選択可能(デフォルトは5000)で、実行時間はサンプルサイズに比例して増加します。

Individual skills in this repo

This repo contains 3 individual skills — each has its own dedicated page.

JiamingShi-JsPhys/agent-skills

Cross-document conflict detector. Use when the user has two or more documents, datasets, or extracted fact tables and wants to find contradictions between them. Triggers on "detect conflicts", "find contradictions", "do these documents agree", "cross-check claims", "inconsistency check", or when comparing a claim across multiple sources. Runs three detection levels: entity (numeric / boolean mismatch on the same key), clause (categorical mismatch), and argument (free-text disagreement). Emits a machine-readable conflict report in JSON / CSV / Markdown.

JiamingShi-JsPhys/agent-skills

Document evolution tracker. Use when the user has a family of document versions (timestamped or sequentially named files) and wants to see how the document changed over time -- which paragraphs / lines / sentences were added, removed, or modified between consecutive versions, and how a set of named concepts (or auto-detected headings) evolved (introduced / retained / modified / dropped). Triggers on "track document changes", "version history", "what changed between drafts", "concept lineage", "document evolution". Emits a Markdown + JSON timeline.

JiamingShi-JsPhys/agent-skills

State manager for multi-dimensional computational experiments. Iterate a parameter grid over many rounds, snapshot declared critical files each round, audit every round (params, hashes, timestamps, status), and roll back to any round non-destructively. Use it when a workflow runs hundreds of rounds across multiple parameter dimensions and needs per-round snapshots, full audit trail, and arbitrary rollback - e.g. longitudinal studies, parameter scans, or symbolic/ numerical sweeps calling external solvers (Mathematica, GAP, SymPy, custom scripts).

関連スキル