Displaying 1 result from an estimated 1 matches for "alfa_log".
2008 Oct 23
1
distribution fitting
...1E-10:
> # fix numerical values
> for (i in 1:length(interarrival_times)) {
+ if (interarrival_times[i] == 0)
+ interarrival_times[i] = 0.0000000001
+ }
Then I defined the negative log likelihood for the Gamma distribution:
> nll_gamma_log <- function(lambda_log, alfa_log) {
+ n <- length(interarrival_times)
+ x <- interarrival_times
+ -n*exp(alfa_log)*lambda_log + n*log(gamma(exp(alfa_log))) -
(exp(alfa_log)-1)*sum(log(x)) + exp(lambda_log)*sum(x)
+ }
and passed it to the mle function:
> est_gamma <- mle(minuslog = nll_gamma_log, sta...