R/roc.R

Defines functions roc.nsc

roc.nsc <-function(object) {
###Computes the roc curve for a nsc model
  nonzero <- object$nonzero^(1/4)
  errors <- object$errors
  if(is.null(errors))
    stop("No errors component")
  n <- length(errors)
  heights <- (errors[1:(n - 1)] + errors[2:n])/2
  bases <- diff(nonzero)
  area <- sum((nonzero[-1] + nonzero[-n]) * heights * bases) /
    (-2 * diff(range(nonzero)))
  area
}

Try the pamr package in your browser

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

pamr documentation built on May 2, 2019, 12:35 p.m.