R/calculateES.R

Defines functions calculateES

calculateES = function(x){

  # Calculate the profile
  prof     <- x$phit - x$pmiss

  # Calculate abs(profile) to find the maximum deviation of profile from zero and find the position where this maximum occurs
  abs.diff <- abs( prof )
  mx       <- max( abs.diff )
  mx.indx  <- which( abs.diff == mx)

  # Get the ES value
  ES       <- prof[mx.indx]

  # Return results
  res <- list(pos = mx.indx, ES = ES)
  return(res)

}

Try the PEIMAN2 package in your browser

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

PEIMAN2 documentation built on April 11, 2025, 6:12 p.m.