# [R] MLE where loglikelihood function is a function of numerical solutions

Albyn Jones jones at reed.edu
Sun Apr 10 19:17:38 CEST 2011

```to clarify: by  "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. "
I mean the derivatives of LL(psi+eps) are close to the derivatives of LL(psi),
and perhaps you would want the hessian to be close as well.

albyn

Quoting Albyn Jones <jones at reed.edu>:

> 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
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help