Bookmark and Share

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


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

st: how to estimate nonlinear MLE


From   Lizzy Zhang <lizzy1230@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: how to estimate nonlinear MLE
Date   Fri, 14 Dec 2012 14:57:07 -0500

I have a regression y=f(x)=ax1/bx2 (this is just an example. The true
equation is much more complicated than that)
And we want to estimate a and b.

What I wrote is
     program define a
      1. version 7
      2. args lnf B1 B2 B3 sigma
      3. tempvar res
      4. qui gen double `res' = $ML_y1 -('B1'*$X1)/('B2'*$X2)
      5. qui replace `lnf' = -0.5*ln(2*_pi)-ln(`sigma')-0.5*`res'^2/`sigma'^2
      6. end

. ml model lf a ( price= mpg headroom)

. set seed 1

. ml search
    But it doesn't work. Could anyone please let me know where is wrong?
    Thanks so much!!!

Best,
    Lizzy
*
*   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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index