# Power Optimization Patterns

> Direct and tradeoff-based optimization strategies for clinical trial design. Use when optimizing sample size, selecting design parameters, or performing sensitivity analysis.

- **Type:** Skill
- **Install:** `agentstack add skill-choxos-biostatagent-power-optimization-patterns`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [choxos](https://agentstack.voostack.com/s/choxos)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [choxos](https://github.com/choxos)
- **Source:** https://github.com/choxos/BiostatAgent/tree/main/plugins/clinical-trial-simulation/skills/power-optimization-patterns

## Install

```sh
agentstack add skill-choxos-biostatagent-power-optimization-patterns
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Power Optimization Patterns

## When to Use This Skill

- Optimizing sample size for target power
- Selecting design parameters (randomization ratio, event count)
- Trading off between competing objectives
- Performing sensitivity analysis
- Finding optimal regions across scenarios

## Clinical Trial Optimization Framework

### Problem Formulation

**Components:**
- Data Model D(θ): Parameterized by θ (treatment effects, rates, etc.)
- Analysis Model A(λ): Parameterized by λ (sample size, events, etc.)
- Criterion ψ(λ | θ): Power or other metric

**Objective:**
Find λ* that optimizes ψ(λ | θ) subject to constraints.

## Direct Optimization

### Sample Size Determination

**Objective:** Find minimum n such that Power(n) ≥ target

**Binary Search Algorithm:**
```r
find_sample_size  5) {
    n_mid = target_power) {
      n_high = 0.90))]
```

## Tradeoff-Based Optimization

### Additive Criterion

**Formula:**
```
ψ_combined(λ) = w₁ × ψ₁(λ) + w₂ × ψ₂(λ)
```

**Example: Power vs Sample Size**
```r
# Weights: 70% power importance, 30% sample size (negative for minimization)
w1 = 0.90)
optimal_w = 80%):", mean(bootstrap_power >= 0.80), "\n")
```

## Optimal Intervals and Regions

### Optimal Interval

The η-optimal interval contains all λ values within η% of optimal power.

```r
# Define optimal interval
eta = threshold]
cat("95%-optimal interval: [", min(optimal_interval), ",", max(optimal_interval), "]")
```

### Joint Optimal Region

Intersection of optimal intervals across scenarios.

```r
# Find joint optimal region
intervals  subset(w1 + w2 == 1)

# Evaluate each weight combination
# ... and select optimal weights
```

## Best Practices

1. **Define Clear Objective**: Power, sample size, cost, or combination
2. **Consider All Scenarios**: Use qualitative sensitivity for range
3. **Validate Constraints**: Check FWER, minimum power thresholds
4. **Document Trade-offs**: Explain rationale for chosen parameters
5. **Report Robustness**: Show performance across scenarios
6. **Pre-specify Optimization**: Define optimization strategy in SAP

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [choxos](https://github.com/choxos)
- **Source:** [choxos/BiostatAgent](https://github.com/choxos/BiostatAgent)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-choxos-biostatagent-power-optimization-patterns
- Seller: https://agentstack.voostack.com/s/choxos
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
