R/KLq.R

Defines functions KLq

Documented in KLq

KLq <-
function(Ps, Pexp, q = 1, CheckArguments = TRUE) 
{
  if (CheckArguments)
    CheckentropartArguments()
  
  dataKLq <- Ps^q*lnq(Ps/Pexp, q)
  # Ignore if Pexp==0 (then P==0 too), and set 0log0=0
  dataKLq[Pexp == 0 | Ps == 0] <- 0
  return (sum(dataKLq)) # equals sum(P* (P^(q-1)-Pexp^(q-1))/(q-1), na.rm = TRUE)
}

Try the entropart package in your browser

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

entropart documentation built on Sept. 26, 2023, 5:09 p.m.