R/mcpDifference.R

Defines functions mcpDifferences

mcpDifferences = function( x, gamma, lambda ) {
  xdiff = pmin(diff(sort(x)), gamma * lambda)
  if ( lambda > 0 ) {
    return(lambda * xdiff * ( 1 - ( xdiff / ( 2 * gamma * lambda ) ) ))
  } else {
    return(rep(0, length(xdiff)))
  }

}

Try the CatReg package in your browser

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

CatReg documentation built on June 14, 2021, 5:07 p.m.