"Kyriacos " <email@example.com> wrote in message <firstname.lastname@example.org>... > Hi everyone, > > I am trying to create a code that does ML estimation of a Vector Autoregression System (VAR) of two variables with one lag. My idea is to use "fminsearch" in order to minimise the -1*(log-likelihood). However, I am doing a mistake and I do not see where. In particular, the algorythm seems to get stuck close to the initial conditions, whichever those are. The log-likelihood function is: ===============
Your likelihood function code contains random quantities in it. It should not. FMINSEARCH (and maximum likelihood theory as well) assumes that your function will be the same function of x every time it gets evaluated.