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: ml bounds


From   Beatrice Crozza <[email protected]>
To   [email protected]
Subject   Re: st: ml bounds
Date   Fri, 5 Mar 2010 10:42:28 +0000

The problem is how I wrote the restrictions, the code is fine without them.

Could you please help to understand where I did a mistake? I wnat to
impose these restrictions:

 m>0
 e>0
 1>=d>=0
 1>=a>=0

Maybe I made a mistake in the way I wrote nlcom?

Thanks
Bea

2010/3/4 Stas Kolenikov <[email protected]>:
> so which part of the code returns the error message? What does -ml check-
> say? You might also want to have -ml trace on- to see what's going on in
> your evaluator.
>
> On Thu, Mar 4, 2010 at 1:20 PM, Beatrice Crozza
> <[email protected]>wrote:
>
>> Dear all,
>>
>> I tried to write my likelihood with the following restrictions for
>> some parameters:
>> m>0
>> e>0
>> 1>=d>=0
>> 1>=a>=0
>>
>> following there is my code.
>>
>> However, I received as error message: estimates not found, so this
>> means that I made a mistake in how I imposed the restrictions.
>>
>> Could you please help me to understand what I am doing wrong and how
>> to solve the problem?
>>
>> Thank you very much for your help
>>
>> Bea
>>
>>
>> program define myprog
>>
>> args lnf a d m e g p
>>
>> tempvar ma md mm  me mg mp am dm omm em
>>
>> quietly gen double `am'=exp(`a')/(1+exp(`a'))
>> quietly gen double `dm'=exp(`d')/(1+exp(`d'))
>> quietly gen double `omm'=exp(`m')
>> quietly gen double `em'=exp(`e')
>> quietly gen double `ma'=1-`am'
>> quietly gen double `md'=1-`dm'
>> quietly gen double `mm'=1-`omm'
>> quietly gen double `me'=1-`em'
>> quietly gen double `mg'=1-`g'
>> quietly gen double `mp'=1-`p'
>>
>> quietly replace
>>
>> `lnf'=ln((`am')*(`dm')*((((`mm')+(`omm')*(`em')*(`g'))^x1)*(((`omm')+(`mm')*(`em')*(`p'))^x2)*(((`mm')*(`em')*(`me'))^x3)*(((`mmo')*(`em')*(`mg'))^x4)*(((`mm')*(`mp'))^x5)*(((`mmo')*(`eo'))^x6)))
>>
>> end
>>
>> ml model lf myprog (a:) (d:) (m:) (e:) (g:) (p:)
>> ml check
>> ml search
>> ml maximize, difficult
>>
>> nlcom (a: exp([am]_b[_cons])/(1+exp([am]_b[_cons])))
>> nlcom (d: exp([dm]_b[_cons])/(1+exp([dm]_b[_cons])))
>> nlcom (e: exp([em]_b[_cons]))
>> nlcom (m: exp([omm]_b[_cons]))
>>
>>
>> 2010/3/3 E. Paul Wileyto <[email protected]>:
>> > Please be aware that bounds only applies to search, and not to maximize.
>> >  Search looks for plausible initial values, not for the final mle.
>> >
>> > One way to place bounds on parameters is to replace the parameter in your
>> > likelihood with a function that is bounded.  For example, if you want to
>> > make sure that your parameter A does not fall below 0, then replace it
>> with
>> > A=exp(b).  ml will optimize parameter b, with bounds of minus to plus
>> > infinity, but the parameter of interest, A, remains above 0.  You can
>> then
>> > recover A and the standard error for A using nlcom.
>> >
>> > In a similar fashion, use a logistic function to create an upper and
>> lower
>> > bound.
>> >
>> > Paul
>> >
>> > Beatrice Crozza wrote:
>> >>
>> >> Dear All,
>> >>
>> >> I am doing a maximum likelihood and I would like to specify some
>> >> bounds for my parameters.
>> >>
>> >> ml model lf myprog (a:) (d:) (m:) (e:) (g:) (p:)
>> >> ml search
>> >> ml maximize, difficult
>> >>
>> >> I read on the Stata manual that my bounds should be placed after ml
>> >> search:
>> >>
>> >>  bounds(ml_search_bounds) specifies the search bounds.  The command ml
>> >>        model issues is ml search ml_search_bounds, repeat(#).
>>  Specifying
>> >>        search bounds is optional.
>> >>
>> >> My bounds should be:
>> >> 0< e m, 0<=a d <=1
>> >>
>> >> How should I write this after ml search?
>> >>
>> >> Thank you very much for your help.
>> >>
>> >> Bea
>> >> *
>> >> *   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/
>> >>
>> >>
>> >
>> > --
>> > E. Paul Wileyto, Ph.D.
>> > Assistant Professor of Biostatistics
>> > Tobacco Use Research Center
>> > School of Medicine, U. of Pennsylvania
>> > 3535 Market Street, Suite 4100
>> > Philadelphia, PA  19104-3309
>> >
>> > 215-746-7147
>> > Fax: 215-746-7140
>> > [email protected]
>> > *
>> > *   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/

*
*   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/


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