Examples | Rank Tests | Vantage Analytics Library - Examples - Vantage Analytics Library

Vantage Analytics Library User Guide

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Lake
Product
Vantage Analytics Library
Release Number
2.2.0
Published
June 2025
ft:locale
en-US
ft:lastEdition
2025-07-02
dita:mapPath
ibw1595473364329.ditamap
dita:ditavalPath
iup1603985291876.ditaval
dita:id
zyl1473786378775
Product Category
Teradata Vantage

The Statistical Test metadata tables must be loaded into the database where Analytics Library is installed.

Mann-Whitney Test with Specified Threshold Probability

call td_analyze (
  'ranktest',
  'teststyle = mw;
   statsdatabase = val_user;
   database = val_source;
   tablename = customer;
   columnofinterest = income;
   columns = gender;
   groupby = years_with_bank;
   thresholdprobability = 0.01;'
);

Set of Independent Mann-Whitney Tests with Default Threshold Probability

call td_analyze (
  'ranktest',
  'teststyle = mw;
   statsdatabase = val_user;
   independent = true;
   database = val_source;
   tablename = customer_analysis;
   columnofinterest = income;
   columns = gender, ccacct, svacct;'
);

Wilcoxon Test Default Threshold Probability

call td_analyze (
  'ranktest',
  'teststyle = wilcoxon;
   statsdatabase = val_user;
   database = val_source;
   tablename = customer_analysis;
   firstcolumn = avg_ck_bal;
   secondcolumn = avg_sv_bal;
   groupby = years_with_bank;'
);

Friedman Test with Specially Prepared Input Table

The following statement builds the input table, Val_Friedman_WorkTable.

DROP TABLE "val_results"."Val_Friedman_Worktable";

CREATE SET TABLE "val_results"."Val_Friedman_Worktable" AS (
  SELECT
    "cust_id",
    "gender",
    "marital_status",
    "income",
    "ckacct",
    "svacct",
    SAMPLEID AS "xSampleId"
  FROM "val_source"."customer_analysis"
  SAMPLE
    WHEN gender = 'f' and marital_status = '1' THEN 18
    WHEN gender = 'f' and marital_status = '2' THEN 18
    WHEN gender = 'f' and marital_status = '3' THEN 18
    WHEN gender = 'f' and marital_status = '4' THEN 18
    WHEN gender = 'm' and marital_status = '1' THEN 18
    WHEN gender = 'm' and marital_status = '2' THEN 18
    WHEN gender = 'm' and marital_status = '3' THEN 18
    WHEN gender = 'm' and marital_status = '4' THEN 18
  END
) WITH DATA PRIMARY INDEX ("cust_id");

The value 18, the smallest count of value combinations in the gender and marital_status columns in the customer_analysis table, is calculated by the following statement:

SELECT MIN ("T0"."_val_N") AS "smallest_count" FROM (
  SELECT
    "S0"."marital_status" AS "marital_status",
    "S0"."gender" AS "gender",
    COUNT(*) AS "_val_N"
  FROM "val_source"."customer_analysis" AS "S0"
  GROUP BY "S0"."marital_status", "S0"."gender"
) AS "T0";

The following statement runs the Friedman Test.

call td_analyze (
  'ranktest',
  'teststyle = friedman;
   statsdatabase = val_user;
   database = val_results;
   tablename = Val_Friedman_Worktable;
   columnofinterest = income;
   treatmentcolumn = gender;
   blockcolumn = marital_status;'
);