# Hypothesis-Test Mode Example 2: Normality Tests with GroupByColumns - Teradata Vantage

## Teradata® Vantage Machine Learning Engine Analytic Function Reference

Product
Release Number
1.0
8.00
Published
May 2019
Language
English (United States)
Last Update
2019-11-22
dita:mapPath
blj1506016597986.ditamap
dita:ditavalPath
blj1506016597986.ditaval
dita:id
lmf1502735330121
Product Category

This example shows the use of grouping columns, and also illustrates the syntax for testing against multiple distributions in a single SQL command.

## Input

The input table, factory_7, represents hypothetical mean-time-to-failure data for two products. This is a subset of the rows:

factory_7
product mttf
A 10039.5
A 9926.6
A 9971.34
A 9868.7
A 9940.17
A 10266.7
A 9768.64
A 10043.2
A 10133.7
A 9731.33
... ...
D 9721.21
D 10068.6
D 9952
D 9851.94
D 10378.3
D 9908.9
D 9749.43
D 10448
D 9681.25
D 10147.5
... ...

## SQL Call

The function call evaluates two possible distributions (normal and uniform) and applies the Kolmogorov-Smirnov (KS) and Anderson-Darling (AD) fit tests.

```SELECT * FROM DistributionMatchReduce (
ON DistributionMatchMultiInput (
ON (
SELECT RANK() OVER (PARTITION BY product ORDER BY mttf) AS "rank", product, mttf
FROM factory_7
WHERE mttf IS NOT NULL
) AS "input" PARTITION BY ANY
ON (
SELECT product, COUNT(*) AS group_size
FROM factory_7
WHERE mttf IS NOT NULL
GROUP BY product
) AS groupstats DIMENSION
USING
ValueColumn ('mttf')
Distributions ('NORMAL:10000,150','UNIFORMCONTINUOUS:9500,10500')
GroupByColumns ('product')
MinGroupSize (50)
) PARTITION BY product
) AS dt;
```

## Output

The reported p-values support these conclusions:
• For product A:
• Both tests fail to reject the null hypothesis that the data fit a normal distribution with the specified parameters.
• Both tests reject the null hypothesis that the data fit the specified uniform distribution.
• For product D:
• Both tests fail to reject the null hypothesis that the data fit a uniform distribution with the specified parameters.
• Both tests reject the null hypothesis that the data fit the specified normal distribution.
In the output table column names, when 'a' and 'b' appear between digits, interpret them as comma (,) and period (.), respectively.