provider experiments POST /api/projects/{project_id}/experiments/calculate_running_time/
@utdk/posthog /api/projects/{project_id}/experiments/calculate_running_time/
experiments_calculate_running_time_create
Estimate the recommended sample size and running time for an experiment. Pure statistical calculation — does not read or write any experiment. Pass the metric type, a minimum detectable effect, and either a baseline value or raw baseline statistics. When `exposure_rate_per_day` is provided, the response also includes the estimated running time in days.
project_id path required
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
string

Try it

Authentication
Configure credentials for PostHog API
experimentsCalculateRunningTimeCreate
POST/api/projects/{project_id}/experiments/calculate_running_time/
Estimate the recommended sample size and running time for an experiment. Pure statistical calculation — does not read or write any experiment. Pass the metric type, a minimum detectable effect, and either a baseline value or raw baseline statistics. When `exposure_rate_per_day` is provided, the response also includes the estimated running time in days.

Parameters

required

Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.

Input

required

Metric type to size for. 'funnel' for conversion rates, 'mean_count' for event counts per user, 'mean_sum_or_avg' for summed property values per user, 'ratio' and 'retention' for ratio-style metrics (both require baseline_stats or an explicit variance). * `funnel` - funnel * `mean_count` - mean_count * `mean_sum_or_avg` - mean_sum_or_avg * `ratio` - ratio * `retention` - retention

required

Smallest relative change to detect, as a percentage (e.g. 5 means a 5% lift). Must be > 0.

Total number of variants including control (default 2).

Expected exposures per day. When provided, the response includes the recommended running time.

Baseline metric value: conversion rate as a fraction 0-1 (funnel), average per user (mean), or the ratio (ratio/retention). Provide this or baseline_stats.

Pre-computed variance for ratio/retention metrics. Provide this or baseline_stats when metric_type is ratio/retention and baseline_value is given directly.

Raw control-group statistics. When provided, the server derives baseline_value and variance.

Configure credentials above to enable sending.

Code snippet
Updates live as you fill in the form above.

TypeScript

import posthog from '@utdk/posthog';

await posthog.experimentsCalculateRunningTimeCreate({
  "number_of_variants": 2
})