Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Max likelihood programing and sub-routines


From   "Hoetker, Glenn" <[email protected]>
To   <[email protected]>
Subject   st: Max likelihood programing and sub-routines
Date   Mon, 27 Jan 2003 16:31:48 -0600

Hi all.  I am trying to develop an ado file that calls a maximum
likelihood estimator and am having a horrid time.  I've included the
code below.  When it reaches " ml model lf palogit (`dep'=`xvars'
`group') (delta: `group', nocons)", execution stops with "Unrecognized
command:  palogit
program palogit not found".  

Yet from the documentation and various examples, defining palogit at the
bottom of the program would appear to be a valid means of defining a
sub-routine.  What am I doing wrong?  Do I need to have palogit defined
as a separate ado file (I really hope not for ease of distribution)?

Many thanks for any help you can offer.  

Glenn


*****
program define complogit
	version 8.0
	syntax varlist, Group(varlist min=1 max=1)
	capture program drop palogit
	
//Parse variable list
	gettoken dep xvars : varlist
	
//Run logit equations and save results
	logit `dep' `xvars'
	estimates store all
	
	ml model lf palogit (`dep'=`xvars' `group') (delta: `group',
nocons)
	ml search
	ml maximize
end

program palogit
	version 8
	args lnf theta delta
	quietly replace `lnf'= 				///
	$ML_y1 * `theta' * (1+`delta')- 		///
	ln(1+exp(`theta' * (1+`delta')))
end


Glenn Hoetker
Assistant Professor of Strategy
College of Business Administration
University of Illinois at Urbana-Champaign
217-265-4081
[email protected]
"Success is going from failure to failure without a loss of enthusiasm."
Sir Winston Churchill 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index