{"data":{"slug":"github-aipoch-medical-research-skills-scientific-skills-protocol-design-sample-size-basic-d6632d0425d5","title":"Sample Size Estimation for Clinical Research","summary":"Estimate required sample size per group and total N for t-tests, chi-square tests, and proportion comparisons in clinical research planning. Provides statistical assumptions summary including alpha, power, and effect size.","url":"https:\/\/skillshunter.net\/skills\/github-aipoch-medical-research-skills-scientific-skills-protocol-design-sample-size-basic-d6632d0425d5","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-aipoch-medical-research-skills-scientific-skills-protocol-design-sample-size-basic-d6632d0425d5","markdown_url":"https:\/\/skillshunter.net\/skills\/github-aipoch-medical-research-skills-scientific-skills-protocol-design-sample-size-basic-d6632d0425d5.md","download_url":"https:\/\/skillshunter.net\/skills\/github-aipoch-medical-research-skills-scientific-skills-protocol-design-sample-size-basic-d6632d0425d5\/download","category":{"slug":"data-research","name":"Data & Research"},"editor_note":"Before running the script, ensure Python dependencies are installed using `pip install -r requirements.txt`. Confirm the test type (t-test, chi-square, or proportion comparison) and provide alpha, power, effect size, and baseline rate (if applicable) for accurate results.","instructions":"---\nname: sample-size-basic\ndescription: Basic sample size estimator for clinical research planning. Computes per-group and total N for two-sample\/paired t-tests, chi-square tests, and proportion comparisons, reporting alpha, power, effect size, and statistical assumptions summary for grant proposals and preliminary ...\nlicense: MIT\nauthor: AIPOCH\n---\n> **Source**: [https:\/\/github.com\/aipoch\/medical-research-skills](https:\/\/github.com\/aipoch\/medical-research-skills)\n\n# Sample Size (Basic)\n\nBasic sample size estimation for clinical research planning.\n\n## Quick Check\n\nUse this command to verify that the packaged script entry point can be parsed before deeper execution.\n\n```bash\npython -m py_compile scripts\/main.py\n```\n\n## Audit-Ready Commands\n\nUse these concrete commands for validation. They are intentionally self-contained and avoid placeholder paths.\n\n```bash\npython -m py_compile scripts\/main.py\npython scripts\/main.py --help\n```\n\n## When to Use\n\n- Use this skill when estimating sample size for grant proposals or preliminary study design.\n- Use this skill when the user says \"sample size\", \"power analysis\", \"how many subjects\", or \"n per group\".\n- Use this skill for basic t-test, chi-square, and proportion test sample size calculations.\n\n## Workflow\n\n1. **Identify test type**: Determine statistical test from user request \u2014 t_test (two-sample or paired), chi_square, or proportion comparison.\n2. **Collect parameters**: Gather alpha (default 0.05), power (default 0.80), effect_size (Cohen's d for t-test, or difference in proportions), and baseline_rate (for proportion tests).\n3. **Validate inputs**: Verify alpha in (0,1), power in (0,1), effect_size > 0, and baseline_rate in [0,1] when applicable. If invalid, report exact error and stop.\n4. **Checkpoint**: Display input summary with assumed test type and parameters to user for confirmation before computing.\n5. **Compute sample size**: Calculate per-group N and total N using the appropriate formula for the test type.\n6. **Output**: Return required sample size per group, total sample size, and statistical assumptions summary (test type, alpha, power, effect size, assumptions made).\n7. **Fallback**: If test type is ambiguous, present options (t-test for means, chi-square for proportions) and ask user to clarify.\n\n## Use Cases\n- Quick sample size estimates for grant proposals\n- Preliminary study design calculations\n- Educational purposes for statistics training\n\n## Parameters\n- `test_type`: Type of test (t_test, chi_square, proportion)\n- `alpha`: Significance level (default 0.05)\n- `power`: Statistical power (default 0.80)\n- `effect_size`: Expected effect size\n- `baseline_rate`: Baseline proportion (for proportion tests)\n\n## Returns\n- Required sample size per group\n- Total sample size\n- Statistical assumptions summary\n\n## Example\nInput: Two-sample t-test, alpha=0.05, power=0.80, effect_size=0.5\nOutput: n=64 per group, total=128 subjects\n\n## References\n\n- [references\/audit-reference.md](references\/audit-reference.md) - Supported calculation scope, audit commands, and fallback boundaries\n\n## Risk Assessment\n\n| Risk Indicator | Assessment | Level |\n|----------------|------------|-------|\n| Code Execution | Python\/R scripts executed locally | Medium |\n| Network Access | No external API calls | Low |\n| File System Access | Read input files, write output files | Medium |\n| Instruction Tampering | Standard prompt guidelines | Low |\n| Data Exposure | Output files saved to workspace | Low |\n\n## Security Checklist\n\n- [ ] No hardcoded credentials or API keys\n- [ ] No unauthorized file system access (..\/)\n- [ ] Output does not expose sensitive information\n- [ ] Prompt injection protections in place\n- [ ] Input file paths validated (no ..\/ traversal)\n- [ ] Output directory restricted to workspace\n- [ ] Script execution in sandboxed environment\n- [ ] Error messages sanitized (no stack traces exposed)\n- [ ] Dependencies audited\n\n## Prerequisites\n\n```text\n# Python dependencies\npip install -r requirements.txt\n```\n\n## Evaluation Criteria\n\n### Success Metrics\n- [ ] Successfully executes main functionality\n- [ ] Output meets quality standards\n- [ ] Handles edge cases gracefully\n- [ ] Performance is acceptable\n\n### Test Cases\n1. **Basic Functionality**: Standard input \u2192 Expected output\n2. **Edge Case**: Invalid input \u2192 Graceful error handling\n3. **Performance**: Large dataset \u2192 Acceptable processing time\n\n## Lifecycle Status\n\n- **Current Stage**: Draft\n- **Next Review Date**: 2026-03-06\n- **Known Issues**: None\n- **Planned Improvements**: \n  - Performance optimization\n  - Additional feature support\n\n## Output Requirements\n\nEvery final response should make these items explicit when they are relevant:\n\n- Objective or requested deliverable\n- Inputs used and assumptions introduced\n- Workflow or decision path\n- Core result, recommendation, or artifact\n- Constraints, risks, caveats, or validation needs\n- Unresolved items and next-step checks\n\n## Error Handling\n\n- If required inputs are missing, state exactly which fields are missing and request only the minimum additional information.\n- If the task goes outside the documented scope, stop instead of guessing or silently widening the assignment.\n- If `scripts\/main.py` fails, report the failure point, summarize what still can be completed safely, and provide a manual fallback.\n- Do not fabricate files, citations, data, search results, or execution outcomes.\n\n## Input Validation\n\nThis skill accepts requests that match the documented purpose of `sample-size-basic` and include enough context to complete the workflow safely.\n\nDo not continue the workflow when the request is out of scope, missing a critical input, or would require unsupported assumptions. Instead respond:\n\n> `sample-size-basic` only handles its documented workflow. Please provide the missing required inputs or switch to a more suitable skill.\n\n## Response Template\n\nUse the following fixed structure for non-trivial requests:\n\n1. Objective\n2. Inputs Received\n3. Assumptions\n4. Workflow\n5. Deliverable\n6. Risks and Limits\n7. Next Checks\n\nIf the request is simple, you may compress the structure, but still keep assumptions and limits explicit when they affect correctness.\n","use_cases":["Quick sample size estimates for grant proposals","Preliminary study design calculations","Educational purposes for statistics training"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/aipoch\/medical-research-skills\/blob\/686e09dfdb45d9fa1a08664f06bb93769b3c9d91\/scientific-skills\/Protocol%20Design\/sample-size-basic\/SKILL.md","source_commit":"686e09dfdb45d9fa1a08664f06bb93769b3c9d91","license":"MIT","version":null,"listing_approved_at":"2026-11-26","created_at":"2026-11-24T16:51:23.000000Z","updated_at":"2026-11-26T09:25:15.000000Z","seo_title":"Sample Size Estimator for Clinical Research","seo_description":"Estimate sample size for t-tests, chi-square, and proportion comparisons in clinical research planning. Calculates per-group and total N with statistical assumptions.","seo_keywords":["sample size calculator","clinical research sample size","power analysis calculator","t-test sample size","chi-square sample size"]}}