contribution-analysis
Calculate the relative contribution of different factors to a response variable using R² decomposition
Install / Use
npx skills add benchflow-ai/skillsbench --skill contribution-analysisInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
AutomationSupported Platforms
Our assessment of contribution-analysis
contribution-analysis scores 85/100 on our quality scale, 1526th of 2,659 Automation skills we index.
Its SKILL.md is 2.9 KB long, well organised into 12 sections with 3 code examples: a solid amount of guidance for an agent.
With 1,813 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated about 2 months ago, so contribution-analysis is actively maintained.
- It is released under the Apache-2.0 license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
contribution-analysis compared with similar skills
All 4 of these similar skills score higher than contribution-analysis; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| contribution-analysis (this skill)by benchflow-ai | 85 | 1.8k | 2mo ago | SKILL.md |
| Agent-Reachby Panniantong | 100 | 86.4k | 15d ago | CLAUDE.md |
| headroomby headroomlabs-ai | 100 | 74.2k | today | CLAUDE.md |
| rufloby ruvnet | 100 | 73.6k | today | CLAUDE.md |
| Scraplingby D4Vinci | 100 | 84.6k | today | MCP Server |
Frequently asked questions
- How do I install contribution-analysis?
- Run
npx skills add benchflow-ai/skillsbench --skill contribution-analysis. The install tabs above show the steps for each supported agent. - Which AI agents does contribution-analysis work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is contribution-analysis safe to use?
- It is Apache-2.0-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is contribution-analysis still maintained?
- The repository was last updated about 2 months ago, so contribution-analysis is actively maintained.
Skill content
View source on GitHubname: contribution-analysis description: 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. license: MIT
Contribution Analysis Guide
Overview
Contribution analysis quantifies how much each factor contributes to explaining the variance of a response variable. This skill focuses on R² decomposition method.
Complete Workflow
When you have multiple correlated variables that belong to different categories:
import pandas as pd
import numpy as np
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LinearRegression
from factor_analyzer import FactorAnalyzer
# Step 1: Combine ALL variables into one matrix
pca_vars = ['Var1', 'Var2', 'Var3', 'Var4', 'Var5', 'Var6', 'Var7', 'Var8']
X = df[pca_vars].values
y = df['ResponseVariable'].values
# Step 2: Standardize
scaler = StandardScaler()
X_scaled = scaler.fit_transform(X)
# Step 3: Run ONE global PCA on all variables together
fa = FactorAnalyzer(n_factors=4, rotation='varimax')
fa.fit(X_scaled)
scores = fa.transform(X_scaled)
# Step 4: R² decomposition on factor scores
def calc_r2(X, y):
model = LinearRegression()
model.fit(X, y)
y_pred = model.predict(X)
ss_res = np.sum((y - y_pred) ** 2)
ss_tot = np.sum((y - np.mean(y)) ** 2)
return 1 - (ss_res / ss_tot)
full_r2 = calc_r2(scores, y)
# Step 5: Calculate contribution of each factor
contrib_0 = full_r2 - calc_r2(scores[:, [1, 2, 3]], y)
contrib_1 = full_r2 - calc_r2(scores[:, [0, 2, 3]], y)
contrib_2 = full_r2 - calc_r2(scores[:, [0, 1, 3]], y)
contrib_3 = full_r2 - calc_r2(scores[:, [0, 1, 2]], y)
R² Decomposition Method
The contribution of each factor is calculated by comparing the full model R² with the R² when that factor is removed:
Contribution_i = R²_full - R²_without_i
Output Format
contributions = {
'Category1': contrib_0 * 100,
'Category2': contrib_1 * 100,
'Category3': contrib_2 * 100,
'Category4': contrib_3 * 100
}
dominant = max(contributions, key=contributions.get)
dominant_pct = round(contributions[dominant])
with open('output.csv', 'w') as f:
f.write('variable,contribution\n')
f.write(f'{dominant},{dominant_pct}\n')
Common Issues
| Issue | Cause | Solution | |-------|-------|----------| | Negative contribution | Suppressor effect | Check for multicollinearity | | Contributions don't sum to R² | Normal behavior | R² decomposition is approximate | | Very small contributions | Factor not important | May be negligible driver |
Best Practices
- Run ONE global PCA on all variables together, not separate PCA per category
- Use factor_analyzer with varimax rotation
- Map factors to category names based on loadings interpretation
- Report contribution as percentage
- Identify the dominant (largest) factor
Related Skills
Agent-Reach
86.4kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
headroom
74.2kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
ruflo
73.6k🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
Scrapling
84.6k🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
