5.4.5 - Tutorial - Friedman Test Analysis - Teradata Warehouse Miner

Teradata Warehouse Miner User Guide - Volume 3Analytic Functions

Teradata Warehouse Miner
Release Number
February 2018
English (United States)
Last Update

In this example, a Friedman test analysis is performed on the fictitious banking data to analyze account usage. If the data does not have equal cell counts in the treatment x block cells, stratified sampling can be used to identify the smallest count, and then produce a temporary table which can be analyzed.

  1. Identify the smallest count with a Free Form SQL analysis (or two Variable Creation analyses) with SQL such as the following (be sure to set the database in the FROM clause to that containing the demonstration data tables):
    	 MIN("_twm_N") AS smallest_count
    		,COUNT(*) AS "_twm_N"
    		FROM "twm_source"."twm_customer_analysis"
    		GROUP BY "marital_status", "gender"
    	) AS "T0";
  2. Use a Sample analysis with stratified sampling to create the temporary table with equal cell counts. The value 18 used in the stratified Sizes/Fractions parameter below corresponds to the smallest_count returned from above.
  3. Parameterize a Sample analysis called Friedman Work Table Setup as follows:
    • Input Options
      • Available Tables — TWM_CUSTOMER_ANALYSIS
      • Selected Columns and Aliases
        • TWM_CUSTOMER_ANALYSIS.cust_id
        • TWM_CUSTOMER_ANALYSIS.gender
        • TWM_CUSTOMER_ANALYSIS.marital_status
        • TWM_CUSTOMER_ANALYSIS.income
    • Analysis Parameters:
      • Sample Style — Stratified
      • Stratified Sample Options
      • Create a separate sample for each fraction/size — Enabled
      • Stratified Conditions
        • gender='f' and marital_status='1'
        • gender='f' and marital_status='2'
        • gender='f' and marital_status='3'
        • gender='f' and marital_status='4'
        • gender='m' and marital_status='1'
        • gender='m' and marital_status='2'
        • gender='m' and marital_status='3'
        • gender='m' and marital_status='4'
      • Sizes/Fractions — 18 (use the same value for all conditions)
    • Output Options:
      • Store the tabular output of this analysis in the database — Enabled
      • Table Name — Twm_Friedman_Worktable
  4. Finally, Parameterize a Friedman Test analysis as follows:
    • Input Options
      • Select Input Source — Analysis
      • Available Analyses — Friedman Work Table Setup
      • Available Tables — Twm_Friedman_Worktable
      • Select Statistical Test Style — Friedman
      • Column of Interest — income
      • Treatment Column — gender
      • Block Column — marital_status
    • Analysis Parameters:
      • Analysis Parameters
        • Threshold Probability — 0.05
  5. Run the analysis.
  6. Click Results when it completes
    For this example, the Friedman Test analysis generated the following table.
    Results may vary due to the use of sampling in creating the input table Twm_Friedman_Worktable.
    The test shows that analysis of income by treatment (male vs. female) differences is significant at better than the 0.001 probability level. An ‘n’ or ‘p’ means significant and an ‘a’ means accept the null hypothesis.
    The SQL is available for viewing but not listed below.
    Friedman Test
    Kendalls_W Average_Spearmans_Rho DF_1 DF_2 F FriedmanPValue FriedmanPText FriedmanCallP_0.001
    0.763196925 0.773946177 1 71 228.8271876 0.001 <0.001 p