gen_number_min: Generate a New Number for Minimizing Mutual Information

View source: R/gen_number_min.R

gen_number_minR Documentation

Generate a New Number for Minimizing Mutual Information

Description

This function modifies a given contingency table by swapping values between two cells in a way that minimizes the mutual information. The function randomly selects two cells from the table and adjusts their values to reduce mutual information, returning the modified table.

Usage

gen_number_min(x)

Arguments

x

A contingency table (numeric matrix or table).

Details

This function performs the following steps:

  1. Randomly selects two rows and two columns from the table.

  2. Ensures that the selected cells have non-zero values.

  3. Adjusts the values of the selected cells in the table to minimize mutual information.

  4. Returns the modified table with minimized mutual information.

Value

A modified contingency table with minimized mutual information.

Examples

# Example usage with a contingency table:
pair_table <- table(c(1, 2, 2, 3), c(1, 1, 2, 2))
gen_number_min(pair_table)


covalchemy documentation built on April 12, 2025, 2:15 a.m.