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 require a non-linear function to have a linear part?
From
"Miguel Angel Duran" <[email protected]>
To
<[email protected]>
Subject
RE: st: Does ml require a non-linear function to have a linear part?
Date
Mon, 29 Apr 2013 11:24:20 +0200
Dear Aljar,
Thank you very much for your help. Your suggestion works. Indeed, I obtain
the same results that from nl. By the way, the reason to use ml is because I
have to estimate different versions of the same basic model. To estimate
some of them, nl requires introducing starting values, but I have the
feeling that results are too dependent on the starting values used.
One more question if you do not mind. Suppose I would have a third parameter
(theta3), so that the "quietly replace" line of the program becomes:
quietly replace `lnf' = ln(normalden($ML_y1, `theta2' * $ML_y2^`theta3' * (1
- $ML_y2^`theta4'), `sigma'))
Then what would be ml model command? "ml model lf datos4mean (b:vdmean=)
(c:vlagmean=) (theta4:) (sigma:)?
Thanks in advance.
Miguel.
-----Mensaje original-----
De: [email protected]
[mailto:[email protected]] En nombre de Aljar Meesters
Enviado el: viernes, 26 de abril de 2013 17:16
Para: [email protected]
Asunto: Re: st: Does ml requires a non-linear function to have a linear
part?
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/
*
* 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/