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

From |
"Stas Kolenikov" <skolenik@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: RE: Syntax problems with maximum likelihood (method lf) |

Date |
Thu, 30 Oct 2008 08:47:27 -0500 |

Adding to Glenn's comments about the problems with the code, it appears that you need n to be defined externally -- as a variable or as a scalar. Somewhere you have b without the localization embedders (b instead of `b'). You might want to check out -mata optimize- instead of -ml-. The former is a pretty universal optimizer, while the latter is really intended to solve statistical problems with the data. If you want to find the maximum/minimum of a function, it might be working out better and result in a cleaner code with -mata optimize-. On 10/29/08, Katia Bobulova <katia.bobulova@googlemail.com> wrote: > Dear Nick, > > I'll try to be more clear. > > following my program: > > program define myprogram > version 10.0 > args lnf a b c e > > tempvar sigma mc ma msigma mb > > quietly gen double `sigma'=0.5*`e' > quietly gen double `mc'=1-`c' > quietly gen double `ma'=1-`a' > quietly gen double `msigma'=1-`e' > quietly gen double `mb'=1-`b' > > quietly replace > `lnf'=ln((`a')*(`b')*((((`mc')*(`sigma')+(`m'))^alfa)*(((`mc')*(`sigma'))^s)*(((`mc)*(`msigma'))^n))+ > (`a')*(`mb)*((((`mc') *(`sigma'))^b)*(((`mc') *(`sigma') > > end > > Everything is fine, but when I type: > > ml model lf myprogram (a:) (b:) (c:) (e:) > > Stata tells me that is invalid syntax. > > What's wrong? > > Thanks > > Katia > > 2008/10/29 Nick Cox <n.j.cox@durham.ac.uk>: > > > It looks as if there is a bug within the part of the program you have not shown us. > > > > I suspect that you did not type > > > > version10.1 > > > > as that would have generated a different error message. > > > > version 10.1 > > > > is the correct syntax. > > > > In other words, you need to show more of your program to get better advice. > > > > Nick > > n.j.cox@durham.ac.uk > > > > Katia Bobulova > > > > I am using the likelihood function lf. I have a problem in the end. I > > have written the program and I don't have any problem. > > > > I typed: > > program define myprogram > > version10.1 > > args lnf a b c d > > . > > . > > . > > end > > > > After this I tiped: > > > > ml model lf myprogram (a:) (b:) (c:) (d:) > > > > but Stata tells me that is an invalid syntax. Any suggestion? > > > > > > * > > * 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/ > -- Stas Kolenikov, also found at http://stas.kolenikov.name Small print: I use this email account for mailing lists only. * * 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/

**References**:**st: Syntax problems with maximum likelihood (method lf)***From:*"Katia Bobulova" <katia.bobulova@googlemail.com>

**st: RE: Syntax problems with maximum likelihood (method lf)***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**Re: st: RE: Syntax problems with maximum likelihood (method lf)***From:*"Katia Bobulova" <katia.bobulova@googlemail.com>

- Prev by Date:
**RE: st: Could not find feasible values(was: Syntax problems with maximum likelihood (method lf))** - Next by Date:
**st: Counter [was: various digressive and meandering threads]** - Previous by thread:
**RE: st: RE: Syntax problems with maximum likelihood (method lf)** - Next by thread:
**st: p-value in stata???** - Index(es):

© Copyright 1996–2016 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |