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 |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: My program does not accept more than two args |

Date |
Mon, 3 May 2010 17:06:34 +0100 |

Although you got suggestions of alternative code, your problem was not addressed. Your own trace shows that -normal- only receives two arguments. normal __000004 __000003 Here __000004 __000003 are temporary names. Its willingness to process three or more was not the issue. The problem arises from how it was called. Nick n.j.cox@durham.ac.uk francesco manaresi This may be obvious, if so I apologize in advance: I am a newbie in programming. I want to implement a maximum-likelihood estimate, but got problems in letting the program accept more than 2 arguments (in args). Consider the simplest case: a normal model. The program is: *** program define normal version 1.0 args lnf sigma mu quietly replace `lnf'=ln( normd(($ML_y1-`mu')/`sigma') ) - ln(`sigma') end *** then I should "ml model lf normal equations , " however it doesn't work. If I check I obtain *** . ml check Test 1: Calling normal to check if it computes log likelihood and does not alter coefficient vector... FAILED; normal returned error 198. Here is a trace of its execution: ------------------------------------------------------------------------------ -> normal __000004 __000003 - `begin' = capture noisily version 10.1: normal __000004 __000003 -------------------------------------------------------------------------------------------------------- begin normal --- - version 1.0 - args lnf sigma mu - quietly replace `lnf'=ln( normd(($ML_y1-`mu')/`sigma') ) - ln(`sigma') = quietly replace __000004=ln( normd((y-)/__000003) ) - ln(__000003) y- invalid name ---------------------------------------------------------------------------------------------------------- end normal --- - `end' = set trace off ------------------------------------------------------------------------------ Fix normal. r(198); *** as it can be seen, the program "normal" just considered `lnf' and `sigma', while it did not consider `mu'. Similar results are obtained if I switch position of `mu', `sigma', or `lnf': the third macro is always not considered. What am I mistaking? * * 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: My program does not accept more than two args***From:*francesco manaresi <manaresi@gmail.com>

- Prev by Date:
**Re: st: creating variable from svy: proportion** - Next by Date:
**AW: st: Text size in graphs** - Previous by thread:
**Re: st: My program does not accept more than two args** - Next by thread:
**st: SSC Activity, April 2010** - Index(es):