The error message when using the function "mle" in the package "stats4"

Hello Everyone!

I was using the function 'mle' to calculate the maximum likelihood estimate for my parameters using the package "stats4". However, when I construct my negative log-likelihood function and put it into mle function with some initial values, it just shows the following error:

fit <- mle(NW, start = list(bandwidth = matrix(0.1, ncol = 2 ,nrow=20 ) ,sigma.e =1),  method = "L-BFGS-B") 

Error in mle(NW, start = list(bandwidth = matrix(0.1, ncol = 2, nrow = 20), :
Mismatch in length of start values"

I know this may be due to the initial values I gave may not match with what I put in the NW function. However, I checked again and again and did not find anything wrong and I can actually compute the NW (the negative log-likelihood value) with the initial values

NW(bandwidth = matrix(0.1, ncol = 2 ,nrow=20 ),sigma.e = 1)
[1] 85.65009

Anyone knows why this is the case? Thanks!!!!!

Hi!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.