BNET Procedure

Independence Tests

Both variable selection and structure learning require either independence tests between two variables or conditional independence tests given some other variables. PROC BNET supports independence tests by using the chi-square statistic, G-square statistic, normalized mutual information, or some combination of them.

Given two nominal variables X and Y (or interval variables after binning) that have levels r and c, respectively, the chi-square statistic is computed as

chi squared equals sigma-summation Underscript i equals 1 Overscript r Endscripts sigma-summation Underscript j equals 1 Overscript c Endscripts StartFraction left-parenthesis upper O Subscript i j Baseline minus upper E Subscript i j Baseline right-parenthesis squared Over upper E Subscript i j Baseline EndFraction

where upper O Subscript i j is an observed frequency in a cell of the contingency table of the two variables and upper E Subscript i j is the expected frequency of the cell. The degrees of freedom for the test is left-parenthesis r minus 1 right-parenthesis times left-parenthesis c minus 1 right-parenthesis. If the p-value of the test statistic is greater than the specified significance level, the two variables are considered to be independent.

Similarly, the G-square statistic is calculated as

upper G squared equals 2 sigma-summation Underscript i equals 1 Overscript r Endscripts sigma-summation Underscript j equals 1 Overscript c Endscripts upper O Subscript i j Baseline ln left-parenthesis StartFraction upper O Subscript i j Baseline Over upper E Subscript i j Baseline EndFraction right-parenthesis

where upper O Subscript i j is an observed frequency, upper E Subscript i j is the expected frequency, and the degrees of freedom for the test is left-parenthesis r minus 1 right-parenthesis times left-parenthesis c minus 1 right-parenthesis. If the p-value of the test statistic is greater than the specified significance level, the two variables are considered to be independent.

The mutual information between X and Y is defined as

upper I left-parenthesis upper X comma upper Y right-parenthesis equals sigma-summation Underscript x equals 1 Overscript r Endscripts sigma-summation Underscript y equals 1 Overscript c Endscripts p left-parenthesis x comma y right-parenthesis ln left-parenthesis StartFraction p left-parenthesis x comma y right-parenthesis Over p left-parenthesis x right-parenthesis p left-parenthesis y right-parenthesis EndFraction right-parenthesis

where p left-parenthesis x comma y right-parenthesis equals StartFraction upper O Subscript x y Baseline Over upper N EndFraction is the joint distribution function of X and Y; p left-parenthesis x right-parenthesis equals StartFraction sigma-summation Underscript y equals 1 Overscript c Endscripts upper O Subscript x y Baseline Over upper N EndFraction and p left-parenthesis y right-parenthesis equals StartFraction sigma-summation Underscript x equals 1 Overscript r Endscripts upper O Subscript x y Baseline Over upper N EndFraction are the marginal probability distributions of X and Y, respectively; and N is the total number of observations in the training data.

The mutual information is then normalized to be between 0 and 1 as

upper N upper I left-parenthesis upper X comma upper Y right-parenthesis equals StartRoot 1 minus e Superscript minus 2 upper I left-parenthesis upper X comma upper Y right-parenthesis Baseline EndRoot

where upper I left-parenthesis upper X comma upper Y right-parenthesis is the mutual information between X and Y.

If the value of the normalized mutual information is less than the specified significance level, the two variables are considered to be independent.

To test the conditional independence between two variables X and Y given a subset S of other variables (upper X not-an-element-of upper S and upper Y not-an-element-of upper S), the corresponding statistics are summed for each value combination of S, and the corresponding degrees of freedom for the chi-square and G-square statistics is left-parenthesis r minus 1 right-parenthesis times left-parenthesis c minus 1 right-parenthesis times q, where q is the number of value combinations for S.

The following PROC BNET options are related to independence tests:

  • The INDEPTEST= option specifies which test statistic or combination of them to use.

  • The ALPHA= option specifies the significance level for the chi-square and the G-square statistics.

  • The MIALPHA= option specifies the significance level for the normalized mutual information.

Last updated: August 06, 2026