TD_ZTest Function Example | Teradata Vantage - TD_ZTest Example - Teradata® Database

Database Analytic Functions

Product
Teradata® Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-28
dita:mapPath
Teradata_Vantage™___Advanced_SQL_Engine_Analytic_Functions.withLogo_upload_July2021/wnd1589838592459.ditamap
dita:ditavalPath
Teradata_Vantage™___Advanced_SQL_Engine_Analytic_Functions.withLogo_upload_July2021/ayr1485454803741.ditaval
dita:id
B035-1206
lifecycle
previous
Product Category
Teradata Vantage™

Input: example_table

Every complete example in this document is available in a zip file that you can download. The zip file includes a SQL script file that creates the input tables for the examples. If you are reading this document on https://docs.teradata.com/, you can download the zip file from the attachment in the left sidebar.

       col1         col2
-----------  -----------
         93           12
          ?           12
         22            4
          ?           87
          1           10
          ?           43
         92           31
          ?           23
          2            3
          ?           52
         21           65
          ?           49
          ?           17
          ?           17
          ?           14
          ?           24
         53           20
         85            9
         50           11
         86            1

SQL Call

SELECT * FROM TD_ZTest (
  ON example_table AS InputTable
  USING
  FirstSampleColumn ('col1')
  SecondSampleColumn ('col2')
  FirstSampleVariance (0.5)
  SecondSampleVariance (0.7)
  AlternativeHypothesis ('two-tailed')
  MeanUnderH0 (-20)
  Alpha (0.05)
) AS dt;

Output

firstsamplecolumn                                                                                                                 secondsamplecolumn                                                                                                                         N1           N2                   mean1                   mean2  AlternativeHypothesis                            z_score                   Alpha           CriticalValue                 p_value  Conclusion
--------------------------------------------------------------------------------------------------------------------------------  --------------------------------------------------------------------------------------------------------------------------------  -----------  -----------  ----------------------  ----------------------  --------------------------------  ----------------------  ----------------------  ----------------------  ----------------------  --------------------------------
col1                                                                                                                              col2                                                                                                                                       10           20   5.05000000000000E 001   2.52000000000000E 001  TWO-TAILED                         1.55377718139113E 002   5.00000000000000E-002   1.95996398454005E 000   0.00000000000000E 000  Reject Null hypothesis
 
 
 
 
.sidetitles view
 
 
    firstsamplecolumn  col1
   secondsamplecolumn  col2
                   N1           10
                   N2           20
                mean1   5.05000000000000E 001
                mean2   2.52000000000000E 001
AlternativeHypothesis  TWO-TAILED
              z_score   1.55377718139113E 002
                Alpha   5.00000000000000E-002
        CriticalValue   1.95996398454005E 000
              p_value   0.00000000000000E 000
           Conclusion  Reject Null hypothesis