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]
st: My program does not accept more than two args
From
francesco manaresi <[email protected]>
To
[email protected]
Subject
st: My program does not accept more than two args
Date
Sun, 2 May 2010 00:04:25 +0200
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?
Thank you very much,
Francesco Manaresi
*
* 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/