All Products
Search
Document Center

Platform For AI:One-sample t-test

Last Updated:Apr 01, 2026

The one-sample t-test determines whether the sample mean is statistically significantly different from a known or hypothesized population mean.

Null hypothesis (H0): The sample mean equals the hypothesized mean.

The test computes a t-statistic and compares it against a t-distribution with the appropriate degrees of freedom. It assumes normally distributed data—this assumption is especially important when the sample size is small.

If the p-value is less than alpha (1 - confidence level), reject the null hypothesis and conclude that the sample mean differs significantly from the hypothesized mean.

Configure the component

Method 1: Configure in Machine Learning Designer

Add a One Sample T Test component on the pipeline page and configure the following parameters.

Fields setting

ParameterDescription
Sample 1 ColumnThe column that contains the sample data.

Parameters setting

ParameterDefaultDescription
Alternative Hypothesis Typetwo.sidedThe direction of the alternative hypothesis. See Choose an alternative hypothesis type.
Confidence Level0.95The confidence level of the test. Valid values: 0.8, 0.9, 0.95, 0.99, 0.995, 0.999.
Hypothesized Mean0The population mean to test against.
Core numberThe number of cores. Must be a positive integer.
Memory Size per CoreThe memory size per core. Valid values: 1–65536. Unit: MB.

Choose an alternative hypothesis type

Select the alternative hypothesis type based on what you want to test:

ValueMeaningWhen to use
two.sidedThe sample mean is different from the hypothesized mean (two-tailed test).No prior expectation of direction.
lessThe sample mean is less than the hypothesized mean (left-tailed test).Expecting the sample mean to be lower.
greaterThe sample mean is greater than the hypothesized mean (right-tailed test).Expecting the sample mean to be higher.

Method 2: Use PAI commands

Use PAI commands to configure and run the one-sample t-test. For more information about command syntax, see SQL Script.

pai -name t_test -project algo_public
    -DxTableName=pai_t_test_all_type
    -DxColName=col1_double
    -DoutputTableName=pai_t_test_out
    -DxTablePartitions=ds=2010/dt=1
    -Dalternative=less
    -Dmu=47
    -DconfidenceLevel=0.95
ParameterRequiredDefaultDescription
xTableNameYesThe name of the input table.
xColNameYesThe column to test.
outputTableNameYesThe name of the output table.
xTablePartitionsNonullThe partitions to select from the input table.
alternativeNotwo.sidedThe alternative hypothesis type. Valid values: two.sided, less, greater.
muNo0The hypothesized mean.
confidenceLevelNo0.95The confidence level. Valid values: 0.8, 0.9, 0.95, 0.99, 0.995, 0.999.

Sample output

{
    "AlternativeHypthesis": "mean not equals to 0",
    "ConfidenceInterval": "(44.72234194006504, 46.27765805993496)",
    "ConfidenceLevel": 0.95,
    "alpha": 0.05,
    "df": 99,
    "mean": 45.5,
    "p": 0,
    "stdDeviation": 3.919647479510927,
    "t": 116.081867662439
}

Output fields

FieldDescription
AlternativeHypthesisThe alternative hypothesis tested, stated in plain language.
ConfidenceIntervalThe range in which the true population mean is expected to fall at the specified confidence level.
ConfidenceLevelThe confidence level configured (for example, 0.95).
alphaThe significance level (1 - confidence level). Reject the null hypothesis if p < alpha.
dfDegrees of freedom (sample size minus 1).
meanThe sample mean.
pThe p-value. A value near 0 indicates strong evidence against the null hypothesis. A displayed value of 0 means the p-value is below the floating-point precision of the output, not exactly zero.
stdDeviationThe sample standard deviation.
tThe t-statistic. A large absolute value indicates the sample mean is far from the hypothesized mean.

How to interpret the results

Compare p against alpha (1 - confidence level):

  • If p < alpha: reject the null hypothesis. The sample mean is statistically significantly different from the hypothesized mean.

  • If p >= alpha: do not reject the null hypothesis. The data does not provide sufficient evidence of a difference.

Reading the example above: The p-value is approximately 0 (far below alpha = 0.05), and the t-statistic is 116.08. This is strong evidence to reject the null hypothesis—the sample mean of 45.5 is statistically significantly different from 0.