This is the same problem as before.
The trace is showing you that Stata doesn't
know what `lgam' is. Indeed nowhere do
you tell Stata what the variables are which you're
using, so there is no reason to expect
the program to work.
Just keep reading in the book, and things
should get much clearer.
Nick
[email protected]
[email protected]
> After I load the program below, I type
> ml model lf weib1 ()
> ml check
> upon which the following trace & error are returned:
> 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
> 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 weib1 ---
> - `end'
> = set trace off
> ---------------------------------------------------------------
> Fix weib1.
>
> If I use the 'cancer' dataset and use the same -ml model-
> command, the same trace & error are returned. Perhaps I am
> missing something obvious in the argument specification?
> Again, I suspect that my single vector of datapoints may be the
> problem or, perhaps, my confusion regarding proper
> variable/argument specification in the -ml model- command.
> Just to reiterate, I am interested in estimating the theta &
> beta from the Weibull pdf using my small dataset. As always,
> any input is appreciated!
> cheers, clint
>
> On 15 Apr 2004 at 11:16, Nick Cox wrote:
>
> > As you say, this program looks essentially that in Gould,
> > Pitblado and Sribney (p. 57). I can't see any
> > typos. I wondered if there would be difficulties
> > if `leta' were ever negative in your data, but
> > Stata does the right thing with e.g. exp(--2).
> > So I am reduced to the old advice
> >
> > Say exactly what you typed and exactly what Stata typed
> > (or did) in response. N.B. exactly! If you can, reproduce
> > the error with one of Stata's provided datasets or a simple
> > concocted dataset that you include in your posting.
> >
> > Nick
> > [email protected]
> >
> > [email protected]
> >
> > > now I am at a loss as to the proper
> > > implementation of the Weibull MLE program supplied by Gould,
> > > Pitblado, & Scribney when I have a single vector of data
> > > (survival time). The program I'm using 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
> > >
> > > This program executes without problem when used on the 'cancer'
> > > dataset (with some modification to the variable 'drug' of
> > > course) that is accessible from within Stata but terminates in
> > > error on my dataset with 'invalid syntax'. My question is
> > > this: what am I overlooking from a programming perspective?
> > > My objective is estimation of theta & beta and -nlcom- will
> > > accomplish this, however, I wish to take the scenic route on
> > > this one thus my desire to do this with Stata's -ml- commands.
*
* 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/