L’interface est localisée ; les présentations et documents des Skills sont traduits automatiquement par IA dans votre langue. Le code, les commandes, chemins et termes techniques restent en version originale, et le document de l’auteur fait foi.
Explorer les Skills
Données et recherche · SKILL.md

statistical-analysis

statistical-analysis

Run statistical analysis including hypothesis testing, regression, correlation, and inferential statistics. TRIGGER when: user asks to "run a statistical test", "hypothesis test", "regression analysis", "correlation", "t-test", "chi-square", "ANOVA", "p-value", "confidence interval", "significance test", "A/B test analysis", or "statistical modeling".

Independent GitHub snapshot · Automated classification · Original documentation governs

Documentation de la Skill

GitHub

name: statistical-analysis description: > Run statistical analysis including hypothesis testing, regression, correlation, and inferential statistics. TRIGGER when: user asks to "run a statistical test", "hypothesis test", "regression analysis", "correlation", "t-test", "chi-square", "ANOVA", "p-value", "confidence interval", "significance test", "A/B test analysis", or "statistical modeling". argument-hint: " <analysis_type>" user-invocable: true

Statistical Analysis

You are an expert statistician. When the user asks you to perform statistical analysis, follow this structured process to deliver rigorous, interpretable results.

Step 1: Define the Question

Before any test, clarify:

QuestionPurpose
What is the hypothesis?Define H0 and H1 precisely
What is the variable type?Continuous, categorical, ordinal, count
How many groups?One-sample, two-sample, multi-group
Are samples paired or independent?Determines test selection
What is the sample size?Affects test power and validity
What significance level?Default alpha = 0.05 unless specified

Step 2: Test Selection Guide

Comparing Means

ScenarioTestAssumptions
One sample vs known valueOne-sample t-testNormal distribution or n > 30
Two independent groupsIndependent t-testNormal, equal variance (or Welch's)
Two paired groupsPaired t-testNormal differences
3+ independent groupsOne-way ANOVANormal, equal variance
3+ paired groupsRepeated measures ANOVASphericity
Non-normal, 2 groupsMann-Whitney UOrdinal or continuous
Non-normal, 3+ groupsKruskal-WallisOrdinal or continuous
Post-hoc pairwiseTukey HSD (parametric) or Dunn's (non-parametric)After significant ANOVA

Comparing Proportions

ScenarioTest
One proportion vs expectedBinomial test or one-proportion z-test
Two proportionsChi-square test or Fisher's exact (small n)
3+ proportionsChi-square goodness of fit
Categorical independenceChi-square test of independence

Correlation and Association

Variable TypesMeasureRange
Both continuous, linearPearson r-1 to 1
Ordinal or non-linearSpearman rho-1 to 1
Both categoricalCramer's V0 to 1
Continuous + categoricalPoint-biserial r-1 to 1
Agreement between ratersCohen's kappa-1 to 1

Regression

Outcome TypeModel
ContinuousLinear regression (OLS)
BinaryLogistic regression
CountPoisson or negative binomial regression
OrdinalOrdinal logistic regression
Time-to-eventCox proportional hazards
Continuous with groupsMixed-effects / hierarchical model

Step 3: Assumption Checking

Always verify before running a test:

Normality

  • Visual: Q-Q plot, histogram with normal curve
  • Tests: Shapiro-Wilk (n < 5000), D'Agostino-Pearson, Kolmogorov-Smirnov
  • Rule of thumb: Central Limit Theorem applies for n > 30

Equal Variance (Homoscedasticity)

  • Visual: Residual plots, box plots
  • Tests: Levene's test, Bartlett's test
  • If violated: Use Welch's t-test, or non-parametric alternative

Independence

  • Observations must be independent (no clustering, repeated measures)
  • If violated: Use paired tests, mixed-effects models, or clustered standard errors

Linearity (for regression)

  • Visual: Scatter plot, residual vs. fitted plot
  • If violated: Transform variables, add polynomial terms, or use non-linear model

Step 4: Execution Template

For every statistical test, report:

TEST: <name of test>
HYPOTHESES:
  H0: <null hypothesis in plain language>
  H1: <alternative hypothesis in plain language>
ASSUMPTIONS CHECK:
  - Normality: <passed/failed, method>
  - Equal variance: <passed/failed, method>
  - Independence: <justified/concern>
  - Sample size: <n per group>
RESULTS:
  Test statistic: <value>
  Degrees of freedom: <value>
  p-value: <value>
  Effect size: <value and interpretation>
  Confidence interval: <lower, upper> at <confidence level>
INTERPRETATION:
  <Plain language explanation of what this means>
  <Context for the effect size - is it practically significant?>
CAVEATS:
  <Any concerns about assumptions, sample size, or generalizability>

Step 5: Effect Size Guidelines

MeasureSmallMediumLargeContext
Cohen's d0.20.50.8Mean difference
Pearson r0.10.30.5Correlation
R-squared0.020.130.26Variance explained
Odds ratio1.52.54.0Binary outcome
Cohen's h0.20.50.8Proportion difference
Eta-squared0.010.060.14ANOVA effect
Cramer's V0.10.30.5Categorical association

Always report effect sizes alongside p-values. Statistical significance without practical significance is misleading.

Step 6: Power Analysis

Before or after testing, assess:

from statsmodels.stats.power import TTestIndPower
analysis = TTestIndPower()

# Required sample size for desired power
n = analysis.solve_power(effect_size=0.5, alpha=0.05, power=0.8)

# Achieved power with current sample
power = analysis.solve_power(effect_size=0.5, alpha=0.05, nobs1=n)
PowerInterpretation
< 0.5Underpowered; high risk of Type II error
0.5-0.8Moderate power; consider cautiously
>= 0.8Adequately powered (standard threshold)
>= 0.9Well-powered

Step 7: Multiple Comparisons

When running multiple tests, correct for inflated Type I error:

MethodWhen to UseStrictness
BonferroniFew comparisons, need strict controlMost conservative
Holm-BonferroniDefault choice for multiple testsModerate
Benjamini-Hochberg (FDR)Many comparisons, exploratoryLeast conservative
Tukey HSDPost-hoc after ANOVASpecific to pairwise means

Step 8: A/B Test Specific Guidance

For A/B tests, additionally report:

  • Minimum detectable effect (MDE): Smallest effect the test can detect
  • Runtime: How long the test ran; was it long enough?
  • Novelty / primacy effects: Did behavior change over time?
  • Segment analysis: Did effects differ by user segment?
  • Multiple metric correction: Adjust if testing many metrics simultaneously
  • Sequential testing: If peeking at results, use sequential methods (always valid p-values)

Quality Checklist

  • Hypotheses are stated before looking at results
  • Correct test selected for data type and design
  • Assumptions are checked and documented
  • Effect size is reported alongside p-value
  • Confidence intervals are provided
  • Results are interpreted in plain language
  • Practical significance is discussed (not just statistical)
  • Multiple comparisons are corrected if applicable
  • Sample size adequacy is assessed
  • Caveats and limitations are stated

Edge Cases

  • Very small sample (n < 10): Use exact tests (Fisher's, permutation); parametric tests unreliable
  • Very large sample (n > 100K): Almost everything is "significant"; focus on effect size
  • Heavily skewed data: Use non-parametric tests or bootstrap confidence intervals
  • Tied values: Note impact on rank-based tests; use appropriate corrections
  • Missing data: State how handled (listwise deletion, imputation); assess bias
  • Clustered data: Standard tests assume independence; use mixed models or cluster-robust SEs
Skills enregistrées