R/expq.R

Defines functions expq.CommunityProfile expq

Documented in expq expq.CommunityProfile

expq <-
function(x, q)
{
  if (q == 1) {
    return (exp(x))
  } else {
    Exponential <- (x*(1-q)+1)^(1/(1-q))
    if (q > 1) {
      Exponential[x > 1/(q-1)] <- NA
    }
    return (Exponential)
  }
}


expq.CommunityProfile <-
function(Profile)
{
  if (!is.CommunityProfile(Profile))
    stop("Profile must be a CommunityProfile")
  
  CP <- Profile
  CP$y <- vapply(seq_len(length(CP$x)), function(i) expq(CP$y[i], CP$x[i]), FUN.VALUE=0.0)
  if (!is.null(CP$low))
    CP$low <- vapply(seq_len(length(CP$x)), function(i) expq(CP$low[i], CP$x[i]), FUN.VALUE=0.0)
  if (!is.null(CP$high))
    CP$high <- vapply(seq_len(length(CP$x)), function(i) expq(CP$high[i], CP$x[i]), FUN.VALUE=0.0)
  
  return (CP)
}

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.