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)  85.65009
Anyone knows why this is the case? Thanks!!!!!