Testing
AuraScore 81/100

Monte Carlo Convergence and Statistical Drift Test Suite Generator

Generate statistical test harnesses and Monte Carlo simulation scripts to validate convergence, bias, and distribution stability in quantitative models.

Use this template when testing non-deterministic models, probabilistic algorithms, or quantitative financial estimators. It creates executable validation scripts applying rigorous statistical hypothesis testing and convergence checks.

Template

Role: Lead Quantitative Research Systems Engineer specializing in statistical validation and stochastic model quality assurance.

Context

  • Stochastic Algorithm / Estimator Definition: {{stochastic_model_definition}}
  • Theoretical Null Hypothesis and Properties: {{null_hypothesis_formulation}}
  • Sample Size Progression Schedule: {{sample_size_schedule}}
  • Significance Level Alpha: {{significance_alpha}}
  • Statistical Test Methodology: {{statistical_test_type}}
  • Convergence Metric and Error Bound: {{convergence_metric}}

Task

Develop an automated Python statistical testing script that executes Monte Carlo trials of {{stochastic_model_definition}}, applies {{statistical_test_type}} to test {{null_hypothesis_formulation}} at alpha {{significance_alpha}}, and verifies asymptotic behavior against {{convergence_metric}}.

Method

  1. Define reproducible multi-seed execution harness with vectorized pseudo-random and quasi-random sequence generators.
  2. Encapsulate {{stochastic_model_definition}} into a vectorized simulator capable of batch sampling across {{sample_size_schedule}}.
  3. Construct iterative estimators tracking running empirical means, higher-order moments (skewness, kurtosis), and standard error rates.
  4. Implement the exact test statistic computation for {{statistical_test_type}} (e.g., Kolmogorov-Smirnov, Anderson-Darling, permutation test, or t-test).
  5. Compute critical values and empirical p-values against the significance threshold {{significance_alpha}} to evaluate {{null_hypothesis_formulation}}.
  6. Evaluate convergence decay rates across {{sample_size_schedule}} to confirm empirical convergence matches {{convergence_metric}} (e.g., O(1/sqrt(N)) error decay).
  7. Build a failure diagnostic logger detailing distribution shifts, p-value trends, and bootstrap confidence intervals upon test failure.

Constraints

  • MUST provide runnable Python script utilizing standard statistical libraries (e.g., SciPy, NumPy, Statsmodels).
  • MUST enforce deterministic seed management with options to run permutation multi-seed sweeps.
  • MUST NOT hardcode p-value outcomes; all metrics must be dynamically calculated from simulation outputs.
  • Implement explicit assertion guards raising descriptive AssertionError messages with computed p-values.

Output format

Return a clean, self-contained Python script organized into the following explicit blocks:

  1. Imports, Seed Initialization, and Global Test Constants
  2. Monte Carlo Execution Engine for {{stochastic_model_definition}}
  3. Statistical Test Function Implementing {{statistical_test_type}}
  4. Asymptotic Convergence Verification Suite for {{convergence_metric}}
  5. Main CLI Runner with Structured Diagnostic Summary Output

Self-review

  • Confirm that the script tests {{null_hypothesis_formulation}} using {{significance_alpha}} correctly.
  • Verify that the sample iteration dynamically processes all values in {{sample_size_schedule}}.
  • Check that convergence assertions explicitly validate the error bound defined in {{convergence_metric}}.
AuraScore breakdown
81/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 engineering12/12 · Strong

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.

developers
developers-testing
complex-reasoning-analysis-math
monte-carlo
statistical-testing
scipy