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

st: Weibull MLE & method `lf'


From   <[email protected]>
To   [email protected]
Subject   st: Weibull MLE & method `lf'
Date   Fri, 02 Apr 2004 09:34:25 -0700

Greetings Statalisters ---
I'm using Gould, Pitblado, & Scribney's 'Maximum Likelihood 
Estimation w/ Stata' book (2nd ed.) and want to use the program 
(pg. 57) the authors have provided for use w/ the Weibull 
distribution.  I used their program verbatim but when I run it 
on my (small) data set, one of several errors is returned 
(invalid syntax, unknown operation, etc.).  I have two 
variables:  'relapse' (time to relapse) and 'censor' (0 for 
censored and 1 otherwise -- incidentally, none of the 
observations are censored, so maybe this variable is 
unnecessary).  The program is pasted below:
 
program weib1
	version 8.2
	args lnf leta lgam
	tempvar p M R
	quietly {
		gen double `p' = exp(`lgam')
		gen double `M' = ($ML_y1*exp(-`leta'))^`p'
		gen double `R' = ln($ML_y1)-`leta'
		replace `lnf' = -`M'+$ML_y2*(`lgam'-`leta'+(`p'-
1)*`R')
	}
end

And this is the code w/ a snippet of the output & subsequent 
error:

. ml model lf weib1 ()
. ml maximize
invalid syntax
r(198);

. ml check

Test 1:  Calling weib1 to check if it computes log likelihood 
and
         does not alter coefficient vector...
         FAILED; weib1 returned error 198.

Here is a trace of its execution:
---------------------------------------------------------------
-> 
weib1 __000003 __000002
            - `begin'
            = capture noisily version 8.2: weib1 __000003 
__000002
              -------------------------------------------------
--------------- begin weib1 ---
              - version 8.2
              - args lnf leta lgam
              - tempvar p M R
              - quietly {
              - gen double `p' = exp(`lgam')
              = gen double __000004 = exp()
invalid syntax


    
Does anyone have any suggestions?  Perhaps I am missing 
something obvious altogether regarding maximum likelihood 
estimation and if so, I'd appreciate any feedback.  
Parenthetically, I started a thread on Weibull maximum 
likelihood estimation about one year ago and Bobby Gutierrez & 
Nick Cox kindly pointed me towards the -nlcom- command which 
accomplishes what I need, however, I want to learn how to do 
this via the 'nuts & bolts' way. 
cheers,
Clint Thompson 

*
*   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