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: Maximum likelihood estimation

 From Joseph Monte To statalist Subject Re: st: Maximum likelihood estimation Date Wed, 13 Feb 2013 21:27:55 +0000

```Dear Statalisters,

I'll try again with a little more info since I did not get any
responses. Here is the code I have so far (based on previous Statalist
posts and "Maximum Likelihood estimation with Stata" by
Gould, Pitbaldo and Poi, 4th ed.). The paper I cited in my first email
below models the log of the variance of the regression error in
equation 2 while I believe I have modelled the log of sigma. I would
preferably like to model the log of the variance as in the paper cited
but am not sure how.

cscript
program mynormal_lf1
version 12
args todo b lnfj g1 g2
tempvar mu lnsigma sigma
mleval `mu' = `b', eq(1)
mleval `lnsigma' = `b', eq(2)
quietly {
gen double `sigma' = exp(`lnsigma')
replace `lnfj' =
ln(normalden(\$ML_y1,`mu',`sigma'))
if (`todo'==0) exit
tempvar z
tempname dmu dlnsigma
gen double `z' = (\$ML_y1-`mu')/`sigma'
replace `g1' = `z'/`sigma'
replace `g2' = `z'*`z'-1
}
end

ml model lf1 mynormal_lf1 (mu: y = x1 x2 x3 x4 x5 x6 x7 x8 x9)
(lnsigma: y = x1 x2 x3 x4 x5 x6 x7 x8 x9)
ml max

Thanks,

Joe

On Tue, Feb 12, 2013 at 9:54 AM, Joseph Monte <hmjc66@gmail.com> wrote:
> Dear Statalisters,
>
> I need to do a maximum likelihood estimation very similar to that in
> equations (1) and (2) on page 439 of Lowry et al. (2010). Note that
> equation 2 has the same independent variables as equation 1. I would
> appreciate it if someone would let me know the code I need to use with
> the help of an example. I use Stata 12.
>
> References
>
> Lowry, M., Officer, M.S., Schwert, G.W., 2010. The variability of IPO
> initial returns. The Journal of Finance 65, 425-465
>
>
> Thanks,
>
> Joe
> *
> *   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/
```