Bookmark and Share

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]

Re: st: My program does not accept more than two args


From   Tirthankar Chakravarty <tirthankar.chakravarty@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: My program does not accept more than two args
Date   Sun, 2 May 2010 04:02:08 +0530

Try this:
**************************************************
sysuse auto, clear
cap prog drop normreg
program define normreg
	version 11.0
	args lnf mu sigma
	qui replace `lnf'=log(normalden(($ML_y1-`mu')/`sigma')) ///
						-log(`sigma')
end
ml model lf normreg (mean: mpg=weight length) (variance:)
ml check
ml max
**************************************************

T

2010/5/2 Richard Williams <Williams.NDA@comcast.net>:
> At 05:04 PM 5/1/2010, francesco manaresi wrote:
>>
>> 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:
>
> Incidentally, I highly recommend Stata's ML programming book:
>
> http://www.stata.com/bookstore/mle.html
>
> That page includes links to the programs and data sets used in the book.
>
>
> -------------------------------------------
> Richard Williams, Notre Dame Dept of Sociology
> OFFICE: (574)631-6668, (574)631-6463
> HOME:   (574)289-5227
> EMAIL:  Richard.A.Williams.5@ND.Edu
> WWW:    http://www.nd.edu/~rwilliam
>
> *
> *   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/
>



-- 
To every ω-consistent recursive class κ of formulae there correspond
recursive class signs r, such that neither v Gen r nor Neg(v Gen r)
belongs to Flg(κ) (where v is the free variable of r).

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index