Skill Tracer
Skills › Knowledge Work Plugins › statistical-analysis

statistical-analysis

skill · 245 lines · Apache-2.0 · data/skills/statistical-analysis/SKILL.md

The facts

Its description

Apply statistical methods including descriptive stats, trend analysis, outlier detection, and hypothesis testing. Use when analyzing distributions, testing for significance, detecting anomalies, computing correlations, or interpreting statistical results.

The description the agent reads to decide when to use it.

From its settingsline 3

When it starts

This skill is marked `user-invocable: false`, so it is not picked from something a person says; it is loaded by another skill that needs statistical methods. Its description covers descriptive stats, trend analysis, outlier detection, and hypothesis testing for distributions, significance, anomalies, and correlations.

A model's summary of when it is used.

A model's reading

Who can start it

Only the agent

Only the agent starts it. It's hidden from your commands.

From its settingsline 4

Licence

Apache-2.0, from data/LICENSE

The terms its author shares it under, which let it be shown here.

From the repositorylicence text

The text

Open on GitHub
1---
2name: statistical-analysis
3description: Apply statistical methods including descriptive stats, trend analysis, outlier detection, and hypothesis testing. Use when analyzing distributions, testing for significance, detecting anomalies, computing correlations, or interpreting statistical results.
4user-invocable: false
5---
6
7# Statistical Analysis Skill
8
9Descriptive statistics, trend analysis, outlier detection, hypothesis testing, and guidance on when to be cautious about statistical claims.

Statistical Analysis Skill

Descriptive statistics, trend analysis, outlier detection, hypothesis testing, and guidance on when to be cautious about statistical claims.

Raw lines 1 to 10
11## Descriptive Statistics Methodology

Descriptive Statistics Methodology

Raw lines 11 to 12
13### Central Tendency
15Choose the right measure of center based on the data:
17| Situation | Use | Why |
18|---|---|---|
19| Symmetric distribution, no outliers | Mean | Most efficient estimator |
20| Skewed distribution | Median | Robust to outliers |
21| Categorical or ordinal data | Mode | Only option for non-numeric |
22| Highly skewed with outliers (e.g., revenue per user) | Median + mean | Report both; the gap shows skew |
24**Always report mean and median together for business metrics.** If they diverge significantly, the data is skewed and the mean alone is misleading.

Central Tendency

Choose the right measure of center based on the data:

SituationUseWhy
Symmetric distribution, no outliersMeanMost efficient estimator
Skewed distributionMedianRobust to outliers
Categorical or ordinal dataModeOnly option for non-numeric
Highly skewed with outliers (e.g., revenue per user)Median + meanReport both; the gap shows skew

Always report mean and median together for business metrics. If they diverge significantly, the data is skewed and the mean alone is misleading.

Raw lines 13 to 25
26### Spread and Variability
28- **Standard deviation**: How far values typically fall from the mean. Use with normally distributed data.
29- **Interquartile range (IQR)**: Distance from p25 to p75. Robust to outliers. Use with skewed data.
30- **Coefficient of variation (CV)**: StdDev / Mean. Use to compare variability across metrics with different scales.
31- **Range**: Max minus min. Sensitive to outliers but gives a quick sense of data extent.

Spread and Variability

  • Standard deviation: How far values typically fall from the mean. Use with normally distributed data.
  • Interquartile range (IQR): Distance from p25 to p75. Robust to outliers. Use with skewed data.
  • Coefficient of variation (CV): StdDev / Mean. Use to compare variability across metrics with different scales.
  • Range: Max minus min. Sensitive to outliers but gives a quick sense of data extent.
Raw lines 26 to 32
33### Percentiles for Business Context
35Report key percentiles to tell a richer story than mean alone:
37```
38p1: Bottom 1% (floor / minimum typical value)
39p5: Low end of normal range
40p25: First quartile
41p50: Median (typical user)
42p75: Third quartile
43p90: Top 10% / power users
44p95: High end of normal range
45p99: Top 1% / extreme users
46```
48**Example narrative**: "The median session duration is 4.2 minutes, but the top 10% of users spend over 22 minutes per session, pulling the mean up to 7.8 minutes."

Percentiles for Business Context

Report key percentiles to tell a richer story than mean alone:

