Skip to main content
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": {
      "oneVsAll": {
        "baseline": "<string>"
      },
      "allVsAll": {},
      "custom": {
        "pairs": [
          {
            "baseline": "<string>",
            "compared": "<string>"
          }
        ]
      }
    },
    "hypotheses": [
      {
        "id": "<string>",
        "type": {
          "superiority": {
            "preferredDirection": {},
            "minimumDetectableEffect": 123
          },
          "nonInferiority": {
            "preferredDirection": {},
            "nonInferiorityMargin": 123
          },
          "jointEquivalence": {
            "minimumDetectableDeviation": 123
          }
        },
        "segments": [
          {
            "params": {
              "chi2": {
                "expectedFrequency": [
                  {
                    "group": "<string>",
                    "frequency": 123
                  }
                ]
              },
              "zTest": {},
              "gstZTest": {
                "maxSampleSize": 123
              },
              "ratio": {},
              "tunncDesign": {
                "optimalSampleSize": 123,
                "weight": [
                  {}
                ]
              },
              "gstRatio": {
                "maxSampleSize": 123
              },
              "asympCs": {
                "optimalSampleSize": 123
              },
              "asympCsRatio": {
                "optimalSampleSize": 123
              }
            },
            "dimensions": [
              {}
            ]
          }
        ],
        "dataType": {}
      }
    ],
    "decisionRule": {
      "items": [
        {
          "hypothesis": "<string>",
          "rule": {}
        }
      ],
      "operator": {}
    },
    "settings": {
      "disableSegmentAlphaAdjustment": true
    }
  },
  "data": {
    "hypotheses": [
      {
        "id": "<string>",
        "segments": [
          {
            "powerData": {
              "chi2": {},
              "zTest": {
                "baselineVariance": 123,
                "baselineMean": 123,
                "adjustment": {
                  "baselineVariance": 123,
                  "baselineCovariance": 123
                }
              },
              "gstZTest": {
                "baselineVariance": 123,
                "baselineMean": 123,
                "adjustment": {
                  "baselineVariance": 123,
                  "baselineCovariance": 123
                }
              },
              "ratio": {
                "baselineNumeratorVariance": 123,
                "baselineDenominatorVariance": 123,
                "baselineCovariance": 123,
                "baselineNumeratorMean": 123,
                "baselineDenominatorMean": 123
              },
              "tunncDesign": {},
              "gstRatio": {
                "baselineNumeratorVariance": 123,
                "baselineDenominatorVariance": 123,
                "baselineCovariance": 123,
                "baselineNumeratorMean": 123,
                "baselineDenominatorMean": 123
              },
              "asympCs": {
                "baselineVariance": 123,
                "baselineMean": 123,
                "adjustment": {
                  "baselineVariance": 123,
                  "baselineCovariance": 123
                }
              },
              "asympCsRatio": {
                "baselineNumeratorVariance": 123,
                "baselineDenominatorVariance": 123,
                "baselineCovariance": 123,
                "baselineNumeratorMean": 123,
                "baselineDenominatorMean": 123
              }
            },
            "dimensions": [
              {}
            ],
            "expectedSampleSize": 123
          }
        ]
      }
    ]
  }
}
'
{
  "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": [
        {
          "key": {},
          "value": "<string>"
        }
      ],
      "info": "<string>",
      "warning": "<string>",
      "error": {
        "details": "<string>",
        "category": {}
      }
    }
  ],
  "statsCacheEntry": "<string>"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
plan
AnalysisPlan · object
required

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.

data
PowerAnalysisData · object

PowerAnalysisData: Additional data for the power analysis, only required to be set if hypotheses are relative or if ci_width should be computed.

Response

200 - application/json

OK

hypotheses
object[]

The sample size for each hypothesis.

requiredSampleSize
integer

The sample size needed to get the desired power for all hypotheses.

annotations
object[]

List of issues discovered during the power analysis.

statsCacheEntry
string

Cache entry used, empty if not cached.