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]

st: how to estimate nonlinear MLE


From   Lizzy Zhang <[email protected]>
To   [email protected]
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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index