p1:   Bottom 1% (floor / minimum typical value)
p5:   Low end of normal range
p25:  First quartile
p50:  Median (typical user)
p75:  Third quartile
p90:  Top 10% / power users
p95:  High end of normal range
p99:  Top 1% / extreme users

Example narrative: "The median session duration is 4.2 minutes, but the top 10% of users spend over 22 minutes per session, pulling the mean up to 7.8 minutes."

Raw lines 33 to 49
50### Describing Distributions
52Characterize every numeric distribution you analyze:
54- **Shape**: Normal, right-skewed, left-skewed, bimodal, uniform, heavy-tailed
55- **Center**: Mean and median (and the gap between them)
56- **Spread**: Standard deviation or IQR
57- **Outliers**: How many and how extreme
58- **Bounds**: Is there a natural floor (zero) or ceiling (100%)?

Describing Distributions

Characterize every numeric distribution you analyze:

  • Shape: Normal, right-skewed, left-skewed, bimodal, uniform, heavy-tailed
  • Center: Mean and median (and the gap between them)
  • Spread: Standard deviation or IQR
  • Outliers: How many and how extreme
  • Bounds: Is there a natural floor (zero) or ceiling (100%)?
Raw lines 50 to 59
60## Trend Analysis and Forecasting

Trend Analysis and Forecasting

Raw lines 60 to 61
62### Identifying Trends
64**Moving averages** to smooth noise:
65```python
66# 7-day moving average (good for daily data with weekly seasonality)
67df['ma_7d'] = df['metric'].rolling(window=7, min_periods=1).mean()
69# 28-day moving average (smooths weekly AND monthly patterns)
70df['ma_28d'] = df['metric'].rolling(window=28, min_periods=1).mean()
71```
73**Period-over-period comparison**:
74- Week-over-week (WoW): Compare to same day last week
75- Month-over-month (MoM): Compare to same month prior
76- Year-over-year (YoY): Gold standard for seasonal businesses
77- Same-day-last-year: Compare specific calendar day
79**Growth rates**:
80```
81Simple growth: (current - previous) / previous
82CAGR: (ending / beginning) ^ (1 / years) - 1
83Log growth: ln(current / previous) -- better for volatile series
84```

Identifying Trends

Moving averages to smooth noise:

# 7-day moving average (good for daily data with weekly seasonality)
df['ma_7d'] = df['metric'].rolling(window=7, min_periods=1).mean()

# 28-day moving average (smooths weekly AND monthly patterns)
df['ma_28d'] = df['metric'].rolling(window=28, min_periods=1).mean()

Period-over-period comparison:

  • Week-over-week (WoW): Compare to same day last week
  • Month-over-month (MoM): Compare to same month prior
  • Year-over-year (YoY): Gold standard for seasonal businesses
  • Same-day-last-year: Compare specific calendar day

Growth rates:

Simple growth: (current - previous) / previous
CAGR: (ending / beginning) ^ (1 / years) - 1
Log growth: ln(current / previous)  -- better for volatile series
Raw lines 62 to 85
86### Seasonality Detection
88Check for periodic patterns:
891. Plot the raw time series -- visual inspection first
902. Compute day-of-week averages: is there a clear weekly pattern?
913. Compute month-of-year averages: is there an annual cycle?
924. When comparing periods, always use YoY or same-period comparisons to avoid conflating trend with seasonality

Seasonality Detection

Check for periodic patterns:

  1. Plot the raw time series -- visual inspection first
  2. Compute day-of-week averages: is there a clear weekly pattern?
  3. Compute month-of-year averages: is there an annual cycle?
  4. When comparing periods, always use YoY or same-period comparisons to avoid conflating trend with seasonality
Raw lines 86 to 93
94### Forecasting (Simple Methods)
96For business analysts (not data scientists), use straightforward methods:
98- **Naive forecast**: Tomorrow = today. Use as a baseline.
99- **Seasonal naive**: Tomorrow = same day last week/year.
100- **Linear trend**: Fit a line to historical data. Only for clearly linear trends.
101- **Moving average forecast**: Use trailing average as the forecast.
103**Always communicate uncertainty**. Provide a range, not a point estimate:
104- "We expect 10K-12K signups next month based on the 3-month trend"
105- NOT "We will get exactly 11,234 signups next month"
107**When to escalate to a data scientist**: Non-linear trends, multiple seasonalities, external factors (marketing spend, holidays), or when forecast accuracy matters for resource allocation.

