skillfed

statistics-fundamentals

Analyze financial return series with descriptive statistics, normality tests, and covariance estimation. Run CAPM regressions with significance testing, apply Ledoit-Wolf shrinkage for stable portfolio optimization, and bootstrap confidence intervals for statistics without clean analytical solutions.

Statistics Fundamentals applies statistical methods to analyze return distributions, test normality, and estimate covariance matrices for financial data.

AI-generated summary based on this skill's SKILL.md

159 32 MIT updated by JoelLewis

Install

JoelLewis/finance_skills/statistics-fundamentals · repository language: Python

git clone https://github.com/JoelLewis/finance_skills
cp -r finance_skills/plugins/core/skills/statistics-fundamentals ~/.claude/skills/statistics-fundamentals
npx skillfed install JoelLewis/finance_skills/statistics-fundamentals

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

How do I calculate volatility from returns using statistics-fundamentals?

statistics-fundamentals computes volatility as the standard deviation of your return series, applying Bessel correction (n−1 divisor) for unbiased sample estimates. For monthly returns, multiply the result by √12 to annualize; for daily data, use √252. The skill handles both raw and log returns, letting you test whether your data exhibits fat tails or skewness that violate normality assumptions.

What normality tests does statistics-fundamentals provide?

statistics-fundamentals includes the Jarque-Bera test to assess whether financial returns are normally distributed by examining skewness and kurtosis. The test flags fat tails and asymmetry common in stock data. You can also inspect raw descriptive statistics—mean, variance, skewness, kurtosis—to diagnose departures from normality before running parametric models like CAPM.

Why does my portfolio optimizer produce unstable weights with statistics-fundamentals?

Unstable weights typically arise when you have more assets than observations, causing the sample covariance matrix to be ill-conditioned. statistics-fundamentals addresses this via Ledoit-Wolf shrinkage estimation, which blends your sample covariance toward a structured target (often the identity or single-factor model). This stabilizes weights and improves out-of-sample performance without discarding data.

How does statistics-fundamentals estimate covariance matrices for portfolio construction?

statistics-fundamentals computes sample covariance and correlation matrices from your return data, then optionally applies Ledoit-Wolf shrinkage when assets exceed observations. It also supports rolling-window estimation to capture time-varying correlations. These stabilized estimates feed directly into mean-variance optimization and risk decomposition for portfolio construction.

Can statistics-fundamentals run CAPM regression to measure alpha and beta?

Yes. statistics-fundamentals performs CAPM regression of asset returns against a market benchmark, reporting beta (market sensitivity), alpha (intercept), and R-squared. It computes t-statistics and p-values to test whether alpha is significantly different from zero, helping you assess whether a fund or strategy has genuine outperformance or just noise.

How do bootstrap confidence intervals work in statistics-fundamentals?

statistics-fundamentals uses non-parametric bootstrap resampling to generate confidence intervals for statistics like Sharpe ratio, volatility, and correlation when analytical formulas are intractable or assumptions are violated. It resamples your return observations with replacement, recalculates the statistic thousands of times, and constructs percentile-based intervals—ideal for fat-tailed financial data.

SKILL.md

rendered from the published skill — quoted content, verbatim

Statistics Fundamentals

Core Concepts

Conventions and Decision Rules
Sample variance: use n-1

When estimating variance or standard deviation from a sample of returns, divide by n - 1 (Bessel's correction), not n. Dividing by n systematically underestimates dispersion. Standard deviation of returns is "volatility"; annualize with sigma_annual = sigma_period * sqrt(periods_per_year) (e.g., * sqrt(12) for monthly, * sqrt(252) for daily).

Normality testing: Jarque-Bera

(truncated - see the full file via the links below)

Read as markdown · JSON record · Browse the source repository

File tree — 2 files
plugins/core/skills/statistics-fundamentals/SKILL.md
plugins/core/skills/statistics-fundamentals/scripts/statistics_fundamentals.py

Related skills

Tags

portfolio-optimization risk-measurement hypothesis-testing tail-risk factor-models sampling-methods matrix-conditioning performance-attribution