Sample Size (Basic)
Basic sample size estimation for clinical research planning.
Use Cases
- - Quick sample size estimates for grant proposals
- Preliminary study design calculations
- Educational purposes for statistics training
Parameters
- -
test_type: Type of test (ttest, chisquare, proportion) - INLINECODE1 : Significance level (default 0.05)
- INLINECODE2 : Statistical power (default 0.80)
- INLINECODE3 : Expected effect size
- INLINECODE4 : Baseline proportion (for proportion tests)
Returns
- - Required sample size per group
- Total sample size
- Statistical assumptions summary
Example
Input: Two-sample t-test, alpha=0.05, power=0.80, effect_size=0.5
Output: n=64 per group, total=128 subjects
Risk Assessment
| Risk Indicator | Assessment | Level |
|---|
| Code Execution | Python/R scripts executed locally | Medium |
| Network Access |
No external API calls | Low |
| File System Access | Read input files, write output files | Medium |
| Instruction Tampering | Standard prompt guidelines | Low |
| Data Exposure | Output files saved to workspace | Low |
Security Checklist
- - [ ] No hardcoded credentials or API keys
- [ ] No unauthorized file system access (../)
- [ ] Output does not expose sensitive information
- [ ] Prompt injection protections in place
- [ ] Input file paths validated (no ../ traversal)
- [ ] Output directory restricted to workspace
- [ ] Script execution in sandboxed environment
- [ ] Error messages sanitized (no stack traces exposed)
- [ ] Dependencies audited
Prerequisites
CODEBLOCK0
Evaluation Criteria
Success Metrics
- - [ ] Successfully executes main functionality
- [ ] Output meets quality standards
- [ ] Handles edge cases gracefully
- [ ] Performance is acceptable
Test Cases
- 1. Basic Functionality: Standard input → Expected output
- Edge Case: Invalid input → Graceful error handling
- Performance: Large dataset → Acceptable processing time
Lifecycle Status
- - Current Stage: Draft
- Next Review Date: 2026-03-06
- Known Issues: None
- Planned Improvements:
- Performance optimization
- Additional feature support
技能名称:样本量估算(基础)
样本量估算(基础)
用于临床研究规划的基础样本量估算。
使用场景
- - 为基金申请书快速估算样本量
- 初步研究设计计算
- 统计培训的教学用途
参数
- - testtype:检验类型(t检验、卡方检验、比例检验)
- alpha:显著性水平(默认值 0.05)
- power:统计功效(默认值 0.80)
- effectsize:预期效应量
- baseline_rate:基线比例(用于比例检验)
返回值
示例
输入:双样本t检验,alpha=0.05,power=0.80,effect_size=0.5
输出:每组n=64,共128名受试者
风险评估
| 风险指标 | 评估内容 | 等级 |
|---|
| 代码执行 | 本地执行Python/R脚本 | 中 |
| 网络访问 |
无外部API调用 | 低 |
| 文件系统访问 | 读取输入文件,写入输出文件 | 中 |
| 指令篡改 | 标准提示词指南 | 低 |
| 数据暴露 | 输出文件保存至工作区 | 低 |
安全检查清单
- - [ ] 无硬编码凭据或API密钥
- [ ] 无未经授权的文件系统访问(../)
- [ ] 输出不暴露敏感信息
- [ ] 已设置提示注入防护
- [ ] 输入文件路径已验证(无../遍历)
- [ ] 输出目录限制在工作区内
- [ ] 脚本在沙盒环境中执行
- [ ] 错误消息已清理(不暴露堆栈跟踪)
- [ ] 依赖项已审计
前置条件
bash
Python依赖项
pip install -r requirements.txt
评估标准
成功指标
- - [ ] 成功执行主要功能
- [ ] 输出符合质量标准
- [ ] 优雅处理边缘情况
- [ ] 性能可接受
测试用例
- 1. 基本功能:标准输入 → 预期输出
- 边缘情况:无效输入 → 优雅的错误处理
- 性能:大数据集 → 可接受的处理时间
生命周期状态
- - 当前阶段:草稿
- 下次评审日期:2026-03-06
- 已知问题:无
- 计划改进:
- 性能优化
- 新增功能支持