statistical-testing
Advanced statistical testing including hypothesis testing, Bayesian analysis, survival analysis, time series, multivariate methods, and meta-analysis. Use when user needs specific statistical tests beyond basic EDA, power analysis, Bayesian inference, survival curves, time series forecasting, or meta-analysis. Triggers on "hypothesis test", "Bayesian", "survival analysis", "time series", "meta-analysis", "bootstrap", "permutation test", "mixed model", "structural equation".
Best use case
statistical-testing is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Advanced statistical testing including hypothesis testing, Bayesian analysis, survival analysis, time series, multivariate methods, and meta-analysis. Use when user needs specific statistical tests beyond basic EDA, power analysis, Bayesian inference, survival curves, time series forecasting, or meta-analysis. Triggers on "hypothesis test", "Bayesian", "survival analysis", "time series", "meta-analysis", "bootstrap", "permutation test", "mixed model", "structural equation".
Teams using statistical-testing should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/statistical-testing/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How statistical-testing Compares
| Feature / Agent | statistical-testing | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Advanced statistical testing including hypothesis testing, Bayesian analysis, survival analysis, time series, multivariate methods, and meta-analysis. Use when user needs specific statistical tests beyond basic EDA, power analysis, Bayesian inference, survival curves, time series forecasting, or meta-analysis. Triggers on "hypothesis test", "Bayesian", "survival analysis", "time series", "meta-analysis", "bootstrap", "permutation test", "mixed model", "structural equation".
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
SKILL.md Source
# Statistical Testing
Advanced statistical methods for scientific research. Venv: `source /Users/zhangmingda/clawd/.venv/bin/activate`
## Bayesian Analysis
```python
# Simple Bayesian estimation (conjugate priors)
import numpy as np
from scipy import stats
# Beta-Binomial (proportions)
# Prior: Beta(alpha_prior, beta_prior), Data: k successes in n trials
alpha_prior, beta_prior = 1, 1 # uniform prior
k, n = 45, 100
alpha_post = alpha_prior + k
beta_post = beta_prior + (n - k)
posterior = stats.beta(alpha_post, beta_post)
print(f"Posterior mean: {posterior.mean():.3f}")
print(f"95% credible interval: {posterior.ppf([0.025, 0.975])}")
# Bayes Factor (BF10) approximation for t-test
# Use the BayesFactor approach or JZS prior
```
## Survival Analysis
```python
# Kaplan-Meier and Cox regression
# pip install lifelines
from lifelines import KaplanMeierFitter, CoxPHFitter
from lifelines.statistics import logrank_test
kmf = KaplanMeierFitter()
kmf.fit(durations=df['time'], event_observed=df['event'], label='Overall')
kmf.plot_survival_function()
# Compare groups
results = logrank_test(df[df['group']==0]['time'], df[df['group']==1]['time'],
df[df['group']==0]['event'], df[df['group']==1]['event'])
print(f"Log-rank test: χ²={results.test_statistic:.2f}, p={results.p_value:.4f}")
# Cox proportional hazards
cph = CoxPHFitter()
cph.fit(df[['time', 'event', 'age', 'treatment']], 'time', 'event')
cph.print_summary()
```
## Time Series
```python
import statsmodels.api as sm
from statsmodels.tsa.stattools import adfuller, acf, pacf
from statsmodels.tsa.arima.model import ARIMA
# Stationarity test
result = adfuller(ts)
print(f"ADF statistic: {result[0]:.4f}, p-value: {result[1]:.4f}")
# ARIMA
model = ARIMA(ts, order=(p, d, q)).fit()
forecast = model.forecast(steps=12)
# Seasonal decomposition
decomp = sm.tsa.seasonal_decompose(ts, period=12)
decomp.plot()
```
## Bootstrap & Permutation
```python
# Bootstrap confidence interval
def bootstrap_ci(data, stat_func=np.mean, n_boot=10000, ci=0.95):
boot_stats = [stat_func(np.random.choice(data, size=len(data), replace=True))
for _ in range(n_boot)]
alpha = (1 - ci) / 2
return np.percentile(boot_stats, [alpha*100, (1-alpha)*100])
# Permutation test
def permutation_test(group1, group2, n_perm=10000):
observed = np.mean(group1) - np.mean(group2)
combined = np.concatenate([group1, group2])
count = 0
for _ in range(n_perm):
np.random.shuffle(combined)
perm_diff = np.mean(combined[:len(group1)]) - np.mean(combined[len(group1):])
if abs(perm_diff) >= abs(observed):
count += 1
return count / n_perm
```
## Multiple Comparison Corrections
```python
from statsmodels.stats.multitest import multipletests
# Methods: bonferroni, holm, fdr_bh (Benjamini-Hochberg), fdr_by
reject, pvals_corrected, _, _ = multipletests(p_values, method='fdr_bh', alpha=0.05)
```
## Effect Sizes
| Test | Effect Size | Small | Medium | Large |
|------|------------|-------|--------|-------|
| t-test | Cohen's d | 0.2 | 0.5 | 0.8 |
| ANOVA | η² (eta-squared) | 0.01 | 0.06 | 0.14 |
| Correlation | r | 0.1 | 0.3 | 0.5 |
| Chi-square | Cramér's V | 0.1 | 0.3 | 0.5 |
| Regression | R² | 0.02 | 0.13 | 0.26 |
## Meta-Analysis
```python
# Fixed-effects and random-effects meta-analysis
# Inverse-variance weighted
def meta_analysis(effects, variances, method='random'):
weights = 1 / np.array(variances)
pooled_fixed = np.sum(weights * effects) / np.sum(weights)
if method == 'random':
Q = np.sum(weights * (effects - pooled_fixed)**2)
k = len(effects)
C = np.sum(weights) - np.sum(weights**2) / np.sum(weights)
tau2 = max(0, (Q - (k-1)) / C)
weights_re = 1 / (np.array(variances) + tau2)
pooled = np.sum(weights_re * effects) / np.sum(weights_re)
se = np.sqrt(1 / np.sum(weights_re))
else:
pooled = pooled_fixed
se = np.sqrt(1 / np.sum(weights))
ci = (pooled - 1.96*se, pooled + 1.96*se)
return pooled, se, ci
```
## Reporting Standards
- APA: F(df1, df2) = X.XX, p = .XXX, η² = .XX
- Always include: test statistic, df, p-value, effect size, CI
- Use exact p-values (not p < .05) unless p < .001
- Report Bayesian results as BF₁₀ with interpretation scaleRelated Skills
statistical-analysis
Guided statistical analysis with test selection and reporting. Use when you need help choosing appropriate tests for your data, assumption checking, power analysis, and APA-formatted results. Best for academic research reporting, test selection guidance. For implementing specific models programmatically use statsmodels.
xurl
A CLI tool for making authenticated requests to the X (Twitter) API. Use this skill when you need to post tweets, reply, quote, search, read posts, manage followers, send DMs, upload media, or interact with any X API v2 endpoint.
xlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.
writing
No description provided.
world-bank-data
World Bank Open Data API for development indicators. Use when: user asks about GDP, population, poverty, health, or education statistics by country. NOT for: real-time financial data or stock prices.
wikipedia-search
Search and fetch structured content from Wikipedia using the MediaWiki API for reliable, encyclopedic information
wikidata-knowledge
Query Wikidata for structured knowledge using SPARQL and entity search. Use when: (1) finding structured facts about entities (people, places, organizations), (2) querying relationships between entities, (3) cross-referencing external identifiers (Wikipedia, VIAF, GND, ORCID), (4) building knowledge graphs from linked data. NOT for: full-text article content (use Wikipedia API), scientific literature (use semantic-scholar), geospatial data (use OpenStreetMap).
weather
Get current weather and forecasts via wttr.in or Open-Meteo. Use when: user asks about weather, temperature, or forecasts for any location. NOT for: historical weather data, severe weather alerts, or detailed meteorological analysis. No API key needed.
wacli
Send WhatsApp messages to other people or search/sync WhatsApp history via the wacli CLI (not for normal user chats).
voice-call
Start voice calls via the OpenClaw voice-call plugin.
visualization
Create publication-quality scientific figures and plots using Python (matplotlib, seaborn, plotly). Supports bar charts, scatter plots, heatmaps, box plots, violin plots, survival curves, network graphs, and more. Use when user asks to plot data, create figures, make charts, visualize results, or generate publication-ready graphics. Triggers on "plot", "chart", "figure", "graph", "visualize", "heatmap", "scatter plot", "bar chart", "histogram".
video-frames
Extract frames or short clips from videos using ffmpeg.