R/distance.R

Defines functions distance

distance <- function(P,Q)
{
  if (length(P)!=length(Q))
  {
    print("erreur")
    return(0)
  } else {
    tailcop=length(P)
    KL=sum(P*log(P/Q),na.rm=TRUE)
    L2=sum((P-Q)^2)*tailcop
    L1=sum(abs(P-Q))
    APE=sum(abs(1-P/Q))/tailcop
    return(cbind(KL,L2,L1,APE))
  }
}

Try the subrank package in your browser

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

subrank documentation built on April 6, 2023, 1:11 a.m.