search for: ll_gamma

Displaying 1 result from an estimated 1 matches for "ll_gamma".

Did you mean: lgamma
2011 Feb 25
0
Fitting distribution in range
Hello. I am trying to fit my data sample x with different distributions such that the integral from min(x) to max(x) of the fitted distribution will be one. Therefore I have wrote my own log-likelihood functions and then I am using mle {stats4}. So, for example: ll_gamma <- function(a,b) { integrand <- function(y){dgamma(y, shape=a, rate=b)} integ_res <- tryCatch({integrate(integrand,min_x,max_x)$value}, error=function(err){0}); if (integ_res == 0) { return(NA) } C = 1 / integ_res res = -(sum(log(C*dgamma(x,shape=a,rate=b)))) return...