API Reference
Run PowerAnalysis
Runs a power analysis.
POST
/
v2
/
stats:runPowerAnalysis
Run PowerAnalysis
curl --request POST \
--url https://stats.eu.confidence.dev/v2/stats:runPowerAnalysis \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"plan": {
"alpha": 123,
"power": 123,
"groups": [
{
"id": "<string>",
"weight": 123
}
],
"comparisons": {
"allVsAll": {}
},
"hypotheses": [
{
"id": "<string>",
"type": {},
"segments": [
{
"params": {
"zTest": {},
"ratio": {},
"tunncDesign": {
"optimalSampleSize": 123,
"weight": [
{}
]
},
"asympCs": {
"optimalSampleSize": 123
},
"asympCsRatio": {
"optimalSampleSize": 123
}
},
"dimensions": [
{}
]
}
]
}
],
"settings": {
"disableSegmentAlphaAdjustment": true
}
}
}
'import requests
url = "https://stats.eu.confidence.dev/v2/stats:runPowerAnalysis"
payload = { "plan": {
"alpha": 123,
"power": 123,
"groups": [
{
"id": "<string>",
"weight": 123
}
],
"comparisons": { "allVsAll": {} },
"hypotheses": [
{
"id": "<string>",
"type": {},
"segments": [
{
"params": {
"zTest": {},
"ratio": {},
"tunncDesign": {
"optimalSampleSize": 123,
"weight": [{}]
},
"asympCs": { "optimalSampleSize": 123 },
"asympCsRatio": { "optimalSampleSize": 123 }
},
"dimensions": [{}]
}
]
}
],
"settings": { "disableSegmentAlphaAdjustment": True }
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
plan: {
alpha: 123,
power: 123,
groups: [{id: '<string>', weight: 123}],
comparisons: {allVsAll: {}},
hypotheses: [
{
id: '<string>',
type: {},
segments: [
{
params: {
zTest: {},
ratio: {},
tunncDesign: {optimalSampleSize: 123, weight: [{}]},
asympCs: {optimalSampleSize: 123},
asympCsRatio: {optimalSampleSize: 123}
},
dimensions: [{}]
}
]
}
],
settings: {disableSegmentAlphaAdjustment: true}
}
})
};
fetch('https://stats.eu.confidence.dev/v2/stats:runPowerAnalysis', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://stats.eu.confidence.dev/v2/stats:runPowerAnalysis",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'plan' => [
'alpha' => 123,
'power' => 123,
'groups' => [
[
'id' => '<string>',
'weight' => 123
]
],
'comparisons' => [
'allVsAll' => [
]
],
'hypotheses' => [
[
'id' => '<string>',
'type' => [
],
'segments' => [
[
'params' => [
'zTest' => [
],
'ratio' => [
],
'tunncDesign' => [
'optimalSampleSize' => 123,
'weight' => [
[
]
]
],
'asympCs' => [
'optimalSampleSize' => 123
],
'asympCsRatio' => [
'optimalSampleSize' => 123
]
],
'dimensions' => [
[
]
]
]
]
]
],
'settings' => [
'disableSegmentAlphaAdjustment' => true
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://stats.eu.confidence.dev/v2/stats:runPowerAnalysis"
payload := strings.NewReader("{\n \"plan\": {\n \"alpha\": 123,\n \"power\": 123,\n \"groups\": [\n {\n \"id\": \"<string>\",\n \"weight\": 123\n }\n ],\n \"comparisons\": {\n \"allVsAll\": {}\n },\n \"hypotheses\": [\n {\n \"id\": \"<string>\",\n \"type\": {},\n \"segments\": [\n {\n \"params\": {\n \"zTest\": {},\n \"ratio\": {},\n \"tunncDesign\": {\n \"optimalSampleSize\": 123,\n \"weight\": [\n {}\n ]\n },\n \"asympCs\": {\n \"optimalSampleSize\": 123\n },\n \"asympCsRatio\": {\n \"optimalSampleSize\": 123\n }\n },\n \"dimensions\": [\n {}\n ]\n }\n ]\n }\n ],\n \"settings\": {\n \"disableSegmentAlphaAdjustment\": true\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://stats.eu.confidence.dev/v2/stats:runPowerAnalysis")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"plan\": {\n \"alpha\": 123,\n \"power\": 123,\n \"groups\": [\n {\n \"id\": \"<string>\",\n \"weight\": 123\n }\n ],\n \"comparisons\": {\n \"allVsAll\": {}\n },\n \"hypotheses\": [\n {\n \"id\": \"<string>\",\n \"type\": {},\n \"segments\": [\n {\n \"params\": {\n \"zTest\": {},\n \"ratio\": {},\n \"tunncDesign\": {\n \"optimalSampleSize\": 123,\n \"weight\": [\n {}\n ]\n },\n \"asympCs\": {\n \"optimalSampleSize\": 123\n },\n \"asympCsRatio\": {\n \"optimalSampleSize\": 123\n }\n },\n \"dimensions\": [\n {}\n ]\n }\n ]\n }\n ],\n \"settings\": {\n \"disableSegmentAlphaAdjustment\": true\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://stats.eu.confidence.dev/v2/stats:runPowerAnalysis")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"plan\": {\n \"alpha\": 123,\n \"power\": 123,\n \"groups\": [\n {\n \"id\": \"<string>\",\n \"weight\": 123\n }\n ],\n \"comparisons\": {\n \"allVsAll\": {}\n },\n \"hypotheses\": [\n {\n \"id\": \"<string>\",\n \"type\": {},\n \"segments\": [\n {\n \"params\": {\n \"zTest\": {},\n \"ratio\": {},\n \"tunncDesign\": {\n \"optimalSampleSize\": 123,\n \"weight\": [\n {}\n ]\n },\n \"asympCs\": {\n \"optimalSampleSize\": 123\n },\n \"asympCsRatio\": {\n \"optimalSampleSize\": 123\n }\n },\n \"dimensions\": [\n {}\n ]\n }\n ]\n }\n ],\n \"settings\": {\n \"disableSegmentAlphaAdjustment\": true\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"hypotheses": [
{
"id": "<string>",
"requiredSampleSize": 123,
"segments": [
{
"dimensions": [
{}
],
"requiredSampleSize": 123,
"ciWidthAbs": 123,
"ciWidthRel": 123,
"baselineMean": 123,
"baselineVariance": 123,
"varianceReductionRate": 123
}
],
"adjustedAlpha": 123,
"adjustedBeta": 123
}
],
"requiredSampleSize": 123,
"annotations": [
{
"context": [
{
"value": "<string>"
}
],
"info": "<string>",
"warning": "<string>",
"error": {
"details": "<string>"
}
}
],
"statsCacheEntry": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
AnalysisPlan: The description of which hypotheses that are going to be tested, which group comparisons that are included, and how the result should be evaluated.
Show child attributes
Show child attributes
PowerAnalysisData: Additional data for the power analysis, only required to be set if hypotheses are relative or if ci_width should be computed.
Show child attributes
Show child attributes
Response
200 - application/json
OK
The sample size for each hypothesis.
Show child attributes
Show child attributes
The sample size needed to get the desired power for all hypotheses.
List of issues discovered during the power analysis.
Show child attributes
Show child attributes
Cache entry used, empty if not cached.
Was this page helpful?
⌘I
Run PowerAnalysis
curl --request POST \
--url https://stats.eu.confidence.dev/v2/stats:runPowerAnalysis \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"plan": {
"alpha": 123,
"power": 123,
"groups": [
{
"id": "<string>",
"weight": 123
}
],
"comparisons": {
"allVsAll": {}
},
"hypotheses": [
{
"id": "<string>",
"type": {},
"segments": [
{
"params": {
"zTest": {},
"ratio": {},
"tunncDesign": {
"optimalSampleSize": 123,
"weight": [
{}
]
},
"asympCs": {
"optimalSampleSize": 123
},
"asympCsRatio": {
"optimalSampleSize": 123
}
},
"dimensions": [
{}
]
}
]
}
],
"settings": {
"disableSegmentAlphaAdjustment": true
}
}
}
'import requests
url = "https://stats.eu.confidence.dev/v2/stats:runPowerAnalysis"
payload = { "plan": {
"alpha": 123,
"power": 123,
"groups": [
{
"id": "<string>",
"weight": 123
}
],
"comparisons": { "allVsAll": {} },
"hypotheses": [
{
"id": "<string>",
"type": {},
"segments": [
{
"params": {
"zTest": {},
"ratio": {},
"tunncDesign": {
"optimalSampleSize": 123,
"weight": [{}]
},
"asympCs": { "optimalSampleSize": 123 },
"asympCsRatio": { "optimalSampleSize": 123 }
},
"dimensions": [{}]
}
]
}
],
"settings": { "disableSegmentAlphaAdjustment": True }
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
plan: {
alpha: 123,
power: 123,
groups: [{id: '<string>', weight: 123}],
comparisons: {allVsAll: {}},
hypotheses: [
{
id: '<string>',
type: {},
segments: [
{
params: {
zTest: {},
ratio: {},
tunncDesign: {optimalSampleSize: 123, weight: [{}]},
asympCs: {optimalSampleSize: 123},
asympCsRatio: {optimalSampleSize: 123}
},
dimensions: [{}]
}
]
}
],
settings: {disableSegmentAlphaAdjustment: true}
}
})
};
fetch('https://stats.eu.confidence.dev/v2/stats:runPowerAnalysis', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://stats.eu.confidence.dev/v2/stats:runPowerAnalysis",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'plan' => [
'alpha' => 123,
'power' => 123,
'groups' => [
[
'id' => '<string>',
'weight' => 123
]
],
'comparisons' => [
'allVsAll' => [
]
],
'hypotheses' => [
[
'id' => '<string>',
'type' => [
],
'segments' => [
[
'params' => [
'zTest' => [
],
'ratio' => [
],
'tunncDesign' => [
'optimalSampleSize' => 123,
'weight' => [
[
]
]
],
'asympCs' => [
'optimalSampleSize' => 123
],
'asympCsRatio' => [
'optimalSampleSize' => 123
]
],
'dimensions' => [
[
]
]
]
]
]
],
'settings' => [
'disableSegmentAlphaAdjustment' => true
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://stats.eu.confidence.dev/v2/stats:runPowerAnalysis"
payload := strings.NewReader("{\n \"plan\": {\n \"alpha\": 123,\n \"power\": 123,\n \"groups\": [\n {\n \"id\": \"<string>\",\n \"weight\": 123\n }\n ],\n \"comparisons\": {\n \"allVsAll\": {}\n },\n \"hypotheses\": [\n {\n \"id\": \"<string>\",\n \"type\": {},\n \"segments\": [\n {\n \"params\": {\n \"zTest\": {},\n \"ratio\": {},\n \"tunncDesign\": {\n \"optimalSampleSize\": 123,\n \"weight\": [\n {}\n ]\n },\n \"asympCs\": {\n \"optimalSampleSize\": 123\n },\n \"asympCsRatio\": {\n \"optimalSampleSize\": 123\n }\n },\n \"dimensions\": [\n {}\n ]\n }\n ]\n }\n ],\n \"settings\": {\n \"disableSegmentAlphaAdjustment\": true\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://stats.eu.confidence.dev/v2/stats:runPowerAnalysis")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"plan\": {\n \"alpha\": 123,\n \"power\": 123,\n \"groups\": [\n {\n \"id\": \"<string>\",\n \"weight\": 123\n }\n ],\n \"comparisons\": {\n \"allVsAll\": {}\n },\n \"hypotheses\": [\n {\n \"id\": \"<string>\",\n \"type\": {},\n \"segments\": [\n {\n \"params\": {\n \"zTest\": {},\n \"ratio\": {},\n \"tunncDesign\": {\n \"optimalSampleSize\": 123,\n \"weight\": [\n {}\n ]\n },\n \"asympCs\": {\n \"optimalSampleSize\": 123\n },\n \"asympCsRatio\": {\n \"optimalSampleSize\": 123\n }\n },\n \"dimensions\": [\n {}\n ]\n }\n ]\n }\n ],\n \"settings\": {\n \"disableSegmentAlphaAdjustment\": true\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://stats.eu.confidence.dev/v2/stats:runPowerAnalysis")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"plan\": {\n \"alpha\": 123,\n \"power\": 123,\n \"groups\": [\n {\n \"id\": \"<string>\",\n \"weight\": 123\n }\n ],\n \"comparisons\": {\n \"allVsAll\": {}\n },\n \"hypotheses\": [\n {\n \"id\": \"<string>\",\n \"type\": {},\n \"segments\": [\n {\n \"params\": {\n \"zTest\": {},\n \"ratio\": {},\n \"tunncDesign\": {\n \"optimalSampleSize\": 123,\n \"weight\": [\n {}\n ]\n },\n \"asympCs\": {\n \"optimalSampleSize\": 123\n },\n \"asympCsRatio\": {\n \"optimalSampleSize\": 123\n }\n },\n \"dimensions\": [\n {}\n ]\n }\n ]\n }\n ],\n \"settings\": {\n \"disableSegmentAlphaAdjustment\": true\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"hypotheses": [
{
"id": "<string>",
"requiredSampleSize": 123,
"segments": [
{
"dimensions": [
{}
],
"requiredSampleSize": 123,
"ciWidthAbs": 123,
"ciWidthRel": 123,
"baselineMean": 123,
"baselineVariance": 123,
"varianceReductionRate": 123
}
],
"adjustedAlpha": 123,
"adjustedBeta": 123
}
],
"requiredSampleSize": 123,
"annotations": [
{
"context": [
{
"value": "<string>"
}
],
"info": "<string>",
"warning": "<string>",
"error": {
"details": "<string>"
}
}
],
"statsCacheEntry": "<string>"
}
