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

RE: st: Efficiency of calculating maximum likelihood


From   "Scott Merryman" <smerryman@kc.rr.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Efficiency of calculating maximum likelihood
Date   Mon, 2 Jan 2006 19:17:15 -0600

It appears that the initial values for the constant-only model are
hard-coded.

Using the lognormal distribution as an example, you can alter (after making
a copy for safekeeping) -lnormal.ado- so that if accepts the initial values
passed to it.

If you alter line 142:
				*/ init(_cons=1) /*

to
				*/ `iniopt' /*


it will take the values passed to it from -from()-

Now, there is only one iteration in the constant-only model in the second
specification below:

sysuse cancer, clear 
qui stset studytime, failure(died)
qui streg , dist(lnorm) 
matrix b0 = e(b)
streg  study age , dist(lnorm) from(b0)  trace



. qui stset studytime, failure(died)

. qui streg , dist(lnorm) 

. matrix b0 = e(b)

. streg  study age , dist(lnorm) from(b0)	trace

failure _d:  died
analysis time _t:  studytime

Fitting constant-only model:

					
Iteration 0:
Coefficient vector:
_t:   ln_sig:
_cons     _cons
r1  2.768933  .1422957

		log likelihood	=	-60.991749
					
Iteration 1:
Coefficient vector:
_t:   ln_sig:
_cons     _cons
r1  2.768933  .1422957

		log likelihood	=	-60.991749
					

Fitting full model:
.
.
.

Hope this helps,
Scott


> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-
> statalist@hsphsun2.harvard.edu] On Behalf Of Maarten buis
> Sent: Monday, January 02, 2006 2:33 PM
> To: statalist@hsphsun2.harvard.edu
> Subject: RE: st: Efficiency of calculating maximum likelihood
> 
> Hi Steinar,
> 
> My initial guess was you could use the previous estimates as starting
> values. It might speed
> things up, but as the example below shows, that does not have to be. In
> the example the model with
> starting values needed more itterations than the model without.
> 
> *------------begin example--------------
> sysuse cancer, clear
> stset studytime, failure(died)
> xi: streg i.drug age, dist(lnorm)
> matrix b0 = e(b)
> xi: streg i.drug , dist(lnorm) from(b0, skip)
> xi: streg i.drug , dist(lnorm)
> *-------------end example-----------------
> 
> HTH,
> Maarten
> 
> 
> -----------------------------------------
> Maarten L. Buis
> Department of Social Research Methodology
> Vrije Universiteit Amsterdam
> Boelelaan 1081
> 1081 HV Amsterdam
> The Netherlands
> 
> visiting adress:
> Buitenveldertselaan 3 (Metropolitan), room Z214
> 
> +31 20 5986715
> 
> http://home.fsw.vu.nl/m.buis/
> -----------------------------------------
> 
> Steinar Fossedal wrote:
> > I'm trying to fit a model using stepwise selection, and so I
> > reestimate fairly similar models over and over. Fitting a model
> > using -streg- takes about an hour using my dataset. I noticed
> > that two thirds of the calculation time is spent calculating
> > the constant-only model - which is exactly the same for all the
> > estimations. Is there any way of making stata use the results
> > of previous calculations to save time in this process?
> 


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