Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: mle stata program


From   Alfonso Miranda <[email protected]>
To   Statalist <[email protected]>
Subject   Re: st: mle stata program
Date   Mon, 7 Mar 2011 15:35:23 +0000

Dear Jian,

What is $ML_y2^2? Do you have more than one equation?

Best,

Alfonso.


On 07/03/2011 15:23, "Jian Zhang" <[email protected]> wrote:

> Hello all,
> 
> below is the loglikelihood function i'd like to maximize with stata.
> I wrote some program but it did not work. Could some one give me some
> help?
> 
> the log likelihood function for the ith observation: lnYi=-0.5 *
> ln(2pi) - 0.5ln(xi^2* theta^2 + sigma^2) -0.5 (lnYi - Beta* Zi)^2
> /(xi^2* theta^2 + sigma^2), where Yi is the dependent variable, Zi is
> the set of independent variables and xi is ONE independent variable
> from the set Zi.  pi, theta and sigma are the parameters to be
> estimated via ml
> 
> Corresponding to the log likelihood function is the program I wrote:
> 
> program myml
> version 9.2
> args lnf xb w theta sigma
> quietly {
> replace `w'=$ML_y2^2*`theta'^2+`sigma'^2
> replace `lnf'=-0.5 * ln(`w')-0.5*($ML_y1-`xb')/`w'
> }
> end 
> 
> But Stata said the program does not work.  Is there something wrong
> with the program?
> 
> Many thanks!
> 
> Jian
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/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/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index