R/int_estimate_RMI.R

Defines functions estimate_RMI

estimate_RMI <- function(estimated_table) {

  # Normalize
  estimated_classifier <- estimated_table/sum(estimated_table)
  
  prior       <- rowSums(estimated_classifier)         # Prior
  accuracy    <- get_accuracy(estimated_classifier)    # Accuracy
  information <- get_information(estimated_classifier) # Information

  information_bounds <- get_analytic_information_bounds(prior, accuracy)
  lower_bound <- information_bounds$lowest
  upper_bound <- information_bounds$highest

  RMI <- ( information - lower_bound ) /
         ( upper_bound - lower_bound )

  # Where bounds collapse because of accuracy edge cases, return NaN
  RMI[lower_bound == upper_bound] <- NaN

  RMI
}

  

Try the statConfR package in your browser

Any scripts or data that you put into this service are public.

statConfR documentation built on April 3, 2025, 5:35 p.m.