Estimate the sample size and duration of an A/B test

Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.

Usage

Required ACL: analytics
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import com.algolia.api.AbtestingClient;
import com.algolia.config.*;

AbtestingClient client = new AbtestingClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION");

client.estimateABTest(
  new EstimateABTestRequest()
    .setConfiguration(
      new EstimateConfiguration()
        .setEmptySearch(new EmptySearch().setExclude(true))
        .setMinimumDetectableEffect(new MinimumDetectableEffect().setSize(0.03).setMetric(EffectMetric.CONVERSION_RATE))
    )
    .setVariants(
      Arrays.asList(
        new AbTestsVariant().setIndex("AB_TEST_1").setTrafficPercentage(50),
        new AbTestsVariant().setIndex("AB_TEST_2").setTrafficPercentage(50)
      )
    )
);
Did you find this page helpful?