Forecasting (Simple Methods)

For business analysts (not data scientists), use straightforward methods:

  • Naive forecast: Tomorrow = today. Use as a baseline.
  • Seasonal naive: Tomorrow = same day last week/year.
  • Linear trend: Fit a line to historical data. Only for clearly linear trends.
  • Moving average forecast: Use trailing average as the forecast.

Always communicate uncertainty. Provide a range, not a point estimate:

  • "We expect 10K-12K signups next month based on the 3-month trend"
  • NOT "We will get exactly 11,234 signups next month"

When to escalate to a data scientist: Non-linear trends, multiple seasonalities, external factors (marketing spend, holidays), or when forecast accuracy matters for resource allocation.

Raw lines 94 to 108
109## Outlier and Anomaly Detection

Outlier and Anomaly Detection

Raw lines 109 to 110
111### Statistical Methods
113**Z-score method** (for normally distributed data):
114```python
115z_scores = (df['value'] - df['value'].mean()) / df['value'].std()
116outliers = df[abs(z_scores) > 3] # More than 3 standard deviations
117```
119**IQR method** (robust to non-normal distributions):
120```python
121Q1 = df['value'].quantile(0.25)
122Q3 = df['value'].quantile(0.75)
123IQR = Q3 - Q1
124lower_bound = Q1 - 1.5 * IQR
125upper_bound = Q3 + 1.5 * IQR
126outliers = df[(df['value'] < lower_bound) | (df['value'] > upper_bound)]
127```
129**Percentile method** (simplest):
130```python
131outliers = df[(df['value'] < df['value'].quantile(0.01)) |
132 (df['value'] > df['value'].quantile(0.99))]
133```

Statistical Methods

Z-score method (for normally distributed data):

z_scores = (df['value'] - df['value'].mean()) / df['value'].std()
outliers = df[abs(z_scores) > 3]  # More than 3 standard deviations

IQR method (robust to non-normal distributions):

Q1 = df['value'].quantile(0.25)
Q3 = df['value'].quantile(0.75)
IQR = Q3 - Q1
lower_bound = Q1 - 1.5 * IQR
upper_bound = Q3 + 1.5 * IQR
outliers = df[(df['value'] < lower_bound) | (df['value'] > upper_bound)]

Percentile method (simplest):

outliers = df[(df['value'] < df['value'].quantile(0.01)) |
              (df['value'] > df['value'].quantile(0.99))]
Raw lines 111 to 134
135### Handling Outliers
137Do NOT automatically remove outliers. Instead:
1391. **Investigate**: Is this a data error, a genuine extreme value, or a different population?
1402. **Data errors**: Fix or remove (e.g., negative ages, timestamps in year 1970)
1413. **Genuine extremes**: Keep them but consider using robust statistics (median instead of mean)
1424. **Different population**: Segment them out for separate analysis (e.g., enterprise vs. SMB customers)
144**Report what you did**: "We excluded 47 records (0.3%) with transaction amounts >$50K, which represent bulk enterprise orders analyzed separately."

Handling Outliers

Do NOT automatically remove outliers. Instead:

  1. Investigate: Is this a data error, a genuine extreme value, or a different population?
  2. Data errors: Fix or remove (e.g., negative ages, timestamps in year 1970)
  3. Genuine extremes: Keep them but consider using robust statistics (median instead of mean)
  4. Different population: Segment them out for separate analysis (e.g., enterprise vs. SMB customers)

Report what you did: "We excluded 47 records (0.3%) with transaction amounts >$50K, which represent bulk enterprise orders analyzed separately."

Raw lines 135 to 145
146### Time Series Anomaly Detection
148For detecting unusual values in a time series:
1501. Compute expected value (moving average or same-period-last-year)
1512. Compute deviation from expected
1523. Flag deviations beyond a threshold (typically 2-3 standard deviations of the residuals)
1534. Distinguish between point anomalies (single unusual value) and change points (sustained shift)

Time Series Anomaly Detection

