Statistics
AuraScore 79/100

Quantitative Workplace Experimentation and Power Analysis Script

Generate a robust statistical script to conduct power calculations and hypothesis testing for organizational intervention studies.

Use this template when setting up or evaluating randomized workplace experiments, productivity interventions, or operational team trials. It delivers an end-to-end Python script covering sample sizing, statistical power, covariate adjustment, and significance testing.

Template

Role: Principal Experimentation Statistician with extensive expertise in causal inference and organizational trial design.

Context

  • Study initiative: {{experiment_name}}
  • Cohort profile: {{sample_population}}
  • Key performance indicator: {{primary_metric}}
  • Historical reference baseline: {{baseline_rate}}
  • Target minimum detectable effect: {{minimum_detectable_effect}}
  • Significance threshold: {{alpha_level}}

Task

Author an end-to-end Python statistical execution script that computes sample size requirements, performs pre-trial balance checks, and implements regression-adjusted hypothesis testing for {{experiment_name}} evaluated across {{sample_population}}.

Method

  1. Import production-grade scientific libraries (scipy.stats, statsmodels, numpy, pandas) with deterministic random seeding.
  2. Ingest parameters for {{primary_metric}}, {{baseline_rate}}, and {{minimum_detectable_effect}} to calculate statistical power curves across sample sizes.
  3. Implement two-sided prospective sample size calculations targeting 80% and 90% power given {{alpha_level}}.
  4. Construct data hygiene and outlier detection functions tailored to {{primary_metric}} distributional quirks.
  5. Write baseline balance assessment routines (standardized mean differences) comparing control and treatment cohorts.
  6. Implement Ordinary Least Squares or Logistic Regression estimation with robust Huber-White standard errors.
  7. Compute point estimates, confidence intervals, and p-values alongside Cohen's d effect magnitude benchmarks.
  8. Generate formatted CLI diagnostic summaries and structured logging of statistical conclusions.

Constraints

  • Code MUST be fully functional, modular Python 3.10+ without pseudocode or undefined variable stubs.
  • Script MUST handle both continuous and binary distributions based on {{primary_metric}} characteristics.
  • MUST NOT use deprecated functions from older scipy or statsmodels releases.
  • Provide clear inline docstrings adhering to Google Python style guidelines.

Output format

Provide a single production-ready Python script organized into:

  1. Configuration block defining hyper-parameters from {{baseline_rate}}, {{minimum_detectable_effect}}, and {{alpha_level}}.
  2. Power & Sample Size Calculation Module (min 20 lines).
  3. Statistical Testing & Estimation Class (min 40 lines).
  4. Execution Block (if __name__ == '__main__':) demonstrating end-to-end analysis on mock synthetic data.

Self-review

  • Confirm all formulaic power calculations explicitly match standard two-tailed formulas.
  • Verify that {{sample_population}} and {{primary_metric}} variable names are consistently utilized throughout the code.
  • Ensure error handling exists for degenerate variance or underpowered sample sizes.
AuraScore breakdown
79/100Provisional
Instruction clarity15/15 · Strong

Explicit role, a named task, and discrete steps the model can follow.

Context architecture12/12 · Strong

Background, inputs and variables the model needs before it starts.

Constraint engineering10/12 · Adequate

Hard boundaries — what the model must and must not do.

Output specification6/14 · Thin

A named, field-level shape for the response.

Reasoning structure10/10 · Strong

Ordered work items that force analysis before an answer.

Model compatibility10/10 · Strong

Length and structure that travel across frontier models.

Token efficiency5/10 · Thin

Signal density — instruction weight without padding.

Reusability7/7 · Strong

Documented variables so the scaffold adapts to new inputs.

Robustness3/5 · Adequate

Quality bar, assumptions and behaviour when inputs are thin.

Observed performance1/5 · Thin

How much real usage the template has behind it.

data-analytics
data-statistics
research-productivity-operations
statistics
experimentation
ab-testing