Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# Re: st: How to maximize an approximated likelihood

 From Nick Cox To "statalist@hsphsun2.harvard.edu" Subject Re: st: How to maximize an approximated likelihood Date Mon, 8 Apr 2013 10:18:47 +0100

```You asked the same question a few days ago at

http://www.stata.com/statalist/archive/2013-04/msg00152.html

The Statalist FAQ has advice on what to do if no-one answers. One
repost, as here, is allowed, but it's best to think why no-one
answered and try to rephrase the question.

In this case, your problem seems a long way away from standard -ml-
problems, as no response variable is evident, so I suspect that too
many user-programmers found your question unclear and/or too
complicated to try to understand.

I hope you get a better answer, but the same question is not going to
be any easier to understand.

Nick
njcoxstata@gmail.com

On 8 April 2013 09:04, Feddag Mohand-Larbi
<Mohand-Larbi.Feddag@univ-nantes.fr> wrote:
> Dear Statausers,
>
> I am wondering to know how to maximize an approximated likelihood
> depending on three parameters: the difficulty parameter as matrix, the
> mean of the latent traits and its variance.
>
> The function wrotten in Stata where the approximation is obtained by
> Gauss-Hermite quadrature is given as follows:
>
> qui gen proba=.
> qui gen x=.
> forvalues i=1/`nbobs' {
>     local int2=1
>     local u=RaschDepLoc[`i',1]
>     local v=`diff'[1,1]
>     local int1 "exp(`u'*(x-`v'))/(1+exp(x-`v'))"
>     forvalues j=2/`nbitems' {
>          local t=`diff'[`j',1]
>          local r=RaschDepLoc[`i',`=`j-1'']
>          local s=RaschDepLoc[`i',`j']
>          local int2
> "`int2'*exp(`s'*(x-`t'+`d'*`r'))/(1+exp(x-`t'+`d'*`r'))"
>         }
>         local int="`int1'*`int2'"
>         qui gausshermite `int', mu(`mu') sigma(`sigma') display
>         qui replace proba=r(int) in `i'
>
>    }
> gen lik=log(proba)*`nbobs'
>
> where nbobs is the number of individuals, nbitems is the number of
> items, RaschDepLoc is the matrix of data of order (nbobs*nbitems), diff
> is the vector of difficulties parameters, mu and sigma^2 are the mean
> and the variance of the latent traits.
>
> I don't know how to write this function in order to use ml model lf myfunction (? =?)
> and ml maximize
>
>
> best
>
>
> Dr Feddag
>
>
>
>
>
>
>
>
>
>
>
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```