For detecting unusual values in a time series:

  1. Compute expected value (moving average or same-period-last-year)
  2. Compute deviation from expected
  3. Flag deviations beyond a threshold (typically 2-3 standard deviations of the residuals)
  4. Distinguish between point anomalies (single unusual value) and change points (sustained shift)
Raw lines 146 to 154
155## Hypothesis Testing Basics

Hypothesis Testing Basics

Raw lines 155 to 156
157### When to Use
159Use hypothesis testing when you need to determine whether an observed difference is likely real or could be due to random chance. Common scenarios:
161- A/B test results: Is variant B actually better than A?
162- Before/after comparison: Did the product change actually move the metric?
163- Segment comparison: Do enterprise customers really have higher retention?

When to Use

Use hypothesis testing when you need to determine whether an observed difference is likely real or could be due to random chance. Common scenarios:

  • A/B test results: Is variant B actually better than A?
  • Before/after comparison: Did the product change actually move the metric?
  • Segment comparison: Do enterprise customers really have higher retention?
Raw lines 157 to 164
165### The Framework
1671. **Null hypothesis (H0)**: There is no difference (the default assumption)
1682. **Alternative hypothesis (H1)**: There is a difference
1693. **Choose significance level (alpha)**: Typically 0.05 (5% chance of false positive)
1704. **Compute test statistic and p-value**
1715. **Interpret**: If p < alpha, reject H0 (evidence of a real difference)

The Framework

  1. Null hypothesis (H0): There is no difference (the default assumption)
  2. Alternative hypothesis (H1): There is a difference
  3. Choose significance level (alpha): Typically 0.05 (5% chance of false positive)
  4. Compute test statistic and p-value
  5. Interpret: If p < alpha, reject H0 (evidence of a real difference)
Raw lines 165 to 172
173### Common Tests
175| Scenario | Test | When to Use |
176|---|---|---|
177| Compare two group means | t-test (independent) | Normal data, two groups |
178| Compare two group proportions | z-test for proportions | Conversion rates, binary outcomes |
179| Compare paired measurements | Paired t-test | Before/after on same entities |
180| Compare 3+ group means | ANOVA | Multiple segments or variants |
181| Non-normal data, two groups | Mann-Whitney U test | Skewed metrics, ordinal data |
182| Association between categories | Chi-squared test | Two categorical variables |

Common Tests

ScenarioTestWhen to Use
Compare two group meanst-test (independent)Normal data, two groups
Compare two group proportionsz-test for proportionsConversion rates, binary outcomes
Compare paired measurementsPaired t-testBefore/after on same entities
Compare 3+ group meansANOVAMultiple segments or variants
Non-normal data, two groupsMann-Whitney U testSkewed metrics, ordinal data
Association between categoriesChi-squared testTwo categorical variables
Raw lines 173 to 183
184### Practical Significance vs. Statistical Significance
186**Statistical significance** means the difference is unlikely due to chance.
188**Practical significance** means the difference is large enough to matter for business decisions.
190A difference can be statistically significant but practically meaningless (common with large samples). Always report:
191- **Effect size**: How big is the difference? (e.g., "Variant B improved conversion by 0.3 percentage points")
192- **Confidence interval**: What's the range of plausible true effects?
193- **Business impact**: What does this translate to in revenue, users, or other business terms?

Practical Significance vs. Statistical Significance

Statistical significance means the difference is unlikely due to chance.

Practical significance means the difference is large enough to matter for business decisions.

A difference can be statistically significant but practically meaningless (common with large samples). Always report:

  • Effect size: How big is the difference? (e.g., "Variant B improved conversion by 0.3 percentage points")
  • Confidence interval: What's the range of plausible true effects?
  • Business impact: What does this translate to in revenue, users, or other business terms?
Raw lines 184 to 194
195### Sample Size Considerations
197- Small samples produce unreliable results, even with significant p-values
198- Rule of thumb for proportions: Need at least 30 events per group for basic reliability
199- For detecting small effects (e.g., 1% conversion rate change), you may need thousands of observations per group
200- If your sample is small, say so: "With only 200 observations per group, we have limited power to detect effects smaller than X%"

