Skip to main content

POST /api/v1/experiments/power-calculator

Calculates the required sample size and estimated experiment duration for an A/B test. Uses a two-proportion z-test formula with traffic estimates derived from the tenant’s recent interaction history.

Request Body

FieldTypeRequiredDescription
baselineConversionRatenumberYesCurrent conversion rate (0.001-1.0)
minimumDetectableEffectnumberYesSmallest effect size to detect (0.001-1.0)
significanceLevelnumberNoAlpha level for the test (0.01-0.20, default: 0.05)
powernumberNoStatistical power (0.5-0.99, default: 0.8)
trafficSplitnumberNoProportion of traffic in the treatment group (0.1-0.9, default: 0.5)

Example

curl -X POST https://playground.kaireonai.com/api/v1/experiments/power-calculator \
  -H "Content-Type: application/json" \
  -H "X-Tenant-Id: my-tenant" \
  -d '{
    "baselineConversionRate": 0.05,
    "minimumDetectableEffect": 0.02,
    "significanceLevel": 0.05,
    "power": 0.8,
    "trafficSplit": 0.5
  }'

Response

{
  "requiredSampleSize": 7850,
  "perVariant": 3925,
  "estimatedDuration": {
    "days": 16,
    "basedOnDailyTraffic": 500
  },
  "recommendation": "With 500 daily decisions, you need ~16 days to reach statistical significance.",
  "sensitivityTable": [
    { "effect": 0.01, "sampleSize": 31400, "days": 63 },
    { "effect": 0.02, "sampleSize": 7850, "days": 16 },
    { "effect": 0.05, "sampleSize": 1260, "days": 3 },
    { "effect": 0.10, "sampleSize": 320, "days": 1 }
  ]
}

Response Fields

FieldTypeDescription
requiredSampleSizeintegerTotal sample size needed across both variants
perVariantintegerSample size per variant
estimatedDuration.daysinteger or nullEstimated days to reach the required sample size
estimatedDuration.basedOnDailyTrafficintegerAverage daily decisions from the last 14 days
recommendationstringHuman-readable guidance
sensitivityTablearraySample sizes for different effect sizes

Sensitivity Table

The sensitivity table shows how the required sample size changes with different minimum detectable effects. This helps teams understand the trade-off between experiment duration and the ability to detect small effects.
If estimatedDuration.basedOnDailyTraffic is 0, the tenant has no recent decision traffic. Start sending decisions through the Recommend API to get accurate duration estimates.

Roles

admin, editor, viewer See also: Experiments | Algorithm Models