entropy.R 384 Bytes
Newer Older
1 2
#' @author Eric Coissac
#' @export
3 4
H_q = function(x,q=1) {
  sum(x * log_q(1/x,q),na.rm = TRUE)
5 6 7 8
}

#' @author Eric Coissac
#' @export
9 10
D_q = function(x,q=1) {
  exp_q(H_q(x,q),q)
11 12 13 14
}

#' @author Eric Coissac
#' @export
15 16
H_spectrum = function(x,q=1) {
  sapply(q,function(Q) H_q(x,Q))
17 18 19 20
}

#' @author Eric Coissac
#' @export
21 22
D_spectrum = function(x,q=1) {
  sapply(q,function(Q) D_q(x,Q))
23
}