Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Contingency Table Output - How to get just the Chi-squared, df, p-value data table?

asibley
5 - Atom

Hi all -

 

Currently, when you run the Contingency Table for 2 variables and request to 'Include Chi-Squared Statistic' it doesn't provide you with an output of these values in the 'D' data output. You can, however, see the outputs in the 'R' report output; but, these are at the bottom of the formatted report and not simple to extract. 

 

Also, any way to output the critical values from this node as well? (or another.. any way other than manually pairing in the upper and lower limit tables?)

 

I did download the 'Chi Square Test Macro' but unfortunately get a different degree of freedom and different output for chi square result than when I compute manually and further differs from that of the 'Contingency Table' output.

 

Thank you for any input!

3 REPLIES 3
Aguisande
15 - Aurora
15 - Aurora

Hi asibley,

Inside the Contingency Table macro, on Summarize Tool (94), I believe you can extract the chi-square.

 

Just output a macro output to this tool and you'll have the value.

 

I recommend to work on a copied version of the Contingency Table Macro (and it's dependencies: \Supporting_Macros\PivotTable.yxmc and \Supporting_Templates\PivotTable_Template.html)

 

ChiSq.PNG

 

JasonH123
6 - Meteoroid

Hi Could you show more detail how to replicate the macro and modify it?

I do open the Macro and find Summarize(94), but when I try to close it after I add Macro output it denies me...

Aguisande
15 - Aurora
15 - Aurora

Hi @JasonH123

The issue here is that the macro's original path is in a "protected" directory (C:\Program Files\Alteryx\R-3.3.2\Plugin\Macros\Predictive Tools\).

I would copy the ContingencyTable.yxmc to a Custom Macro directory (See Options-> User Settings-> Macros Tab)

 

For this to work, there is an extra subdirectory needed within your Custom Macro Directory: Create one and call it "Supporting_Macros".

In this Supporting_Macros subdirectory, copy the PivotTable.yxmc (Used in the ContingencyTable Macro)

So, your Custom Macro Directory should be like:

C:\Alteryx_Custom_Macro_DIRECTORY

C:\Alteryx_Custom_Macro_DIRECTORY\Supporting_Macros

 

 

Once you got this structure, use your copied ContingencyTable Macro (Insert->Macro), not the one in the menu. That'll give you the desired output.

 

Best,

_AG_

Labels