Kristian Lind
2011-Apr-10 08:35 UTC
[R] MLE where loglikelihood function is a function of numerical solutions
Hi there, I'm trying to solve a ML problem where the likelihood function is a function of two numerical procedures and I'm having some problems figuring out how to do this. The log-likelihood function is of the form L(c,psi) = 1/T sum [log (f(c, psi)) - log(g(c,psi))], where c is a 2xT matrix of data and psi is the parameter vector. f(c, psi) is the transition density which can be approximated. The problem is that in order to approximate this we need to first numerically solve 3 ODEs. Second, numerically solve 2 non-linear equations in two unknowns wrt the data. The g(c,psi) function is known, but dependent on the numerical solutions. I have solved the ODEs using the deSolve package and the 2 non-linear equations using the BB package, but the results are dependent on the parameters. How can I write a program that will maximise this log-likelihood function, taking into account that the numerical procedures needs to be updated for each iteration in the maximization procedure? Any help will be much appreciated. Kristian [[alternative HTML version deleted]]
Albyn Jones
2011-Apr-10 17:05 UTC
[R] MLE where loglikelihood function is a function of numerical solutions
Hi Kristian The obvious approach is to treat it like any other MLE problem: evaluation of the log-likelihood is done as often as necessary for the optimizer you are using: eg a call to optim(psi,LL,...) where LL(psi) evaluates the log likelihood at psi. There may be computational shortcuts that would work if you knew that LL(psi+eps) were well approximated by LL(psi), for the values of eps used to evaluate numerical derivatives of LL. Of course, then you might need to write your own custom optimizer. albyn Quoting Kristian Lind <kristian.langgaard.lind at gmail.com>:> Hi there, > > I'm trying to solve a ML problem where the likelihood function is a function > of two numerical procedures and I'm having some problems figuring out how to > do this. > > The log-likelihood function is of the form L(c,psi) = 1/T sum [log (f(c, > psi)) - log(g(c,psi))], where c is a 2xT matrix of data and psi is the > parameter vector. f(c, psi) is the transition density which can be > approximated. The problem is that in order to approximate this we need to > first numerically solve 3 ODEs. Second, numerically solve 2 non-linear > equations in two unknowns wrt the data. The g(c,psi) function is known, but > dependent on the numerical solutions. > I have solved the ODEs using the deSolve package and the 2 non-linear > equations using the BB package, but the results are dependent on the > parameters. > > How can I write a program that will maximise this log-likelihood function, > taking into account that the numerical procedures needs to be updated for > each iteration in the maximization procedure? > > Any help will be much appreciated. > > > Kristian > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > >