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

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

From |
Maarten Buis <maartenlbuis@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: ml - could not calculate numerical derivatives missing values encountered |

Date |
Thu, 15 Dec 2011 15:00:19 +0100 |

2011/12/15 Alan Marshall : > I have worked out the log-likelihood function as below. <snip> > *line 3 > Quietly replace `lnf'=2*`a'*${dx_Dis}1+`b'*${Yxl}1*${dx_Dis}1-(${Nx_Dis}1*ln(1+(exp(2*(`a'+`b'*${Yxl}1))))) ${dx_Dis}1, *${Yxl}1, and ${Nx_Dis}1 look very suspicious to me. If you have a global called dx_Dis1 than calling it ${dx_Dis}1, will do the following: Stata looks for a global macro called dx_Dis, can't find it, so evaluates that to nothing, and than sees the 1. So in that case ${dx_Dis}1 always evaluates to 1. If you want to refer to a global macro called dx_Dis1 than you should call it $dx_Dis1 or ${dx_Dis1}. It may make sense when you want to refer to a variable called for example foo1 and the global macro dx_Dis contains the string foo. In that case Stata will first evaluate the macro dx_Dis to foo and than attach the 1 at the end. I would never do something like that though, as it would make debugging such code a pain. It is much much much better to let the macro dx_Dis contain the string foo1 Hope this helps, Maarten -------------------------- Maarten L. Buis Institut fuer Soziologie Universitaet Tuebingen Wilhelmstrasse 36 72074 Tuebingen Germany http://www.maartenbuis.nl -------------------------- * * 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: ml - could not calculate numerical derivatives missing values encountered***From:*Alan Marshall <A.D.Marshall@leeds.ac.uk>

- Prev by Date:
**Re: st: How to solve the matrix equation AX = B for X without using Mata** - Next by Date:
**Re: st: Small standard errors of the parameters in logit models** - Previous by thread:
**st: ml - could not calculate numerical derivatives missing values encountered** - Next by thread:
**Re: st: ml - could not calculate numerical derivatives missing values encountered** - Index(es):