0
votes

I am fitting the normalized histogram of my dataset $x \in [60,80]$ to Nakagami distribution. First I have estimated the scale and shape parameters using dnaka of VGAM package through the following MLE code:

ll <- function(par) {
  if(par[1]>0 & par[2]>0) {return(-sum(log(dnaka(x, scale = par[1], shape = par[2]) ) ) )}  # m=shape, ohm or spread = scale
  else return(Inf)
}
mle = optim(c(1000,1), ll)

Then, I am estimating the log-likelihood value based on the estimated parameters through the following code:

lik = sum(log(dnaka(x, shape = mle$par[1], scale = mle$par[2]) ) )

But the log-likelihood value lik is -Inf. I understand that this infinite value is due to the exp(.) term in the PDF equation of Nakagami distribution. Is there a way to estimate the finite log-likelihood value for the Nakagami distribution for my dataset $x \in [60,80]$? Thank you.

1
Are you sure you want to fit a Nakagami distribution to your data in the range 60 < x < 80? The distribution will have nearly no mass in that range, so I am not surprised that you get some strange results. Unless I am missing something, this makes no sense to me. Also, the shape parameter is defined for shape >= 0.5, so your log-likelihood function is not correct.Maurits Evers

1 Answers

1
votes

Please see my comment to the original question.

Here is a working example using simulated data with scale = 1.5 and shape = 1

set.seed(2017);
x <- rnaka(10^4, scale = 1.5, shape = 1);

ll <- function(par) {
    if (par[1] >= 0.5 && par[2] > 0) {
        return(-sum(log(dnaka(x, scale = par[1], shape = par[2]))));
    }
    else return(Inf);
}

mle <- optim(c(0.5, 1), ll);

mle$par;
#[1] 1.4833965 0.9938022

ll(mle$par);
#[1] 7946.478