R/log_Lik_Weib_gamma_weighted.R

Defines functions log_Lik_Weib_gamma_weighted

Documented in log_Lik_Weib_gamma_weighted

log_Lik_Weib_gamma_weighted <- function(TRpar, datain, r, dist){
  shape <- TRpar[1]
  scale <- TRpar[2]
  x <- datain
  loglik <- switch(dist,
           "weib"= sum(-(x**shape/scale**shape) - r*log(scale) +
                   log(shape) + (-1 + r)*log(x) + shape*(-log(scale) + log(x)) - log(gamma((r + shape)/shape))),
            "gamma" = sum(log(dgamma(x,shape = shape+r, scale = scale, log = FALSE)))
  )
  return(-loglik)
}

Try the RSizeBiased package in your browser

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

RSizeBiased documentation built on March 29, 2021, 9:11 a.m.