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: Does ml requires a non-linear function to have a linear part?


From   Aljar Meesters <[email protected]>
To   [email protected]
Subject   Re: st: Does ml requires a non-linear function to have a linear part?
Date   Fri, 26 Apr 2013 17:16:28 +0200

Dear Miquel,

You can solve this issue by not passing v(/m)lagmean as an independent
but dependent variable and using the constants as parameters. This
would give:
program datos4mean
    version 10.1
    args lnf theta2 theta3 sigma
    quietly replace `lnf' = ln(normalden($ML_y1, `theta2' *
$ML_y2^`theta3' * (1 - $ML_y2), `sigma'))
end

ml model lf datos4mean (b:vdmean=) (c:vlagmean=) (sigma:)
ml check
ml maximize

However, since you are estimating a nonlinear least squares model you
can also estimate

nl (vdmean = {b}*vlagmean^{c}*(1-vlagmean))

Which is less restrictive on the distribution assumption of the residuals.
Best,

Aljar


2013/4/26 Miguel Angel Duran <[email protected]>:
> In all the examples that I have been able to find about how to use ml to
> estimate a non-linear equation, there is always a linear part that makes it
> possible to specify the dependent variable. Nevertheless, the equation I am
> trying to estimate does not have that linear part. Can anyone help me to
> know whether I can use ml (and how if it were possible)?
>
> Just to explain myself beter, this is my equation,
>
> vdmean = b*vlagmean^c*(1-vlagmean)
>
> And this is one of the things what I have tried to do,
>
> . program datos4mean
>   1. version 10.1
>   2. args lnf theta2 theta3 sigma
>   3. quietly replace `lnf' = ln(normalden($ML_y1, `theta2' *
> vlagmean^`theta3' * (1-vlagmean), `sigma'))
>   4. end
>
> . ml model lf datos4mean (vdmean=mlagmean, nocons) (theta2:) (theta3:)
> (sigma:), vce(robust)
>
> . ml check
>
> RESULT: datos3mean HAS PASSED ALL TESTS
>
> . ml maximize
>
> And I get this message,
>
> initial:       log pseudolikelihood = -72.946848
> rescale:       log pseudolikelihood =  219.01781
> rescale eq:    log pseudolikelihood =  219.52686
> could not calculate numerical derivatives
> flat or discontinuous region encountered
> r(430);
>
>
> *
> *   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/


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