R/youdenindex.R

Defines functions youdenindex

youdenindex <-
function(ytest, ytestpred, categ) {
  
  # Number of true positives:
  ntp <- sum((ytest==categ) & (ytestpred==categ))
  # Number of positives:
  np <- sum(ytest==categ)
  
  # Number of true negatives:
  ntn <- sum((ytest!=categ) & (ytestpred!=categ))
  # Number of negatives:
  nn <- sum(ytest!=categ)
  
  # Sensitivity and specificity:
  sens <- ntp/np; spec <- ntn/nn
  
  # Return value of Youden's J statistic:
  return(sens + spec - 1)
  
}

Try the ordinalForest package in your browser

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

ordinalForest documentation built on Dec. 1, 2022, 1:25 a.m.