Sample Size Considerations

  • Small samples produce unreliable results, even with significant p-values
  • Rule of thumb for proportions: Need at least 30 events per group for basic reliability
  • For detecting small effects (e.g., 1% conversion rate change), you may need thousands of observations per group
  • If your sample is small, say so: "With only 200 observations per group, we have limited power to detect effects smaller than X%"
Raw lines 195 to 201
202## When to Be Cautious About Statistical Claims

When to Be Cautious About Statistical Claims

Raw lines 202 to 203
204### Correlation Is Not Causation
206When you find a correlation, explicitly consider:
207- **Reverse causation**: Maybe B causes A, not A causes B
208- **Confounding variables**: Maybe C causes both A and B
209- **Coincidence**: With enough variables, spurious correlations are inevitable
211**What you can say**: "Users who use feature X have 30% higher retention"
212**What you cannot say without more evidence**: "Feature X causes 30% higher retention"

Correlation Is Not Causation

When you find a correlation, explicitly consider:

  • Reverse causation: Maybe B causes A, not A causes B
  • Confounding variables: Maybe C causes both A and B
  • Coincidence: With enough variables, spurious correlations are inevitable

What you can say: "Users who use feature X have 30% higher retention" What you cannot say without more evidence: "Feature X causes 30% higher retention"

Raw lines 204 to 213
214### Multiple Comparisons Problem
216When you test many hypotheses, some will be "significant" by chance:
217- Testing 20 metrics at p=0.05 means ~1 will be falsely significant
218- If you looked at many segments before finding one that's different, note that
219- Adjust for multiple comparisons with Bonferroni correction (divide alpha by number of tests) or report how many tests were run

Multiple Comparisons Problem

When you test many hypotheses, some will be "significant" by chance:

  • Testing 20 metrics at p=0.05 means ~1 will be falsely significant
  • If you looked at many segments before finding one that's different, note that
  • Adjust for multiple comparisons with Bonferroni correction (divide alpha by number of tests) or report how many tests were run
Raw lines 214 to 220
221### Simpson's Paradox
223A trend in aggregated data can reverse when data is segmented:
224- Always check whether the conclusion holds across key segments
225- Example: Overall conversion goes up, but conversion goes down in every segment -- because the mix shifted toward a higher-converting segment

Simpson's Paradox

A trend in aggregated data can reverse when data is segmented:

  • Always check whether the conclusion holds across key segments
  • Example: Overall conversion goes up, but conversion goes down in every segment -- because the mix shifted toward a higher-converting segment
Raw lines 221 to 226
227### Survivorship Bias
229You can only analyze entities that "survived" to be in your dataset:
230- Analyzing active users ignores those who churned
231- Analyzing successful companies ignores those that failed
232- Always ask: "Who is missing from this dataset, and would their inclusion change the conclusion?"

Survivorship Bias

You can only analyze entities that "survived" to be in your dataset:

  • Analyzing active users ignores those who churned
  • Analyzing successful companies ignores those that failed
  • Always ask: "Who is missing from this dataset, and would their inclusion change the conclusion?"
Raw lines 227 to 233
234### Ecological Fallacy
236Aggregate trends may not apply to individuals:
237- "Countries with higher X have higher Y" does NOT mean "individuals with higher X have higher Y"
238- Be careful about applying group-level findings to individual cases

Ecological Fallacy

Aggregate trends may not apply to individuals:

  • "Countries with higher X have higher Y" does NOT mean "individuals with higher X have higher Y"
  • Be careful about applying group-level findings to individual cases
Raw lines 234 to 239
240### Anchoring on Specific Numbers
242Be wary of false precision:
243- "Churn will be 4.73% next quarter" implies more certainty than is warranted
244- Prefer ranges: "We expect churn between 4-6% based on historical patterns"
245- Round appropriately: "About 5%" is often more honest than "4.73%"

Anchoring on Specific Numbers

Be wary of false precision:

  • "Churn will be 4.73% next quarter" implies more certainty than is warranted
  • Prefer ranges: "We expect churn between 4-6% based on historical patterns"
  • Round appropriately: "About 5%" is often more honest than "4.73%"
Raw lines 240 to 245

From anthropics/knowledge-work-plugins at 2574e29, 2026-10-27. Skills read by DeepSeek V4.1 Flash on 2026-11-04. Summary and techniques by Claude Opus 5.5 on 2026-11-06.