skill

Statistical Analysis

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.

Anthropic4.80+ installsVetted

About

# Statistical Analysis Skill

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

## Descriptive Statistics Methodology

### Central Tendency

Choose the right measure of center based on the data:

| Situation | Use | Why | |---|---|---| | Symmetric distribution, no outliers | Mean | Most efficient estimator | | Skewed distribution | Median | Robust to outliers | | Categorical or ordinal data | Mode | Only option for non-numeric | | Highly skewed with outliers (e.g., revenue per user) | Median + mean | Report 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.

### 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.

### 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."

### 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%)?

## Trend Analysis and Forecasting

### Identifying Trends

**Moving averages** to smooth noise: ```python # 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 ```

### 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

### 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.

## Outlier and Anomaly Detection

### Statistical Methods

**Z-score method** (for normally distributed data): ```python 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): ```python 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): ```python outliers = df[(df['value'] < df['value'].quantile(0.01)) | (df['value'] > df['value'].quantile(0.99))] ```

### 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.

Install

Run this command

git clone https://github.com/anthropics/knowledge-work-plugins && cp -r knowledge-work-plugins/data/skills/statistical-analysis ~/.claude/skills/

Works with

claude appclaude codeclaude apicursorcodexwindsurfclinezed

Manual steps

Clone the repository and copy the `data/skills/statistical-analysis` folder into your Claude skills directory. Compatible with Claude Code, Cursor, Codex, and any Agent Skills-compatible agent.

View source
License: Apache-2.0By Anthropic

Frequently asked questions

What is the Statistical Analysis skill?

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.

How do I install Statistical Analysis?

Run this in your terminal:

git clone https://github.com/anthropics/knowledge-work-plugins && cp -r knowledge-work-plugins/data/skills/statistical-analysis ~/.claude/skills/
Which AI tools does Statistical Analysis work with?

It works with claude_app, claude_code, claude_api, cursor, codex, windsurf, cline, zed.

Who made Statistical Analysis?

Anthropic, released under the Apache-2.0 license.

Is Statistical Analysis free?

Yes, it is free to use under the Apache-2.0 license.

Related assets

More curated picks in Data & Analytics.

All Statistical Analysis alternatives →
skillclaude_appclaude_codeclaude_api
npx skills add google/agents-cli
Google Agents Cli Observability
This skill should be used when the user wants to "set up tracing", "monitor my agent", "configure logging", "add observability", "debug production tra…357,631+
skillclaude_appclaude_codeclaude_api
npx skills add prisma/skills
Prisma Driver Adapter Implementation
Required reference for Prisma ORM 7 SQL driver adapter work. Use when implementing or modifying adapters, adding database drivers, or touching SqlDriv…300,037+
skillclaude_appclaude_codeclaude_api
npx skills add neondatabase/agent-skills
Neon Postgres
Guides and best practices for working with Lakebase Postgres on Neon: connections, pooled vs direct, schema migrations, branching, autoscaling, scale-…187,765+
skillclaude_appclaude_codeclaude_api
npx skills add firebase/agent-skills
Firebase Basics
Provides foundational Firebase CLI setup, CLI installation, version checks (`firebase-tools@latest --version`), CLI login (including --no-localhost),…158,802+
skillclaude_appclaude_codeclaude_api
npx skills add firebase/agent-skills
Firebase Auth Basics
Guide for setting up and using Firebase Authentication. Use this skill when the user's app requires user sign-in, user management, or secure data acce…157,711+
skillclaude_appclaude_codeclaude_api
npx skills add firebase/agent-skills
Firebase Hosting Basics
Deploys and configures classic Firebase Hosting for static websites, single-page apps (SPAs), and microservices. Use when deploying static sites/SPAs,…153,880+

Audit before you install

Run any source through our checks - AI visibility, security, performance, and stack detection.

More in Data & Analytics