Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
brendan.halpin@ul.ie (Brendan Halpin) |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: FW: ML for logit/ologit |

Date |
Wed, 16 Nov 2011 11:28:12 +0000 |

On Wed, Nov 16 2011, Thomas Murray (Department of Economics) wrote: > gen double `lng' = ln(invlogit(`b1'*((`x'^(1-`rho')-1)/(1-`rho')))) if $ML_y1==1 > replace `lng' = ln(invlogit(-`b1'*((`x'^(1-`rho')-1)/(1-`rho')))) if $ML_y1==0 > This is Brendan's comment from a bit earlier: > > You have "((^(1-)" in there, so the ^ doesn't apply to a variable, and therefore isn't recognised as an operator. > > I think this is because your `x' expands to "". > > Could ^ be failing to pick up `rho' inside the bracket? No. The problem is that your x is expanding to nothing (as is rho). Your code says ln(invlogit( `b1' *((`x'^(1-`rho')-1)/(1-`rho')))) The expansion is ln(invlogit(__000006*(( ^(1- )-1)/(1- )))) b1 is expanding to __000006 but x and rho seem to be empty. Brendan > > -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox > Sent: 16 November 2011 11:03 > To: 'statalist@hsphsun2.harvard.edu' > Subject: RE: st: FW: ML for logit/ologit > > That is not clear at all. The explanation is different. You are invoking a local rho, which you never define. Your earlier statement defines mu. > > It now also seems that your earlier "along the lines of" means that you were not showing us the code that was buggy, which does help to explain why we couldn't see the bug. > > Please do "Say exactly what you typed and exactly what Stata typed (or did) in response." > > Nick > n.j.cox@durham.ac.uk > > Thomas Murray (Department of Economics) > > I have run the set trace and it is clear there is a problem with the including an argument within the squared term (I've pasted the relevant part below). I am sure this is the bug but I do not know why Stata doesn't like it. > > I am confident all the quotations are correct in the program. > > Many Thanks, > > Tom > > - mata: Mopt_search() > ------------------------------------------------------------------------------------------------ begin logittest --- > - version 12.0 > - args lnf b1 b2 x mu > - tempvar lng > - qui { > - gen double `lng' = ln(invlogit(`b1'*((`x'^(1-`rho')-1)/(1-`rho')))) if $ML_y1==1 > = gen double __000007 = ln(invlogit(__000006*((^(1-)-1)/(1-)))) if educ1==1 unknown function ^() > replace `lng' = ln(invlogit(-`b1'*((`x'^(1-`rho')-1)/(1-`rho')))) if $ML_y1==0 > replace `lnf' = `lng' > > > > -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox > Sent: 16 November 2011 10:17 > To: 'statalist@hsphsun2.harvard.edu' > Subject: RE: st: FW: ML for logit/ologit > > I don't think the example calls for such a sweeping generalization. > People write programs to maximise non-linear functions in Stata [sic] > all the time. > > There is a bug in Thomas' code. I can't spot it and there is a lingering > doubt about use of quotation marks from previous posts. Using -set > trace- might help him find where it is. > > > * > * 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/ > -- Brendan Halpin, Department of Sociology, University of Limerick, Ireland Tel: w +353-61-213147 f +353-61-202569 h +353-61-338562; Room F1-009 x 3147 mailto:brendan.halpin@ul.ie ULSociology on Facebook: http://on.fb.me/fjIK9t http://teaching.sociology.ul.ie/bhalpin/wordpress twitter:@ULSociology * * 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: FW: ML for logit/ologit***From:*"Thomas Murray (Department of Economics)" <t.l.murray@bham.ac.uk>

**Re: st: FW: ML for logit/ologit***From:*Yuval Arbel <yuval.arbel@gmail.com>

**RE: st: FW: ML for logit/ologit***From:*Nick Cox <n.j.cox@durham.ac.uk>

**RE: st: FW: ML for logit/ologit***From:*"Thomas Murray (Department of Economics)" <t.l.murray@bham.ac.uk>

**RE: st: FW: ML for logit/ologit***From:*Nick Cox <n.j.cox@durham.ac.uk>

**RE: st: FW: ML for logit/ologit***From:*"Thomas Murray (Department of Economics)" <t.l.murray@bham.ac.uk>

- Prev by Date:
**Re: st: RE: nl-function log4-formula** - Next by Date:
**RE: st: Quantum mechanics in Stata** - Previous by thread:
**RE: st: FW: ML for logit/ologit** - Next by thread:
**RE: st: FW: ML for logit/ologit** - Index(es):