Odds and Risk Ratios

This Node Is Deprecated — This version of the node has been replaced with a new and improved version. The old version is kept for backwards-compatibility, but for all new workflows we suggest to use the version linked below.
Go to Suggested ReplacementOdds and Risk Ratios

This node calculates the Maximum Likelihood Estimate (MLE) Odds Ratio (OR) and the Maximum Likelihood Estimate (MLE) Risk Ratio (RR), i.e., "Wald" OR and RR, from two selected categorical columns. For each column a value is selected to be considered the value under observation. All other values in non-binary categorical columns are considered as the "not" case.

X¬ X
¬ Ycd

Odds Ratio:
OR = (a/b) / (c/d) = (a * d) / (b * c)

Risk Ratio:
RR = (a / (a+b)) / (c / (c+d))

Fisher's Exact Test is calculated with
p = (a + b)!(c + d)!(a + c)!(b + d)! / (a!b!c!d!n!), where
n = a + b + c + d
over the sum of the marginal tables.

The two-tailed, left-tailed, and right-tailed p-values are calculated. The value for the Laplace correction is not considered for this calculation.

The Chi-Squared Test (Χ2) is calculated with
Χ2 = ∑ij (Oij - Eij)2 / Eij2
Eij = Ti * Tj/n
Ti and Tj are the sums of the row and columns respectively.

Yates' Corrected Χ2 is
Χ2Yates = ∑ij (|Oij - Eij|-0.5)2 / Eij2

Pearson's Coefficient of Contingency
Pearson's C = √Χ2 / (Χ2 + n)

Cramér's Coefficient of Contingency
Cramér's V = √Χ2/n


Column X
The column to choose for the X variable.
Column Y
The column to choose for the Y variable.
Value from Column X
The value from the X variable to choose as the value to be examined.
Value from Column Y
The value from the Y variable to choose as the value to be examined.
Confidence Interval
The confidence interval to be calculated.
Laplace Correction
The amount of Laplace correction to use, if one of the values ({a,b,c,d}) is 0. This value is applied to all four entries in the contingency table.

Input Ports

The data table with the two features to compare.

Output Ports

The output table with the results and significance measurements.
A table with the values from the table shown above.


This node has no views


  • No workflows found



You want to see the source code for this node? Click the following button and we’ll use our super-powers to find it for you.